@sayren/store-sdk 0.29.3 → 0.29.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.
- package/dist/index.d.mts +148 -48
- package/dist/index.mjs +61 -9
- package/package.json +1 -1
- package/src/schemas/collection.ts +99 -7
package/dist/index.d.mts
CHANGED
|
@@ -165,8 +165,8 @@ export declare const auditLogPageSchema: z.ZodObject<{
|
|
|
165
165
|
}, z.core.$strip>;
|
|
166
166
|
export type AuditLogPage = z.infer<typeof auditLogPageSchema>;
|
|
167
167
|
export declare const agentPolicyDecisionSchema: z.ZodEnum<{
|
|
168
|
-
APPROVAL_REQUIRED: "APPROVAL_REQUIRED";
|
|
169
168
|
DENIED: "DENIED";
|
|
169
|
+
APPROVAL_REQUIRED: "APPROVAL_REQUIRED";
|
|
170
170
|
ALLOW: "ALLOW";
|
|
171
171
|
}>;
|
|
172
172
|
export type AgentPolicyDecision = z.infer<typeof agentPolicyDecisionSchema>;
|
|
@@ -190,8 +190,8 @@ export type WritePreview = z.infer<typeof writePreviewSchema>;
|
|
|
190
190
|
export declare const writeDryRunResultSchema: z.ZodObject<{
|
|
191
191
|
dryRun: z.ZodLiteral<true>;
|
|
192
192
|
decision: z.ZodEnum<{
|
|
193
|
-
APPROVAL_REQUIRED: "APPROVAL_REQUIRED";
|
|
194
193
|
DENIED: "DENIED";
|
|
194
|
+
APPROVAL_REQUIRED: "APPROVAL_REQUIRED";
|
|
195
195
|
ALLOW: "ALLOW";
|
|
196
196
|
}>;
|
|
197
197
|
reason: z.ZodNullable<z.ZodString>;
|
|
@@ -966,11 +966,11 @@ export type ApiLogSummary = z.infer<typeof apiLogSummarySchema>;
|
|
|
966
966
|
//#endregion
|
|
967
967
|
//#region src/schemas/category.d.ts
|
|
968
968
|
export declare const categoryProductSortSchema: z.ZodEnum<{
|
|
969
|
-
NAME: "NAME";
|
|
970
969
|
RECENT: "RECENT";
|
|
971
970
|
POPULAR: "POPULAR";
|
|
972
971
|
PRICE_LOW: "PRICE_LOW";
|
|
973
972
|
PRICE_HIGH: "PRICE_HIGH";
|
|
973
|
+
NAME: "NAME";
|
|
974
974
|
}>;
|
|
975
975
|
export type CategoryProductSort = z.infer<typeof categoryProductSortSchema>;
|
|
976
976
|
export declare const categorySchema: z.ZodObject<{
|
|
@@ -986,11 +986,11 @@ export declare const categorySchema: z.ZodObject<{
|
|
|
986
986
|
showPc: z.ZodBoolean;
|
|
987
987
|
showMobile: z.ZodBoolean;
|
|
988
988
|
productSort: z.ZodEnum<{
|
|
989
|
-
NAME: "NAME";
|
|
990
989
|
RECENT: "RECENT";
|
|
991
990
|
POPULAR: "POPULAR";
|
|
992
991
|
PRICE_LOW: "PRICE_LOW";
|
|
993
992
|
PRICE_HIGH: "PRICE_HIGH";
|
|
993
|
+
NAME: "NAME";
|
|
994
994
|
}>;
|
|
995
995
|
metaTitle: z.ZodNullable<z.ZodString>;
|
|
996
996
|
metaDescription: z.ZodNullable<z.ZodString>;
|
|
@@ -1016,11 +1016,11 @@ export declare const categoryWithPathSchema: z.ZodObject<{
|
|
|
1016
1016
|
showPc: z.ZodBoolean;
|
|
1017
1017
|
showMobile: z.ZodBoolean;
|
|
1018
1018
|
productSort: z.ZodEnum<{
|
|
1019
|
-
NAME: "NAME";
|
|
1020
1019
|
RECENT: "RECENT";
|
|
1021
1020
|
POPULAR: "POPULAR";
|
|
1022
1021
|
PRICE_LOW: "PRICE_LOW";
|
|
1023
1022
|
PRICE_HIGH: "PRICE_HIGH";
|
|
1023
|
+
NAME: "NAME";
|
|
1024
1024
|
}>;
|
|
1025
1025
|
metaTitle: z.ZodNullable<z.ZodString>;
|
|
1026
1026
|
metaDescription: z.ZodNullable<z.ZodString>;
|
|
@@ -1041,11 +1041,11 @@ export declare const categoryWithPathSchema: z.ZodObject<{
|
|
|
1041
1041
|
showPc: z.ZodBoolean;
|
|
1042
1042
|
showMobile: z.ZodBoolean;
|
|
1043
1043
|
productSort: z.ZodEnum<{
|
|
1044
|
-
NAME: "NAME";
|
|
1045
1044
|
RECENT: "RECENT";
|
|
1046
1045
|
POPULAR: "POPULAR";
|
|
1047
1046
|
PRICE_LOW: "PRICE_LOW";
|
|
1048
1047
|
PRICE_HIGH: "PRICE_HIGH";
|
|
1048
|
+
NAME: "NAME";
|
|
1049
1049
|
}>;
|
|
1050
1050
|
metaTitle: z.ZodNullable<z.ZodString>;
|
|
1051
1051
|
metaDescription: z.ZodNullable<z.ZodString>;
|
|
@@ -1069,11 +1069,11 @@ export declare const categorySearchResultSchema: z.ZodObject<{
|
|
|
1069
1069
|
showPc: z.ZodBoolean;
|
|
1070
1070
|
showMobile: z.ZodBoolean;
|
|
1071
1071
|
productSort: z.ZodEnum<{
|
|
1072
|
-
NAME: "NAME";
|
|
1073
1072
|
RECENT: "RECENT";
|
|
1074
1073
|
POPULAR: "POPULAR";
|
|
1075
1074
|
PRICE_LOW: "PRICE_LOW";
|
|
1076
1075
|
PRICE_HIGH: "PRICE_HIGH";
|
|
1076
|
+
NAME: "NAME";
|
|
1077
1077
|
}>;
|
|
1078
1078
|
metaTitle: z.ZodNullable<z.ZodString>;
|
|
1079
1079
|
metaDescription: z.ZodNullable<z.ZodString>;
|
|
@@ -1094,11 +1094,11 @@ export declare const categorySearchResultSchema: z.ZodObject<{
|
|
|
1094
1094
|
showPc: z.ZodBoolean;
|
|
1095
1095
|
showMobile: z.ZodBoolean;
|
|
1096
1096
|
productSort: z.ZodEnum<{
|
|
1097
|
-
NAME: "NAME";
|
|
1098
1097
|
RECENT: "RECENT";
|
|
1099
1098
|
POPULAR: "POPULAR";
|
|
1100
1099
|
PRICE_LOW: "PRICE_LOW";
|
|
1101
1100
|
PRICE_HIGH: "PRICE_HIGH";
|
|
1101
|
+
NAME: "NAME";
|
|
1102
1102
|
}>;
|
|
1103
1103
|
metaTitle: z.ZodNullable<z.ZodString>;
|
|
1104
1104
|
metaDescription: z.ZodNullable<z.ZodString>;
|
|
@@ -1130,11 +1130,11 @@ export declare const categoryCreateRequestSchema: z.ZodObject<{
|
|
|
1130
1130
|
showPc: z.ZodOptional<z.ZodBoolean>;
|
|
1131
1131
|
showMobile: z.ZodOptional<z.ZodBoolean>;
|
|
1132
1132
|
productSort: z.ZodOptional<z.ZodEnum<{
|
|
1133
|
-
NAME: "NAME";
|
|
1134
1133
|
RECENT: "RECENT";
|
|
1135
1134
|
POPULAR: "POPULAR";
|
|
1136
1135
|
PRICE_LOW: "PRICE_LOW";
|
|
1137
1136
|
PRICE_HIGH: "PRICE_HIGH";
|
|
1137
|
+
NAME: "NAME";
|
|
1138
1138
|
}>>;
|
|
1139
1139
|
metaTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1140
1140
|
metaDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -1149,11 +1149,11 @@ export declare const categoryPatchRequestSchema: z.ZodObject<{
|
|
|
1149
1149
|
showPc: z.ZodOptional<z.ZodBoolean>;
|
|
1150
1150
|
showMobile: z.ZodOptional<z.ZodBoolean>;
|
|
1151
1151
|
productSort: z.ZodOptional<z.ZodEnum<{
|
|
1152
|
-
NAME: "NAME";
|
|
1153
1152
|
RECENT: "RECENT";
|
|
1154
1153
|
POPULAR: "POPULAR";
|
|
1155
1154
|
PRICE_LOW: "PRICE_LOW";
|
|
1156
1155
|
PRICE_HIGH: "PRICE_HIGH";
|
|
1156
|
+
NAME: "NAME";
|
|
1157
1157
|
}>>;
|
|
1158
1158
|
metaTitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1159
1159
|
metaDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -1530,7 +1530,7 @@ export declare const COLLECTION_SLUG_PATTERN: RegExp;
|
|
|
1530
1530
|
export declare const COLLECTION_TYPES: readonly ["MANUAL", "AUTOMATIC"];
|
|
1531
1531
|
export type CollectionType = (typeof COLLECTION_TYPES)[number];
|
|
1532
1532
|
/**
|
|
1533
|
-
* 상품 정렬 — `MANUAL`은 직접 정한 순서(직접 선택 컬렉션만)다. `BEST_SELLING`(판매량순)은
|
|
1533
|
+
* 상품 정렬 — `MANUAL`은 직접 정한 순서(직접 선택 컬렉션만)다. `BEST_SELLING`(판매량순)은 판매 수량이 많은 순이다(M3).
|
|
1534
1534
|
* 저장 값 전체 목록이고, 쓰기에서 받는 값은 `collectionProductSortRequestSchema`다.
|
|
1535
1535
|
*/
|
|
1536
1536
|
export declare const COLLECTION_PRODUCT_SORTS: readonly ["MANUAL", "LATEST", "BEST_SELLING", "PRICE_ASC", "PRICE_DESC", "REVIEW_COUNT", "RATING_DESC", "RECOMMEND"];
|
|
@@ -1540,6 +1540,7 @@ export declare const collectionProductSortRequestSchema: z.ZodEnum<{
|
|
|
1540
1540
|
PRICE_DESC: "PRICE_DESC";
|
|
1541
1541
|
MANUAL: "MANUAL";
|
|
1542
1542
|
LATEST: "LATEST";
|
|
1543
|
+
BEST_SELLING: "BEST_SELLING";
|
|
1543
1544
|
REVIEW_COUNT: "REVIEW_COUNT";
|
|
1544
1545
|
RATING_DESC: "RATING_DESC";
|
|
1545
1546
|
RECOMMEND: "RECOMMEND";
|
|
@@ -1566,9 +1567,17 @@ export declare const MAX_COLLECTION_RULE_CATEGORIES = 20;
|
|
|
1566
1567
|
export declare const MAX_COLLECTION_CREATED_WITHIN_DAYS = 365;
|
|
1567
1568
|
/** 미리보기(`POST /v1/collections/preview`)가 싣는 상품 최대 개수 */
|
|
1568
1569
|
export declare const COLLECTION_PREVIEW_SIZE = 20;
|
|
1570
|
+
/** 판매량 상위 조건의 기간 선택지(일, 오늘 포함 한국 날짜) */
|
|
1571
|
+
export declare const COLLECTION_BEST_SELLING_DAYS: readonly [7, 30, 90];
|
|
1572
|
+
export type CollectionBestSellingDays = (typeof COLLECTION_BEST_SELLING_DAYS)[number];
|
|
1573
|
+
/** 판매량 상위 조건이 담는 상품 최대 개수 */
|
|
1574
|
+
export declare const MAX_COLLECTION_BEST_SELLING_TOP = 100;
|
|
1575
|
+
/** 판매량순(`BEST_SELLING`) 정렬의 기간 — 판매량 상위 조건이 없을 때 쓴다 */
|
|
1576
|
+
export declare const COLLECTION_SALES_SORT_DEFAULT_DAYS: CollectionBestSellingDays;
|
|
1569
1577
|
/**
|
|
1570
1578
|
* 조건 하나 — `field`로 가른다. 가격은 즉시할인을 반영한 판매가(`discountedPrice ?? salePrice`)다.
|
|
1571
|
-
* 판매량 상위(`bestSelling`)는
|
|
1579
|
+
* 판매량 상위(`bestSelling`)는 술어가 아니라 순위 자르기다. 다른 조건을 모두 만족한 상품 중 판매 수량 상위 N개만 남긴다(`rankBestSelling`).
|
|
1580
|
+
* 판매 수량은 실결제 주문의 결제 수량에서 취소·반품 수량을 뺀 값이고, 날짜는 주문 시각의 한국 날짜다. 집계는 최대 10분 늦다.
|
|
1572
1581
|
*/
|
|
1573
1582
|
export declare const collectionRuleSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1574
1583
|
field: z.ZodLiteral<"createdWithinDays">;
|
|
@@ -1583,6 +1592,10 @@ export declare const collectionRuleSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
1583
1592
|
}, z.core.$strip>, z.ZodObject<{
|
|
1584
1593
|
field: z.ZodLiteral<"discounted">;
|
|
1585
1594
|
value: z.ZodLiteral<true>;
|
|
1595
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1596
|
+
field: z.ZodLiteral<"bestSelling">;
|
|
1597
|
+
days: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<30>, z.ZodLiteral<90>]>;
|
|
1598
|
+
top: z.ZodNumber;
|
|
1586
1599
|
}, z.core.$strip>], "field">;
|
|
1587
1600
|
export type CollectionRule = z.infer<typeof collectionRuleSchema>;
|
|
1588
1601
|
export type CollectionRuleField = CollectionRule["field"];
|
|
@@ -1600,6 +1613,10 @@ export declare const collectionRulesSchema: z.ZodArray<z.ZodDiscriminatedUnion<[
|
|
|
1600
1613
|
}, z.core.$strip>, z.ZodObject<{
|
|
1601
1614
|
field: z.ZodLiteral<"discounted">;
|
|
1602
1615
|
value: z.ZodLiteral<true>;
|
|
1616
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1617
|
+
field: z.ZodLiteral<"bestSelling">;
|
|
1618
|
+
days: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<30>, z.ZodLiteral<90>]>;
|
|
1619
|
+
top: z.ZodNumber;
|
|
1603
1620
|
}, z.core.$strip>], "field">>;
|
|
1604
1621
|
/**
|
|
1605
1622
|
* 응답의 조건 — 이 SDK가 아는 조건이거나 뒤에 더해질 조건(`field`만 확인한다)이다. 새 조건이 생겨도 옛 SDK의 응답 검증이 깨지지 않는다.
|
|
@@ -1617,6 +1634,10 @@ export declare const collectionRuleViewSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
1617
1634
|
}, z.core.$strip>, z.ZodObject<{
|
|
1618
1635
|
field: z.ZodLiteral<"discounted">;
|
|
1619
1636
|
value: z.ZodLiteral<true>;
|
|
1637
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1638
|
+
field: z.ZodLiteral<"bestSelling">;
|
|
1639
|
+
days: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<30>, z.ZodLiteral<90>]>;
|
|
1640
|
+
top: z.ZodNumber;
|
|
1620
1641
|
}, z.core.$strip>, z.ZodObject<{
|
|
1621
1642
|
field: z.ZodString;
|
|
1622
1643
|
}, z.core.$loose>]>;
|
|
@@ -1643,11 +1664,33 @@ export declare function descendantCategoryIdsOf(roots: readonly string[], catego
|
|
|
1643
1664
|
/**
|
|
1644
1665
|
* 조건 판정 함수를 만든다 — 모든 조건을 만족해야 true다(AND). 카테고리 트리는 여기서 한 번만 푼다.
|
|
1645
1666
|
* 알 수 없는 조건(`field`)은 만족하지 않는 것으로 본다. 모르는 조건을 건너뛰면 상품이 예고 없이 늘어난다.
|
|
1667
|
+
* 판매량 상위(`bestSelling`)는 여기서 모두 통과시킨다. 순위 자르기는 판매량을 아는 호출부가 `rankBestSelling`으로 한다.
|
|
1646
1668
|
* 판매 상태는 보지 않는다. 판매 중만 거르는 것은 호출부다.
|
|
1647
1669
|
*/
|
|
1648
1670
|
export declare function collectionRulesPredicate(rules: readonly CollectionRuleView[], context: CollectionRuleContext): (product: CollectionRuleProduct) => boolean;
|
|
1649
1671
|
/** 상품 하나가 조건을 모두 만족하는가 — 여러 상품을 판정할 때는 `collectionRulesPredicate`를 한 번 만들어 쓴다 */
|
|
1650
1672
|
export declare function matchesCollectionRules(product: CollectionRuleProduct, rules: readonly CollectionRuleView[], context: CollectionRuleContext): boolean;
|
|
1673
|
+
/** 판매량 상위 조건 — 없으면 null. 같은 조건은 한 번만 쓰므로 첫 번째다 */
|
|
1674
|
+
export declare function bestSellingRuleOf(rules: readonly CollectionRuleView[]): {
|
|
1675
|
+
days: CollectionBestSellingDays;
|
|
1676
|
+
top: number;
|
|
1677
|
+
} | null;
|
|
1678
|
+
/**
|
|
1679
|
+
* 판매량 비교 — 판매 수량이 많은 순, 같으면 최근 등록 순, 그것도 같으면 상품 id 순이다. 결과가 입력 순서에 기대지 않는다.
|
|
1680
|
+
* `sales`에 없는 상품은 0개다.
|
|
1681
|
+
*/
|
|
1682
|
+
export declare function compareBySales<T extends {
|
|
1683
|
+
productId: string;
|
|
1684
|
+
createdAt: string;
|
|
1685
|
+
}>(sales: ReadonlyMap<string, number>): (a: T, b: T) => number;
|
|
1686
|
+
/**
|
|
1687
|
+
* 판매량 상위 자르기 — 다른 조건을 통과한 상품 중 판매 수량이 1개 이상인 상품을 `compareBySales` 순으로 `top`개 남긴다.
|
|
1688
|
+
* 판매가 없는 상품은 넣지 않는다.
|
|
1689
|
+
*/
|
|
1690
|
+
export declare function rankBestSelling<T extends {
|
|
1691
|
+
productId: string;
|
|
1692
|
+
createdAt: string;
|
|
1693
|
+
}>(products: readonly T[], sales: ReadonlyMap<string, number>, top: number): T[];
|
|
1651
1694
|
/** 조건이 참조하는 카테고리 id — 카테고리 삭제의 참조 검사에 쓴다 */
|
|
1652
1695
|
export declare function collectionRuleCategoryIds(rules: readonly CollectionRuleView[]): string[];
|
|
1653
1696
|
export declare const collectionSchema: z.ZodObject<{
|
|
@@ -1671,6 +1714,10 @@ export declare const collectionSchema: z.ZodObject<{
|
|
|
1671
1714
|
}, z.core.$strip>, z.ZodObject<{
|
|
1672
1715
|
field: z.ZodLiteral<"discounted">;
|
|
1673
1716
|
value: z.ZodLiteral<true>;
|
|
1717
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1718
|
+
field: z.ZodLiteral<"bestSelling">;
|
|
1719
|
+
days: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<30>, z.ZodLiteral<90>]>;
|
|
1720
|
+
top: z.ZodNumber;
|
|
1674
1721
|
}, z.core.$strip>, z.ZodObject<{
|
|
1675
1722
|
field: z.ZodString;
|
|
1676
1723
|
}, z.core.$loose>]>>>;
|
|
@@ -1686,6 +1733,7 @@ export declare const collectionSchema: z.ZodObject<{
|
|
|
1686
1733
|
SCHEDULED: "SCHEDULED";
|
|
1687
1734
|
HIDDEN: "HIDDEN";
|
|
1688
1735
|
}>;
|
|
1736
|
+
salesComputedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1689
1737
|
productCount: z.ZodNumber;
|
|
1690
1738
|
revision: z.ZodNumber;
|
|
1691
1739
|
createdAt: z.ZodString;
|
|
@@ -1695,7 +1743,7 @@ export type Collection = z.infer<typeof collectionSchema>;
|
|
|
1695
1743
|
/**
|
|
1696
1744
|
* `POST /v1/collections` — 컬렉션을 만든다. `slug`를 생략하면 `c-{id 뒤 8자}`로 만든다.
|
|
1697
1745
|
* 직접 선택(`MANUAL`)은 `productIds`가 처음 담을 상품과 순서다. 조건 자동(`AUTOMATIC`)은 `rules`가 있어야 하고 `productIds`를 받지 않는다.
|
|
1698
|
-
* `productSort`를 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST
|
|
1746
|
+
* `productSort`를 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST`(판매량 상위 조건이 있으면 `BEST_SELLING`)다. 조건 자동은 `MANUAL`을 쓸 수 없다.
|
|
1699
1747
|
*/
|
|
1700
1748
|
export declare const collectionCreateRequestSchema: z.ZodObject<{
|
|
1701
1749
|
title: z.ZodString;
|
|
@@ -1717,6 +1765,10 @@ export declare const collectionCreateRequestSchema: z.ZodObject<{
|
|
|
1717
1765
|
}, z.core.$strip>, z.ZodObject<{
|
|
1718
1766
|
field: z.ZodLiteral<"discounted">;
|
|
1719
1767
|
value: z.ZodLiteral<true>;
|
|
1768
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1769
|
+
field: z.ZodLiteral<"bestSelling">;
|
|
1770
|
+
days: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<30>, z.ZodLiteral<90>]>;
|
|
1771
|
+
top: z.ZodNumber;
|
|
1720
1772
|
}, z.core.$strip>], "field">>>;
|
|
1721
1773
|
description: z.ZodDefault<z.ZodString>;
|
|
1722
1774
|
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
@@ -1725,6 +1777,7 @@ export declare const collectionCreateRequestSchema: z.ZodObject<{
|
|
|
1725
1777
|
PRICE_DESC: "PRICE_DESC";
|
|
1726
1778
|
MANUAL: "MANUAL";
|
|
1727
1779
|
LATEST: "LATEST";
|
|
1780
|
+
BEST_SELLING: "BEST_SELLING";
|
|
1728
1781
|
REVIEW_COUNT: "REVIEW_COUNT";
|
|
1729
1782
|
RATING_DESC: "RATING_DESC";
|
|
1730
1783
|
RECOMMEND: "RECOMMEND";
|
|
@@ -1760,6 +1813,10 @@ export declare const collectionPatchRequestSchema: z.ZodObject<{
|
|
|
1760
1813
|
}, z.core.$strip>, z.ZodObject<{
|
|
1761
1814
|
field: z.ZodLiteral<"discounted">;
|
|
1762
1815
|
value: z.ZodLiteral<true>;
|
|
1816
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1817
|
+
field: z.ZodLiteral<"bestSelling">;
|
|
1818
|
+
days: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<30>, z.ZodLiteral<90>]>;
|
|
1819
|
+
top: z.ZodNumber;
|
|
1763
1820
|
}, z.core.$strip>], "field">>>;
|
|
1764
1821
|
description: z.ZodOptional<z.ZodString>;
|
|
1765
1822
|
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
@@ -1768,6 +1825,7 @@ export declare const collectionPatchRequestSchema: z.ZodObject<{
|
|
|
1768
1825
|
PRICE_DESC: "PRICE_DESC";
|
|
1769
1826
|
MANUAL: "MANUAL";
|
|
1770
1827
|
LATEST: "LATEST";
|
|
1828
|
+
BEST_SELLING: "BEST_SELLING";
|
|
1771
1829
|
REVIEW_COUNT: "REVIEW_COUNT";
|
|
1772
1830
|
RATING_DESC: "RATING_DESC";
|
|
1773
1831
|
RECOMMEND: "RECOMMEND";
|
|
@@ -1837,6 +1895,10 @@ export declare const collectionPageSchema: z.ZodObject<{
|
|
|
1837
1895
|
}, z.core.$strip>, z.ZodObject<{
|
|
1838
1896
|
field: z.ZodLiteral<"discounted">;
|
|
1839
1897
|
value: z.ZodLiteral<true>;
|
|
1898
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1899
|
+
field: z.ZodLiteral<"bestSelling">;
|
|
1900
|
+
days: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<30>, z.ZodLiteral<90>]>;
|
|
1901
|
+
top: z.ZodNumber;
|
|
1840
1902
|
}, z.core.$strip>, z.ZodObject<{
|
|
1841
1903
|
field: z.ZodString;
|
|
1842
1904
|
}, z.core.$loose>]>>>;
|
|
@@ -1852,6 +1914,7 @@ export declare const collectionPageSchema: z.ZodObject<{
|
|
|
1852
1914
|
SCHEDULED: "SCHEDULED";
|
|
1853
1915
|
HIDDEN: "HIDDEN";
|
|
1854
1916
|
}>;
|
|
1917
|
+
salesComputedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1855
1918
|
productCount: z.ZodNumber;
|
|
1856
1919
|
revision: z.ZodNumber;
|
|
1857
1920
|
createdAt: z.ZodString;
|
|
@@ -1909,12 +1972,17 @@ export declare const collectionPreviewRequestSchema: z.ZodObject<{
|
|
|
1909
1972
|
}, z.core.$strip>, z.ZodObject<{
|
|
1910
1973
|
field: z.ZodLiteral<"discounted">;
|
|
1911
1974
|
value: z.ZodLiteral<true>;
|
|
1975
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1976
|
+
field: z.ZodLiteral<"bestSelling">;
|
|
1977
|
+
days: z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<30>, z.ZodLiteral<90>]>;
|
|
1978
|
+
top: z.ZodNumber;
|
|
1912
1979
|
}, z.core.$strip>], "field">>;
|
|
1913
1980
|
productSort: z.ZodOptional<z.ZodEnum<{
|
|
1914
1981
|
PRICE_ASC: "PRICE_ASC";
|
|
1915
1982
|
PRICE_DESC: "PRICE_DESC";
|
|
1916
1983
|
MANUAL: "MANUAL";
|
|
1917
1984
|
LATEST: "LATEST";
|
|
1985
|
+
BEST_SELLING: "BEST_SELLING";
|
|
1918
1986
|
REVIEW_COUNT: "REVIEW_COUNT";
|
|
1919
1987
|
RATING_DESC: "RATING_DESC";
|
|
1920
1988
|
RECOMMEND: "RECOMMEND";
|
|
@@ -1933,6 +2001,7 @@ export declare const collectionPreviewSchema: z.ZodObject<{
|
|
|
1933
2001
|
position: z.ZodNumber;
|
|
1934
2002
|
addedAt: z.ZodString;
|
|
1935
2003
|
}, z.core.$strip>>;
|
|
2004
|
+
salesComputedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1936
2005
|
}, z.core.$strip>;
|
|
1937
2006
|
export type CollectionPreview = z.infer<typeof collectionPreviewSchema>;
|
|
1938
2007
|
//#endregion
|
|
@@ -5466,8 +5535,8 @@ export declare const VARIANT_COUNT_WARNING = 100;
|
|
|
5466
5535
|
* 추가금순은 추가 선택 값이면 값의 추가금, 조합 값이면 그 값이 든 조합 추가금의 최솟값으로 비교하고 같으면 등록순이다.
|
|
5467
5536
|
*/
|
|
5468
5537
|
export declare const optionSortSchema: z.ZodEnum<{
|
|
5469
|
-
REGISTERED: "REGISTERED";
|
|
5470
5538
|
NAME: "NAME";
|
|
5539
|
+
REGISTERED: "REGISTERED";
|
|
5471
5540
|
PRICE_ASC: "PRICE_ASC";
|
|
5472
5541
|
PRICE_DESC: "PRICE_DESC";
|
|
5473
5542
|
}>;
|
|
@@ -5647,8 +5716,8 @@ export declare const productSchema: z.ZodObject<{
|
|
|
5647
5716
|
sortOrder: z.ZodNumber;
|
|
5648
5717
|
}, z.core.$strip>>>>;
|
|
5649
5718
|
optionSort: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
5650
|
-
REGISTERED: "REGISTERED";
|
|
5651
5719
|
NAME: "NAME";
|
|
5720
|
+
REGISTERED: "REGISTERED";
|
|
5652
5721
|
PRICE_ASC: "PRICE_ASC";
|
|
5653
5722
|
PRICE_DESC: "PRICE_DESC";
|
|
5654
5723
|
}>>>;
|
|
@@ -5791,8 +5860,8 @@ export declare const optionModelRequestSchema: z.ZodObject<{
|
|
|
5791
5860
|
usable: z.ZodDefault<z.ZodBoolean>;
|
|
5792
5861
|
}, z.core.$strip>>>;
|
|
5793
5862
|
optionSort: z.ZodOptional<z.ZodEnum<{
|
|
5794
|
-
REGISTERED: "REGISTERED";
|
|
5795
5863
|
NAME: "NAME";
|
|
5864
|
+
REGISTERED: "REGISTERED";
|
|
5796
5865
|
PRICE_ASC: "PRICE_ASC";
|
|
5797
5866
|
PRICE_DESC: "PRICE_DESC";
|
|
5798
5867
|
}>>;
|
|
@@ -5847,8 +5916,8 @@ export declare const optionModelSchema: z.ZodObject<{
|
|
|
5847
5916
|
sortOrder: z.ZodNumber;
|
|
5848
5917
|
}, z.core.$strip>>>>;
|
|
5849
5918
|
optionSort: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
5850
|
-
REGISTERED: "REGISTERED";
|
|
5851
5919
|
NAME: "NAME";
|
|
5920
|
+
REGISTERED: "REGISTERED";
|
|
5852
5921
|
PRICE_ASC: "PRICE_ASC";
|
|
5853
5922
|
PRICE_DESC: "PRICE_DESC";
|
|
5854
5923
|
}>>>;
|
|
@@ -5932,8 +6001,8 @@ export declare const productCreateRequestSchema: z.ZodObject<{
|
|
|
5932
6001
|
usable: z.ZodDefault<z.ZodBoolean>;
|
|
5933
6002
|
}, z.core.$strip>>>;
|
|
5934
6003
|
optionSort: z.ZodOptional<z.ZodEnum<{
|
|
5935
|
-
REGISTERED: "REGISTERED";
|
|
5936
6004
|
NAME: "NAME";
|
|
6005
|
+
REGISTERED: "REGISTERED";
|
|
5937
6006
|
PRICE_ASC: "PRICE_ASC";
|
|
5938
6007
|
PRICE_DESC: "PRICE_DESC";
|
|
5939
6008
|
}>>;
|
|
@@ -6018,8 +6087,8 @@ export declare const productReplaceRequestSchema: z.ZodObject<{
|
|
|
6018
6087
|
usable: z.ZodDefault<z.ZodBoolean>;
|
|
6019
6088
|
}, z.core.$strip>>>;
|
|
6020
6089
|
optionSort: z.ZodOptional<z.ZodEnum<{
|
|
6021
|
-
REGISTERED: "REGISTERED";
|
|
6022
6090
|
NAME: "NAME";
|
|
6091
|
+
REGISTERED: "REGISTERED";
|
|
6023
6092
|
PRICE_ASC: "PRICE_ASC";
|
|
6024
6093
|
PRICE_DESC: "PRICE_DESC";
|
|
6025
6094
|
}>>;
|
|
@@ -6082,9 +6151,9 @@ export declare const productPatchRequestSchema: z.ZodObject<{
|
|
|
6082
6151
|
}, z.core.$strict>;
|
|
6083
6152
|
export type ProductPatchRequest = z.infer<typeof productPatchRequestSchema>;
|
|
6084
6153
|
export declare const productSortSchema: z.ZodEnum<{
|
|
6154
|
+
"updatedAt.desc": "updatedAt.desc";
|
|
6085
6155
|
"createdAt.desc": "createdAt.desc";
|
|
6086
6156
|
"createdAt.asc": "createdAt.asc";
|
|
6087
|
-
"updatedAt.desc": "updatedAt.desc";
|
|
6088
6157
|
"salePrice.asc": "salePrice.asc";
|
|
6089
6158
|
"salePrice.desc": "salePrice.desc";
|
|
6090
6159
|
}>;
|
|
@@ -6110,9 +6179,9 @@ export declare const productListQuerySchema: z.ZodObject<{
|
|
|
6110
6179
|
keyword: z.ZodOptional<z.ZodString>;
|
|
6111
6180
|
sellerCode: z.ZodOptional<z.ZodString>;
|
|
6112
6181
|
sort: z.ZodOptional<z.ZodEnum<{
|
|
6182
|
+
"updatedAt.desc": "updatedAt.desc";
|
|
6113
6183
|
"createdAt.desc": "createdAt.desc";
|
|
6114
6184
|
"createdAt.asc": "createdAt.asc";
|
|
6115
|
-
"updatedAt.desc": "updatedAt.desc";
|
|
6116
6185
|
"salePrice.asc": "salePrice.asc";
|
|
6117
6186
|
"salePrice.desc": "salePrice.desc";
|
|
6118
6187
|
}>>;
|
|
@@ -6170,8 +6239,8 @@ export declare const savedOptionSetSchema: z.ZodObject<{
|
|
|
6170
6239
|
optionSetId: z.ZodString;
|
|
6171
6240
|
name: z.ZodString;
|
|
6172
6241
|
optionSort: z.ZodEnum<{
|
|
6173
|
-
REGISTERED: "REGISTERED";
|
|
6174
6242
|
NAME: "NAME";
|
|
6243
|
+
REGISTERED: "REGISTERED";
|
|
6175
6244
|
PRICE_ASC: "PRICE_ASC";
|
|
6176
6245
|
PRICE_DESC: "PRICE_DESC";
|
|
6177
6246
|
}>;
|
|
@@ -6225,8 +6294,8 @@ export declare const savedCustomInputRequestSchema: z.ZodObject<{
|
|
|
6225
6294
|
export declare const savedOptionSetRequestSchema: z.ZodObject<{
|
|
6226
6295
|
name: z.ZodString;
|
|
6227
6296
|
optionSort: z.ZodDefault<z.ZodEnum<{
|
|
6228
|
-
REGISTERED: "REGISTERED";
|
|
6229
6297
|
NAME: "NAME";
|
|
6298
|
+
REGISTERED: "REGISTERED";
|
|
6230
6299
|
PRICE_ASC: "PRICE_ASC";
|
|
6231
6300
|
PRICE_DESC: "PRICE_DESC";
|
|
6232
6301
|
}>>;
|
|
@@ -6271,8 +6340,8 @@ export declare const savedOptionSetFromProductResultSchema: z.ZodObject<{
|
|
|
6271
6340
|
optionSetId: z.ZodString;
|
|
6272
6341
|
name: z.ZodString;
|
|
6273
6342
|
optionSort: z.ZodEnum<{
|
|
6274
|
-
REGISTERED: "REGISTERED";
|
|
6275
6343
|
NAME: "NAME";
|
|
6344
|
+
REGISTERED: "REGISTERED";
|
|
6276
6345
|
PRICE_ASC: "PRICE_ASC";
|
|
6277
6346
|
PRICE_DESC: "PRICE_DESC";
|
|
6278
6347
|
}>;
|
|
@@ -6495,9 +6564,9 @@ export declare const storeMemberSchema: z.ZodObject<{
|
|
|
6495
6564
|
name: z.ZodString;
|
|
6496
6565
|
email: z.ZodEmail;
|
|
6497
6566
|
role: z.ZodEnum<{
|
|
6567
|
+
OWNER: "OWNER";
|
|
6498
6568
|
ADMIN: "ADMIN";
|
|
6499
6569
|
STAFF: "STAFF";
|
|
6500
|
-
OWNER: "OWNER";
|
|
6501
6570
|
}>;
|
|
6502
6571
|
joinedAt: z.ZodString;
|
|
6503
6572
|
lastActiveAt: z.ZodNullable<z.ZodString>;
|
|
@@ -8030,9 +8099,9 @@ export type UploadTicket = z.infer<typeof uploadTicketSchema>;
|
|
|
8030
8099
|
//#endregion
|
|
8031
8100
|
//#region src/schemas/auth.d.ts
|
|
8032
8101
|
export declare const storeRoleSchema: z.ZodEnum<{
|
|
8102
|
+
OWNER: "OWNER";
|
|
8033
8103
|
ADMIN: "ADMIN";
|
|
8034
8104
|
STAFF: "STAFF";
|
|
8035
|
-
OWNER: "OWNER";
|
|
8036
8105
|
}>;
|
|
8037
8106
|
export type StoreRole = z.infer<typeof storeRoleSchema>;
|
|
8038
8107
|
export declare const myStoreSchema: z.ZodObject<{
|
|
@@ -8040,9 +8109,9 @@ export declare const myStoreSchema: z.ZodObject<{
|
|
|
8040
8109
|
storeName: z.ZodString;
|
|
8041
8110
|
storeCode: z.ZodString;
|
|
8042
8111
|
role: z.ZodEnum<{
|
|
8112
|
+
OWNER: "OWNER";
|
|
8043
8113
|
ADMIN: "ADMIN";
|
|
8044
8114
|
STAFF: "STAFF";
|
|
8045
|
-
OWNER: "OWNER";
|
|
8046
8115
|
}>;
|
|
8047
8116
|
status: z.ZodEnum<{
|
|
8048
8117
|
SUSPENDED: "SUSPENDED";
|
|
@@ -8202,7 +8271,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8202
8271
|
storeId: string;
|
|
8203
8272
|
storeName: string;
|
|
8204
8273
|
storeCode: string;
|
|
8205
|
-
role: "
|
|
8274
|
+
role: "OWNER" | "ADMIN" | "STAFF";
|
|
8206
8275
|
status: "SUSPENDED" | "CLOSED" | "ACTIVE";
|
|
8207
8276
|
}[]>;
|
|
8208
8277
|
me: () => Promise<{
|
|
@@ -8313,7 +8382,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8313
8382
|
usable: boolean;
|
|
8314
8383
|
sortOrder: number;
|
|
8315
8384
|
}[];
|
|
8316
|
-
optionSort: "
|
|
8385
|
+
optionSort: "NAME" | "REGISTERED" | "PRICE_ASC" | "PRICE_DESC";
|
|
8317
8386
|
fulfillment: UnknownFulfillment | {
|
|
8318
8387
|
type: "SHIPPING";
|
|
8319
8388
|
shipping: {
|
|
@@ -8411,7 +8480,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8411
8480
|
usable: boolean;
|
|
8412
8481
|
sortOrder: number;
|
|
8413
8482
|
}[];
|
|
8414
|
-
optionSort: "
|
|
8483
|
+
optionSort: "NAME" | "REGISTERED" | "PRICE_ASC" | "PRICE_DESC";
|
|
8415
8484
|
fulfillment: UnknownFulfillment | {
|
|
8416
8485
|
type: "SHIPPING";
|
|
8417
8486
|
shipping: {
|
|
@@ -8509,7 +8578,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8509
8578
|
usable: boolean;
|
|
8510
8579
|
sortOrder: number;
|
|
8511
8580
|
}[];
|
|
8512
|
-
optionSort: "
|
|
8581
|
+
optionSort: "NAME" | "REGISTERED" | "PRICE_ASC" | "PRICE_DESC";
|
|
8513
8582
|
fulfillment: UnknownFulfillment | {
|
|
8514
8583
|
type: "SHIPPING";
|
|
8515
8584
|
shipping: {
|
|
@@ -8610,7 +8679,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8610
8679
|
usable: boolean;
|
|
8611
8680
|
sortOrder: number;
|
|
8612
8681
|
}[];
|
|
8613
|
-
optionSort: "
|
|
8682
|
+
optionSort: "NAME" | "REGISTERED" | "PRICE_ASC" | "PRICE_DESC";
|
|
8614
8683
|
}>;
|
|
8615
8684
|
/**
|
|
8616
8685
|
* 옵션 모델 전체 교체 — variants는 valueNames로 축 값을 지목한다.
|
|
@@ -8663,7 +8732,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8663
8732
|
usable: boolean;
|
|
8664
8733
|
sortOrder: number;
|
|
8665
8734
|
}[];
|
|
8666
|
-
optionSort: "
|
|
8735
|
+
optionSort: "NAME" | "REGISTERED" | "PRICE_ASC" | "PRICE_DESC";
|
|
8667
8736
|
}>;
|
|
8668
8737
|
/** 재고 변경 — stockQuantity(절대값) 또는 adjustment(증감) 하나만 전달한다 */
|
|
8669
8738
|
updateVariantStock: (productId: string, variantId: string, body: VariantStockRequest) => Promise<{
|
|
@@ -8701,7 +8770,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8701
8770
|
contents: {
|
|
8702
8771
|
optionSetId: string;
|
|
8703
8772
|
name: string;
|
|
8704
|
-
optionSort: "
|
|
8773
|
+
optionSort: "NAME" | "REGISTERED" | "PRICE_ASC" | "PRICE_DESC";
|
|
8705
8774
|
groups: {
|
|
8706
8775
|
name: string;
|
|
8707
8776
|
kind: string;
|
|
@@ -8725,7 +8794,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8725
8794
|
get: (optionSetId: string) => Promise<{
|
|
8726
8795
|
optionSetId: string;
|
|
8727
8796
|
name: string;
|
|
8728
|
-
optionSort: "
|
|
8797
|
+
optionSort: "NAME" | "REGISTERED" | "PRICE_ASC" | "PRICE_DESC";
|
|
8729
8798
|
groups: {
|
|
8730
8799
|
name: string;
|
|
8731
8800
|
kind: string;
|
|
@@ -8749,7 +8818,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8749
8818
|
create: (body: SavedOptionSetRequestInput) => Promise<{
|
|
8750
8819
|
optionSetId: string;
|
|
8751
8820
|
name: string;
|
|
8752
|
-
optionSort: "
|
|
8821
|
+
optionSort: "NAME" | "REGISTERED" | "PRICE_ASC" | "PRICE_DESC";
|
|
8753
8822
|
groups: {
|
|
8754
8823
|
name: string;
|
|
8755
8824
|
kind: string;
|
|
@@ -8773,7 +8842,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8773
8842
|
update: (optionSetId: string, body: SavedOptionSetRequestInput) => Promise<{
|
|
8774
8843
|
optionSetId: string;
|
|
8775
8844
|
name: string;
|
|
8776
|
-
optionSort: "
|
|
8845
|
+
optionSort: "NAME" | "REGISTERED" | "PRICE_ASC" | "PRICE_DESC";
|
|
8777
8846
|
groups: {
|
|
8778
8847
|
name: string;
|
|
8779
8848
|
kind: string;
|
|
@@ -8799,7 +8868,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8799
8868
|
optionSet: {
|
|
8800
8869
|
optionSetId: string;
|
|
8801
8870
|
name: string;
|
|
8802
|
-
optionSort: "
|
|
8871
|
+
optionSort: "NAME" | "REGISTERED" | "PRICE_ASC" | "PRICE_DESC";
|
|
8803
8872
|
groups: {
|
|
8804
8873
|
name: string;
|
|
8805
8874
|
kind: string;
|
|
@@ -8853,6 +8922,10 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8853
8922
|
} | {
|
|
8854
8923
|
field: "discounted";
|
|
8855
8924
|
value: true;
|
|
8925
|
+
} | {
|
|
8926
|
+
field: "bestSelling";
|
|
8927
|
+
days: 30 | 7 | 90;
|
|
8928
|
+
top: number;
|
|
8856
8929
|
} | {
|
|
8857
8930
|
[x: string]: unknown;
|
|
8858
8931
|
field: string;
|
|
@@ -8864,6 +8937,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8864
8937
|
metaTitle: string | null;
|
|
8865
8938
|
metaDescription: string | null;
|
|
8866
8939
|
state: "ACTIVE" | "ENDED" | "SCHEDULED" | "HIDDEN";
|
|
8940
|
+
salesComputedAt: string | null;
|
|
8867
8941
|
productCount: number;
|
|
8868
8942
|
revision: number;
|
|
8869
8943
|
createdAt: string;
|
|
@@ -8898,6 +8972,10 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8898
8972
|
} | {
|
|
8899
8973
|
field: "discounted";
|
|
8900
8974
|
value: true;
|
|
8975
|
+
} | {
|
|
8976
|
+
field: "bestSelling";
|
|
8977
|
+
days: 30 | 7 | 90;
|
|
8978
|
+
top: number;
|
|
8901
8979
|
} | {
|
|
8902
8980
|
[x: string]: unknown;
|
|
8903
8981
|
field: string;
|
|
@@ -8909,6 +8987,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8909
8987
|
metaTitle: string | null;
|
|
8910
8988
|
metaDescription: string | null;
|
|
8911
8989
|
state: "ACTIVE" | "ENDED" | "SCHEDULED" | "HIDDEN";
|
|
8990
|
+
salesComputedAt: string | null;
|
|
8912
8991
|
productCount: number;
|
|
8913
8992
|
revision: number;
|
|
8914
8993
|
createdAt: string;
|
|
@@ -8936,6 +9015,10 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8936
9015
|
} | {
|
|
8937
9016
|
field: "discounted";
|
|
8938
9017
|
value: true;
|
|
9018
|
+
} | {
|
|
9019
|
+
field: "bestSelling";
|
|
9020
|
+
days: 30 | 7 | 90;
|
|
9021
|
+
top: number;
|
|
8939
9022
|
} | {
|
|
8940
9023
|
[x: string]: unknown;
|
|
8941
9024
|
field: string;
|
|
@@ -8947,6 +9030,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8947
9030
|
metaTitle: string | null;
|
|
8948
9031
|
metaDescription: string | null;
|
|
8949
9032
|
state: "ACTIVE" | "ENDED" | "SCHEDULED" | "HIDDEN";
|
|
9033
|
+
salesComputedAt: string | null;
|
|
8950
9034
|
productCount: number;
|
|
8951
9035
|
revision: number;
|
|
8952
9036
|
createdAt: string;
|
|
@@ -8973,6 +9057,10 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8973
9057
|
} | {
|
|
8974
9058
|
field: "discounted";
|
|
8975
9059
|
value: true;
|
|
9060
|
+
} | {
|
|
9061
|
+
field: "bestSelling";
|
|
9062
|
+
days: 30 | 7 | 90;
|
|
9063
|
+
top: number;
|
|
8976
9064
|
} | {
|
|
8977
9065
|
[x: string]: unknown;
|
|
8978
9066
|
field: string;
|
|
@@ -8984,6 +9072,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
8984
9072
|
metaTitle: string | null;
|
|
8985
9073
|
metaDescription: string | null;
|
|
8986
9074
|
state: "ACTIVE" | "ENDED" | "SCHEDULED" | "HIDDEN";
|
|
9075
|
+
salesComputedAt: string | null;
|
|
8987
9076
|
productCount: number;
|
|
8988
9077
|
revision: number;
|
|
8989
9078
|
createdAt: string;
|
|
@@ -9031,6 +9120,10 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9031
9120
|
} | {
|
|
9032
9121
|
field: "discounted";
|
|
9033
9122
|
value: true;
|
|
9123
|
+
} | {
|
|
9124
|
+
field: "bestSelling";
|
|
9125
|
+
days: 30 | 7 | 90;
|
|
9126
|
+
top: number;
|
|
9034
9127
|
} | {
|
|
9035
9128
|
[x: string]: unknown;
|
|
9036
9129
|
field: string;
|
|
@@ -9042,6 +9135,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9042
9135
|
metaTitle: string | null;
|
|
9043
9136
|
metaDescription: string | null;
|
|
9044
9137
|
state: "ACTIVE" | "ENDED" | "SCHEDULED" | "HIDDEN";
|
|
9138
|
+
salesComputedAt: string | null;
|
|
9045
9139
|
productCount: number;
|
|
9046
9140
|
revision: number;
|
|
9047
9141
|
createdAt: string;
|
|
@@ -9069,6 +9163,10 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9069
9163
|
} | {
|
|
9070
9164
|
field: "discounted";
|
|
9071
9165
|
value: true;
|
|
9166
|
+
} | {
|
|
9167
|
+
field: "bestSelling";
|
|
9168
|
+
days: 30 | 7 | 90;
|
|
9169
|
+
top: number;
|
|
9072
9170
|
} | {
|
|
9073
9171
|
[x: string]: unknown;
|
|
9074
9172
|
field: string;
|
|
@@ -9080,6 +9178,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9080
9178
|
metaTitle: string | null;
|
|
9081
9179
|
metaDescription: string | null;
|
|
9082
9180
|
state: "ACTIVE" | "ENDED" | "SCHEDULED" | "HIDDEN";
|
|
9181
|
+
salesComputedAt: string | null;
|
|
9083
9182
|
productCount: number;
|
|
9084
9183
|
revision: number;
|
|
9085
9184
|
createdAt: string;
|
|
@@ -9098,6 +9197,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9098
9197
|
position: number;
|
|
9099
9198
|
addedAt: string;
|
|
9100
9199
|
}[];
|
|
9200
|
+
salesComputedAt: string | null;
|
|
9101
9201
|
}>;
|
|
9102
9202
|
};
|
|
9103
9203
|
categories: {
|
|
@@ -9116,7 +9216,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9116
9216
|
visible: boolean;
|
|
9117
9217
|
showPc: boolean;
|
|
9118
9218
|
showMobile: boolean;
|
|
9119
|
-
productSort: "
|
|
9219
|
+
productSort: "RECENT" | "POPULAR" | "PRICE_LOW" | "PRICE_HIGH" | "NAME";
|
|
9120
9220
|
metaTitle: string | null;
|
|
9121
9221
|
metaDescription: string | null;
|
|
9122
9222
|
metaKeywords: string | null;
|
|
@@ -9136,7 +9236,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9136
9236
|
visible: boolean;
|
|
9137
9237
|
showPc: boolean;
|
|
9138
9238
|
showMobile: boolean;
|
|
9139
|
-
productSort: "
|
|
9239
|
+
productSort: "RECENT" | "POPULAR" | "PRICE_LOW" | "PRICE_HIGH" | "NAME";
|
|
9140
9240
|
metaTitle: string | null;
|
|
9141
9241
|
metaDescription: string | null;
|
|
9142
9242
|
metaKeywords: string | null;
|
|
@@ -9155,7 +9255,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9155
9255
|
visible: boolean;
|
|
9156
9256
|
showPc: boolean;
|
|
9157
9257
|
showMobile: boolean;
|
|
9158
|
-
productSort: "
|
|
9258
|
+
productSort: "RECENT" | "POPULAR" | "PRICE_LOW" | "PRICE_HIGH" | "NAME";
|
|
9159
9259
|
metaTitle: string | null;
|
|
9160
9260
|
metaDescription: string | null;
|
|
9161
9261
|
metaKeywords: string | null;
|
|
@@ -9175,7 +9275,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9175
9275
|
visible: boolean;
|
|
9176
9276
|
showPc: boolean;
|
|
9177
9277
|
showMobile: boolean;
|
|
9178
|
-
productSort: "
|
|
9278
|
+
productSort: "RECENT" | "POPULAR" | "PRICE_LOW" | "PRICE_HIGH" | "NAME";
|
|
9179
9279
|
metaTitle: string | null;
|
|
9180
9280
|
metaDescription: string | null;
|
|
9181
9281
|
metaKeywords: string | null;
|
|
@@ -9194,7 +9294,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9194
9294
|
visible: boolean;
|
|
9195
9295
|
showPc: boolean;
|
|
9196
9296
|
showMobile: boolean;
|
|
9197
|
-
productSort: "
|
|
9297
|
+
productSort: "RECENT" | "POPULAR" | "PRICE_LOW" | "PRICE_HIGH" | "NAME";
|
|
9198
9298
|
metaTitle: string | null;
|
|
9199
9299
|
metaDescription: string | null;
|
|
9200
9300
|
metaKeywords: string | null;
|
|
@@ -9223,7 +9323,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9223
9323
|
visible: boolean;
|
|
9224
9324
|
showPc: boolean;
|
|
9225
9325
|
showMobile: boolean;
|
|
9226
|
-
productSort: "
|
|
9326
|
+
productSort: "RECENT" | "POPULAR" | "PRICE_LOW" | "PRICE_HIGH" | "NAME";
|
|
9227
9327
|
metaTitle: string | null;
|
|
9228
9328
|
metaDescription: string | null;
|
|
9229
9329
|
metaKeywords: string | null;
|
|
@@ -9242,7 +9342,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
9242
9342
|
visible: boolean;
|
|
9243
9343
|
showPc: boolean;
|
|
9244
9344
|
showMobile: boolean;
|
|
9245
|
-
productSort: "
|
|
9345
|
+
productSort: "RECENT" | "POPULAR" | "PRICE_LOW" | "PRICE_HIGH" | "NAME";
|
|
9246
9346
|
metaTitle: string | null;
|
|
9247
9347
|
metaDescription: string | null;
|
|
9248
9348
|
metaKeywords: string | null;
|
|
@@ -13625,7 +13725,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
|
|
|
13625
13725
|
userId: string;
|
|
13626
13726
|
name: string;
|
|
13627
13727
|
email: string;
|
|
13628
|
-
role: "
|
|
13728
|
+
role: "OWNER" | "ADMIN" | "STAFF";
|
|
13629
13729
|
joinedAt: string;
|
|
13630
13730
|
lastActiveAt: string | null;
|
|
13631
13731
|
}[]>;
|
|
@@ -14265,14 +14365,14 @@ export declare const STORE_SCOPE_RESOURCES: {
|
|
|
14265
14365
|
};
|
|
14266
14366
|
export type StoreScopeResource = keyof typeof STORE_SCOPE_RESOURCES;
|
|
14267
14367
|
export declare const storeScopeResourceSchema: z.ZodEnum<{
|
|
14268
|
-
category: "category";
|
|
14269
|
-
analytics: "analytics";
|
|
14270
14368
|
product: "product";
|
|
14369
|
+
category: "category";
|
|
14271
14370
|
order: "order";
|
|
14272
14371
|
claim: "claim";
|
|
14273
14372
|
inquiry: "inquiry";
|
|
14274
14373
|
review: "review";
|
|
14275
14374
|
settlement: "settlement";
|
|
14375
|
+
analytics: "analytics";
|
|
14276
14376
|
webhook: "webhook";
|
|
14277
14377
|
store: "store";
|
|
14278
14378
|
member: "member";
|
package/dist/index.mjs
CHANGED
|
@@ -1970,7 +1970,7 @@ const COLLECTION_SLUG_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
|
1970
1970
|
/** 유형 — `MANUAL`(직접 선택)·`AUTOMATIC`(조건 자동) */
|
|
1971
1971
|
const COLLECTION_TYPES = ["MANUAL", "AUTOMATIC"];
|
|
1972
1972
|
/**
|
|
1973
|
-
* 상품 정렬 — `MANUAL`은 직접 정한 순서(직접 선택 컬렉션만)다. `BEST_SELLING`(판매량순)은
|
|
1973
|
+
* 상품 정렬 — `MANUAL`은 직접 정한 순서(직접 선택 컬렉션만)다. `BEST_SELLING`(판매량순)은 판매 수량이 많은 순이다(M3).
|
|
1974
1974
|
* 저장 값 전체 목록이고, 쓰기에서 받는 값은 `collectionProductSortRequestSchema`다.
|
|
1975
1975
|
*/
|
|
1976
1976
|
const COLLECTION_PRODUCT_SORTS = [
|
|
@@ -1986,12 +1986,13 @@ const COLLECTION_PRODUCT_SORTS = [
|
|
|
1986
1986
|
const collectionProductSortRequestSchema = z.enum([
|
|
1987
1987
|
"MANUAL",
|
|
1988
1988
|
"LATEST",
|
|
1989
|
+
"BEST_SELLING",
|
|
1989
1990
|
"PRICE_ASC",
|
|
1990
1991
|
"PRICE_DESC",
|
|
1991
1992
|
"REVIEW_COUNT",
|
|
1992
1993
|
"RATING_DESC",
|
|
1993
1994
|
"RECOMMEND"
|
|
1994
|
-
]).describe("스토어프론트 상품 기본 정렬. `MANUAL`(직접 정한 순서)·`LATEST`(최신순)·`PRICE_ASC`·`PRICE_DESC`·`REVIEW_COUNT`·`RATING_DESC`·`RECOMMEND`(추천순)");
|
|
1995
|
+
]).describe("스토어프론트 상품 기본 정렬. `MANUAL`(직접 정한 순서)·`LATEST`(최신순)·`BEST_SELLING`(판매량순)·`PRICE_ASC`·`PRICE_DESC`·`REVIEW_COUNT`·`RATING_DESC`·`RECOMMEND`(추천순). 판매량순의 기간은 판매량 상위 조건의 기간이고, 조건이 없으면 최근 30일이다");
|
|
1995
1996
|
/** 노출 상태 — 노출 여부와 기간에서 나온 값이다. 숨김이 기간보다 앞선다 */
|
|
1996
1997
|
const collectionStateSchema = z.enum([
|
|
1997
1998
|
"ACTIVE",
|
|
@@ -2015,6 +2016,16 @@ const MAX_COLLECTION_RULE_CATEGORIES = 20;
|
|
|
2015
2016
|
const MAX_COLLECTION_CREATED_WITHIN_DAYS = 365;
|
|
2016
2017
|
/** 미리보기(`POST /v1/collections/preview`)가 싣는 상품 최대 개수 */
|
|
2017
2018
|
const COLLECTION_PREVIEW_SIZE = 20;
|
|
2019
|
+
/** 판매량 상위 조건의 기간 선택지(일, 오늘 포함 한국 날짜) */
|
|
2020
|
+
const COLLECTION_BEST_SELLING_DAYS = [
|
|
2021
|
+
7,
|
|
2022
|
+
30,
|
|
2023
|
+
90
|
|
2024
|
+
];
|
|
2025
|
+
/** 판매량 상위 조건이 담는 상품 최대 개수 */
|
|
2026
|
+
const MAX_COLLECTION_BEST_SELLING_TOP = 100;
|
|
2027
|
+
/** 판매량순(`BEST_SELLING`) 정렬의 기간 — 판매량 상위 조건이 없을 때 쓴다 */
|
|
2028
|
+
const COLLECTION_SALES_SORT_DEFAULT_DAYS = 30;
|
|
2018
2029
|
const createdWithinDaysRuleSchema = z.object({
|
|
2019
2030
|
field: z.literal("createdWithinDays"),
|
|
2020
2031
|
value: z.number().int().min(1).max(365).describe("등록한 지 N일 안의 상품(1~365). 조회 시각에서 N일을 뺀 시각 이후에 등록한 상품이다")
|
|
@@ -2032,15 +2043,26 @@ const discountedRuleSchema = z.object({
|
|
|
2032
2043
|
field: z.literal("discounted"),
|
|
2033
2044
|
value: z.literal(true).describe("즉시할인이 지금 적용되는 상품")
|
|
2034
2045
|
});
|
|
2046
|
+
const bestSellingRuleSchema = z.object({
|
|
2047
|
+
field: z.literal("bestSelling"),
|
|
2048
|
+
days: z.union([
|
|
2049
|
+
z.literal(7),
|
|
2050
|
+
z.literal(30),
|
|
2051
|
+
z.literal(90)
|
|
2052
|
+
]).describe("판매량을 세는 기간(일). 7·30·90 중 하나이고 오늘을 포함한 한국 날짜 기준이다"),
|
|
2053
|
+
top: z.number().int().min(1).max(100).describe("담을 상품 수(1~100). 다른 조건을 만족하는 상품 중 판매 수량 상위 N개다")
|
|
2054
|
+
});
|
|
2035
2055
|
/**
|
|
2036
2056
|
* 조건 하나 — `field`로 가른다. 가격은 즉시할인을 반영한 판매가(`discountedPrice ?? salePrice`)다.
|
|
2037
|
-
* 판매량 상위(`bestSelling`)는
|
|
2057
|
+
* 판매량 상위(`bestSelling`)는 술어가 아니라 순위 자르기다. 다른 조건을 모두 만족한 상품 중 판매 수량 상위 N개만 남긴다(`rankBestSelling`).
|
|
2058
|
+
* 판매 수량은 실결제 주문의 결제 수량에서 취소·반품 수량을 뺀 값이고, 날짜는 주문 시각의 한국 날짜다. 집계는 최대 10분 늦다.
|
|
2038
2059
|
*/
|
|
2039
2060
|
const collectionRuleSchema = z.discriminatedUnion("field", [
|
|
2040
2061
|
createdWithinDaysRuleSchema,
|
|
2041
2062
|
categoryRuleSchema,
|
|
2042
2063
|
priceRuleSchema,
|
|
2043
|
-
discountedRuleSchema
|
|
2064
|
+
discountedRuleSchema,
|
|
2065
|
+
bestSellingRuleSchema
|
|
2044
2066
|
]).superRefine((rule, ctx) => {
|
|
2045
2067
|
if (rule.field !== "price") return;
|
|
2046
2068
|
if (rule.min === void 0 && rule.max === void 0) ctx.addIssue({
|
|
@@ -2074,6 +2096,7 @@ const collectionRuleViewSchema = z.union([
|
|
|
2074
2096
|
categoryRuleSchema,
|
|
2075
2097
|
priceRuleSchema,
|
|
2076
2098
|
discountedRuleSchema,
|
|
2099
|
+
bestSellingRuleSchema,
|
|
2077
2100
|
z.looseObject({ field: z.string() })
|
|
2078
2101
|
]);
|
|
2079
2102
|
const DAY_MS = 864e5;
|
|
@@ -2098,6 +2121,7 @@ function descendantCategoryIdsOf(roots, categories) {
|
|
|
2098
2121
|
/**
|
|
2099
2122
|
* 조건 판정 함수를 만든다 — 모든 조건을 만족해야 true다(AND). 카테고리 트리는 여기서 한 번만 푼다.
|
|
2100
2123
|
* 알 수 없는 조건(`field`)은 만족하지 않는 것으로 본다. 모르는 조건을 건너뛰면 상품이 예고 없이 늘어난다.
|
|
2124
|
+
* 판매량 상위(`bestSelling`)는 여기서 모두 통과시킨다. 순위 자르기는 판매량을 아는 호출부가 `rankBestSelling`으로 한다.
|
|
2101
2125
|
* 판매 상태는 보지 않는다. 판매 중만 거르는 것은 호출부다.
|
|
2102
2126
|
*/
|
|
2103
2127
|
function collectionRulesPredicate(rules, context) {
|
|
@@ -2119,6 +2143,7 @@ function collectionRulesPredicate(rules, context) {
|
|
|
2119
2143
|
return (parsed.min === void 0 || price >= parsed.min) && (parsed.max === void 0 || price <= parsed.max);
|
|
2120
2144
|
};
|
|
2121
2145
|
case "discounted": return (product) => product.discountedPrice !== null && product.discountedPrice < product.salePrice;
|
|
2146
|
+
case "bestSelling": return () => true;
|
|
2122
2147
|
default: return () => false;
|
|
2123
2148
|
}
|
|
2124
2149
|
});
|
|
@@ -2128,6 +2153,31 @@ function collectionRulesPredicate(rules, context) {
|
|
|
2128
2153
|
function matchesCollectionRules(product, rules, context) {
|
|
2129
2154
|
return collectionRulesPredicate(rules, context)(product);
|
|
2130
2155
|
}
|
|
2156
|
+
/** 판매량 상위 조건 — 없으면 null. 같은 조건은 한 번만 쓰므로 첫 번째다 */
|
|
2157
|
+
function bestSellingRuleOf(rules) {
|
|
2158
|
+
for (const rule of rules) {
|
|
2159
|
+
const parsed = bestSellingRuleSchema.safeParse(rule);
|
|
2160
|
+
if (parsed.success) return {
|
|
2161
|
+
days: parsed.data.days,
|
|
2162
|
+
top: parsed.data.top
|
|
2163
|
+
};
|
|
2164
|
+
}
|
|
2165
|
+
return null;
|
|
2166
|
+
}
|
|
2167
|
+
/**
|
|
2168
|
+
* 판매량 비교 — 판매 수량이 많은 순, 같으면 최근 등록 순, 그것도 같으면 상품 id 순이다. 결과가 입력 순서에 기대지 않는다.
|
|
2169
|
+
* `sales`에 없는 상품은 0개다.
|
|
2170
|
+
*/
|
|
2171
|
+
function compareBySales(sales) {
|
|
2172
|
+
return (a, b) => (sales.get(b.productId) ?? 0) - (sales.get(a.productId) ?? 0) || Date.parse(b.createdAt) - Date.parse(a.createdAt) || (a.productId < b.productId ? -1 : a.productId > b.productId ? 1 : 0);
|
|
2173
|
+
}
|
|
2174
|
+
/**
|
|
2175
|
+
* 판매량 상위 자르기 — 다른 조건을 통과한 상품 중 판매 수량이 1개 이상인 상품을 `compareBySales` 순으로 `top`개 남긴다.
|
|
2176
|
+
* 판매가 없는 상품은 넣지 않는다.
|
|
2177
|
+
*/
|
|
2178
|
+
function rankBestSelling(products, sales, top) {
|
|
2179
|
+
return products.filter((product) => (sales.get(product.productId) ?? 0) > 0).sort(compareBySales(sales)).slice(0, Math.max(0, top));
|
|
2180
|
+
}
|
|
2131
2181
|
/** 조건이 참조하는 카테고리 id — 카테고리 삭제의 참조 검사에 쓴다 */
|
|
2132
2182
|
function collectionRuleCategoryIds(rules) {
|
|
2133
2183
|
const ids = [];
|
|
@@ -2153,6 +2203,7 @@ const collectionSchema = z.object({
|
|
|
2153
2203
|
metaTitle: z.string().nullable(),
|
|
2154
2204
|
metaDescription: z.string().nullable(),
|
|
2155
2205
|
state: collectionStateSchema.describe("지금 노출 상태"),
|
|
2206
|
+
salesComputedAt: z.string().nullable().default(null).describe("판매량 기준 시각. 판매량 상위 조건이나 판매량순 정렬을 쓰는 컬렉션은 이 시각까지의 주문을 센다(최대 10분 늦다). 판매량을 쓰지 않거나 아직 집계 전이면 null"),
|
|
2156
2207
|
productCount: z.number().int().describe("상품 수. 직접 선택은 담긴 상품 수(판매 상태 무관), 조건 자동은 지금 조건을 만족하는 판매 중 상품 수"),
|
|
2157
2208
|
revision: z.number().int().describe("수정 번호. 쓰기마다 1씩 오른다. 수정 본문에 주면 그 사이 다른 수정이 있을 때 409다"),
|
|
2158
2209
|
createdAt: z.string(),
|
|
@@ -2182,7 +2233,7 @@ const periodRefine = (body, ctx) => {
|
|
|
2182
2233
|
/**
|
|
2183
2234
|
* `POST /v1/collections` — 컬렉션을 만든다. `slug`를 생략하면 `c-{id 뒤 8자}`로 만든다.
|
|
2184
2235
|
* 직접 선택(`MANUAL`)은 `productIds`가 처음 담을 상품과 순서다. 조건 자동(`AUTOMATIC`)은 `rules`가 있어야 하고 `productIds`를 받지 않는다.
|
|
2185
|
-
* `productSort`를 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST
|
|
2236
|
+
* `productSort`를 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST`(판매량 상위 조건이 있으면 `BEST_SELLING`)다. 조건 자동은 `MANUAL`을 쓸 수 없다.
|
|
2186
2237
|
*/
|
|
2187
2238
|
const collectionCreateRequestSchema = z.object({
|
|
2188
2239
|
title: z.string().trim().min(1).max(60).describe("제목"),
|
|
@@ -2191,7 +2242,7 @@ const collectionCreateRequestSchema = z.object({
|
|
|
2191
2242
|
rules: collectionRulesSchema.optional().describe("조건 자동 컬렉션의 조건(AND). 조건 자동이면 필수, 직접 선택이면 줄 수 없다"),
|
|
2192
2243
|
description: commonFields.description.default(""),
|
|
2193
2244
|
imageUrl: commonFields.imageUrl.optional(),
|
|
2194
|
-
productSort: commonFields.productSort.optional().describe("스토어프론트 상품 기본 정렬. 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST
|
|
2245
|
+
productSort: commonFields.productSort.optional().describe("스토어프론트 상품 기본 정렬. 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST`(판매량 상위 조건이 있으면 `BEST_SELLING`)다. 조건 자동은 `MANUAL`을 쓸 수 없다"),
|
|
2195
2246
|
visible: commonFields.visible.default(true),
|
|
2196
2247
|
startsAt: commonFields.startsAt,
|
|
2197
2248
|
endsAt: commonFields.endsAt,
|
|
@@ -2265,12 +2316,13 @@ const collectionProductListQuerySchema = z.object({ ...pageQueryShape({
|
|
|
2265
2316
|
/** `POST /v1/collections/preview` — 저장하지 않고 조건으로 나오는 상품을 본다 */
|
|
2266
2317
|
const collectionPreviewRequestSchema = z.object({
|
|
2267
2318
|
rules: collectionRulesSchema,
|
|
2268
|
-
productSort: collectionProductSortRequestSchema.optional().describe("미리보기 순서.
|
|
2319
|
+
productSort: collectionProductSortRequestSchema.optional().describe("미리보기 순서. 생략하면 `LATEST`(판매량 상위 조건이 있으면 `BEST_SELLING`)이고, `MANUAL`이면 `LATEST`다")
|
|
2269
2320
|
});
|
|
2270
2321
|
/** 미리보기 응답 — 조건을 만족하는 판매 중 상품 수와 앞 20개 */
|
|
2271
2322
|
const collectionPreviewSchema = z.object({
|
|
2272
2323
|
count: z.number().int().describe("조건을 만족하는 판매 중 상품 수(조회 시각 기준)"),
|
|
2273
|
-
products: z.array(collectionProductSchema).describe("앞 20개(정렬 순)")
|
|
2324
|
+
products: z.array(collectionProductSchema).describe("앞 20개(정렬 순)"),
|
|
2325
|
+
salesComputedAt: z.string().nullable().default(null).describe("판매량 기준 시각. 판매량 상위 조건이나 판매량순 정렬을 쓰면 이 시각까지의 주문을 센다. 판매량을 쓰지 않거나 집계 전이면 null")
|
|
2274
2326
|
});
|
|
2275
2327
|
//#endregion
|
|
2276
2328
|
//#region src/schemas/promotion.ts
|
|
@@ -7378,4 +7430,4 @@ function createStoreSession(options) {
|
|
|
7378
7430
|
};
|
|
7379
7431
|
}
|
|
7380
7432
|
//#endregion
|
|
7381
|
-
export { APPROVAL_ALREADY_DECIDED_CODE, APPROVAL_REQUIRED_CODE, ApiError, ApprovalPendingError, BUSINESS_INFO_MAX_LENGTH, BUSINESS_NUMBER_PATTERN, CASH_RECEIPT_STATUS_VALUES, COLLECTION_PREVIEW_SIZE, COLLECTION_PRODUCT_SORTS, COLLECTION_SLUG_PATTERN, COLLECTION_TYPES, COUPON_CODE_PATTERN, COUPON_CONDITIONS_DEFAULTS, COUPON_TARGET_ALL, COUPON_TARGET_LIST_MAX, CUSTOM_INPUT_FORBIDDEN_WORDS, FULFILLMENT_RULES, MAX_ADDON_GROUPS, MAX_ANALYTICS_ALLOWED_ORIGINS, MAX_AUTO_TRANSITION_DAYS, MAX_COLLECTIONS, MAX_COLLECTION_CREATED_WITHIN_DAYS, MAX_COLLECTION_DESCRIPTION, MAX_COLLECTION_PRODUCTS, MAX_COLLECTION_PRODUCTS_PER_ADD, MAX_COLLECTION_RULES, MAX_COLLECTION_RULE_CATEGORIES, MAX_COLLECTION_TITLE, MAX_CUSTOM_INPUTS, MAX_CUSTOM_INPUT_LENGTH, MAX_OPTION_GROUPS, MAX_PRODUCT_IMAGES, MAX_SAVED_OPTION_SETS, MAX_SAVED_OPTION_SET_NAME, MAX_VALUES_PER_GROUP, MAX_VARIANTS, MCP_TELEMETRY_MAX_RESULTS, MIN_PAYMENT_AMOUNT, NO_COUPON_SETTLEMENT, NO_SHIPPING_BUNDLE_KEY, PAYMENT_ROUTING_EXCLUSION_CODES, POINT_ADJUSTMENT_MAX, POINT_EARN_RATE_BP_MAX, POINT_ENTRY_TYPES, POINT_EXPIRY_DAYS_MAX, POINT_EXPIRY_DAYS_MIN, POINT_LOT_SOURCES, POINT_POLICY_DEFAULTS, POINT_REVIEW_REWARD_MAX, POINT_USE_UNITS, PORTONE_CHANNEL_NAME_MAX_LENGTH, PORTONE_MAX_CHANNELS, PORTONE_MIN_CHANNELS, REFUND_POLICY_DEFAULTS, REFUND_POLICY_DELIVERY_FEE_KEYS, REMOTE_AREA_ZIP_RANGES, RESERVED_STOREFRONT_SLUGS, RESERVED_STORE_CODES, SHIPPING_POLICY_DEFAULTS, STOREFRONT_BLOCKED_PATH_SEGMENTS, STOREFRONT_BUILD_STAGES, STOREFRONT_BUILD_TERMINAL_STATUSES, STOREFRONT_CHECK_TERMINAL_STATUSES, STOREFRONT_CUSTOM_DOMAIN_LIMIT_DEFAULT, STOREFRONT_DOMAIN_DNS_GRACE_DAYS, STOREFRONT_DOMAIN_DNS_WAIT_DAYS, STOREFRONT_DOMAIN_TXT_LABEL, STOREFRONT_EDIT_ACTIVITY_TIMEOUT_MINUTES, STOREFRONT_EDIT_CAPACITY, STOREFRONT_EDIT_IDLE_MINUTES, STOREFRONT_EDIT_PREVIEW_SUFFIX, STOREFRONT_EDIT_START_STAGES, STOREFRONT_FILE_BATCH_MAX, STOREFRONT_FILE_MAX_BYTES, STOREFRONT_PATH_SEGMENT_PATTERN, STOREFRONT_PLATFORM_DOMAINS, STOREFRONT_PUBLIC_SUFFIXES, STOREFRONT_SEARCH_REGEX_MAX_LENGTH, STOREFRONT_SHOWCASE_SLUG_PREFIX, STOREFRONT_SITE_CREATE_LIMIT, STOREFRONT_SLUG_CHANGE_LIMIT, STOREFRONT_SLUG_CHANGE_WINDOW_DAYS, STOREFRONT_SLUG_HOLD_DAYS, STOREFRONT_SLUG_PATTERN, STOREFRONT_SOURCE_BLOB_BATCH_MAX, STOREFRONT_SOURCE_PART_BYTES, STOREFRONT_WORKSPACE_MAX_BYTES, STOREFRONT_WORKSPACE_MAX_FILES, STORE_CODE_PATTERN, STORE_ROLE_SCOPES, STORE_SCOPE_RESOURCES, STORE_SESSION_KEYS, TOSS_WIDGET_CLIENT_KEY_PATTERN, TOSS_WIDGET_KEY_MESSAGE, TOSS_WIDGET_SECRET_KEY_PATTERN, UPLOAD_PURPOSE_LIMITS, VARIANT_COUNT_WARNING, VARIANT_STOCK_EXCLUSIVE_MESSAGE, WEBHOOK_DEFAULT_TOLERANCE_SEC, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_FAILURE_REASONS, WEBHOOK_HEADERS, WEBHOOK_PAYLOAD_EXCERPT_MAX_BYTES, WEBHOOK_RESOURCE_TYPES, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_USER_AGENT, addStorefrontDomainRequestSchema, addonGroupRequestSchema, addonGroupSchema, addonValueRequestSchema, addonValueSchema, addressChangeRequestListSchema, addressTypeSchema, agentPolicyDecisionSchema, allocateByWeight, analyticsChannelSchema, analyticsCheckoutOutcomeSchema, analyticsCheckoutSchema, analyticsDeviceRowSchema, analyticsDevicesSchema, analyticsFunnelStepSchema, analyticsOriginSchema, analyticsOverviewSchema, analyticsPagesQuerySchema, analyticsPagesSchema, analyticsProductRowSchema, analyticsProductSortSchema, analyticsProductsQuerySchema, analyticsProductsSchema, analyticsRangeQuerySchema, analyticsRealtimeSchema, analyticsSearchQuerySchema, analyticsSearchSchema, analyticsSourceGroupBySchema, analyticsSourceRowSchema, analyticsSourcesQuerySchema, analyticsSourcesSchema, analyticsTotalsSchema, apiLogErrorSchema, apiLogListQuerySchema, apiLogPageSchema, apiLogPrincipalSchema, apiLogPrincipalTypeSchema, apiLogSchema, apiLogStatusFilterSchema, apiLogSummarySchema, approvalDecisionRequestSchema, approvalListQuerySchema, approvalPageSchema, approvalRequestSchema, approvalStatusSchema, approveClaimResultSchema, auditActorSchema, auditActorTypeSchema, auditLogListQuerySchema, auditLogOutcomeSchema, auditLogPageSchema, auditLogSchema, auditLogSourceSchema, buildAuthorizeUrl, buildQuery, bulkResultSchema, businessInfoPatchShape, businessInfoResponseShape, businessNumberSchema, cancelBySellerRequestSchema, cancelBySellerResultSchema, carrierSchema, cashReceiptSchema, categoryAttributeSchema, categoryCreateRequestSchema, categoryDeleteQuerySchema, categoryDeleteStrategySchema, categoryListQuerySchema, categoryPatchRequestSchema, categoryProductSortSchema, categorySchema, categorySearchResultSchema, categoryTreeNodeSchema, categoryWithPathSchema, changeStorefrontSlugRequestSchema, changeStorefrontTemplateRequestSchema, changeTypeSchema, claimDetailSchema, claimHoldResultSchema, claimListQuerySchema, claimReasonSchema, claimReturnAddressSchema, claimSchema, claimStatusSchema, claimTypeSchema, claimWebhookEventDataSchema, claimWebhookEventSchema, collectionCreateRequestSchema, collectionListQuerySchema, collectionPageSchema, collectionPatchRequestSchema, collectionPreviewRequestSchema, collectionPreviewSchema, collectionProductListQuerySchema, collectionProductSchema, collectionProductSortRequestSchema, collectionProductsAddRequestSchema, collectionProductsReplaceRequestSchema, collectionRuleCategoryIds, collectionRuleSchema, collectionRuleViewSchema, collectionRulesPredicate, collectionRulesSchema, collectionSchema, collectionStateCountsSchema, collectionStateOf, collectionStateSchema, consentActionSchema, consentKindSchema, consentSourceSchema, couponBenefitSchema, couponConditionsInputSchema, couponConditionsSchema, couponDiscountOf, couponIssueListQuerySchema, couponIssueMethodSchema, couponIssueSchema, couponIssueStatusSchema, couponKindSchema, couponListQuerySchema, couponRedemptionListQuerySchema, couponRedemptionSchema, couponRejectReasonSchema, couponRuleSchema, couponSchema, couponStatsSchema, couponStatusSchema, couponTargetInputSchema, couponTargetSchema, createCouponRequestSchema, createPkcePair, createStoreClient, createStoreSession, createStorefrontEditPreviewLinkRequestSchema, createStorefrontPreviewLinkRequestSchema, createStorefrontSiteRequestSchema, createStorefrontVersionRequestSchema, customInputLabelForbiddenWord, customInputRequestSchema, customInputSchema, customInputValueSchema, customerAddressSchema, customerConsentListQuerySchema, customerConsentSchema, customerConsentStateSchema, customerConsentsSchema, customerCouponSchema, customerDelegationRequestSchema, customerDelegationSchema, customerDetailSchema, customerInquiryCategorySchema, customerInquiryListQuerySchema, customerListQuerySchema, customerOrderSchema, customerPointsSchema, customerSortSchema, customerStatsSchema, customerSummarySchema, customerWithdrawalBlockedDetailsSchema, deleteStorefrontFileRequestSchema, deliveryBundleKeyOf, deliveryFeeWaiverSchema, deliveryInfoSchema, deliveryMethodSchema, deliveryStatusSchema, deliveryTypeSchema, descendantCategoryIdsOf, disableStorefrontHostingRequestSchema, discountRequestSchema, discountSchema, dispatchRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, eventTypeSchema, exchangeAuthorizationCode, fulfillBulkRequestSchema, fulfillRequestSchema, fulfillmentRuleOf, fulfillmentTypeOf, fulfillmentTypeResponseSchema, fulfillmentTypeSchema, holdOrderItemRequestSchema, inquiryListQuerySchema, inquirySchema, inquiryWebhookEventDataSchema, inquiryWebhookEventSchema, invitationDeliveryStatusSchema, invitationListQuerySchema, invitationSchema, inviteMemberRequestSchema, isCouponTargetLine, isEditableStorefrontPath, isReservedStoreCode, isReservedStorefrontSlug, isShowcaseStorefrontSlug, isStoreScope, isWebOrigin, issueCouponRequestSchema, issueCouponResultSchema, liveGateConditionCodeSchema, liveGateConditionSchema, liveGateErrorDetailsSchema, liveGateSchema, loginProviderSchema, loginProviderStatusSchema, loginProviderTestSchema, loginSettingsSchema, maskedSecretSchema, matchesCollectionRules, mcpRuleResultSchema, mcpToolEventSchema, moveStorefrontFileRequestSchema, myAccountSchema, myStoreSchema, normalizeBusinessNumber, normalizeCouponCode, normalizeStorefrontHostname, normalizeStorefrontPath, oauthTokenResponseSchema, openFulfillmentUnion, optionGroupKindSchema, optionGroupRequestSchema, optionGroupSchema, optionModelRequestSchema, optionModelSchema, optionSelectionSchema, optionSortSchema, optionValueRequestSchema, optionValueSchema, orderCanceledWebhookEventDataSchema, orderCanceledWebhookEventSchema, orderDiscountSchema, orderFulfilledWebhookEventDataSchema, orderFulfilledWebhookEventSchema, orderItemFulfillmentSchema, orderItemFulfillmentSnapshotResponseSchema, orderItemFulfillmentSnapshotSchema, orderItemListQuerySchema, orderItemMemoResultSchema, orderItemPageSchema, orderItemSchema, orderItemStatusSchema, orderListQuerySchema, orderSchema, orderSummaryPageSchema, orderSummarySchema, orderWebhookEventDataSchema, orderWebhookEventSchema, pageInfoSchema, pageQueryShape, pageSchema, paymentAttemptRecordSchema, paymentAttemptStatusSchema, paymentCredentialSetSchema, paymentFailureWarningSchema, paymentListQuerySchema, paymentProviderSchema, paymentProviderVerificationSchema, paymentRecordDetailSchema, paymentRecordPageSchema, paymentRecordSchema, paymentRecordStatusSchema, paymentRefundRecordSchema, paymentSettingsSchema, pgEnvironmentSchema, pgPaymentMethodSchema, pgProviderSchema, pgVerificationResultSchema, planCodeSchema, planEntitlementsSchema, planErrorDetailsSchema, pointAdjustmentRequestSchema, pointAdjustmentResultSchema, pointEarnOf, pointEarnRateBpSchema, pointEarningEnabled, pointEntrySchema, pointExpiresAtOf, pointHistoryQuerySchema, pointLotSchema, pointPolicyNoticeSchema, pointPolicySchema, pointRestoreExpiresAtOf, pointUseOf, pointUsePolicySchema, policyDocumentUrlSchema, policyVersionSchema, portOneChannelSchema, portOneCredentialsInputSchema, productCreateRequestSchema, productFulfillmentCreateSchema, productFulfillmentResponseSchema, productFulfillmentSchema, productFulfillmentUpdateSchema, productImageRejection, productImageUrlSchema, productListQuerySchema, productOutOfStockWebhookEventDataSchema, productOutOfStockWebhookEventSchema, productPatchRequestSchema, productRefundPolicyOverride, productRefundPolicyPatchSchema, productReplaceRequestSchema, productSchema, productSortSchema, productStatusSchema, productSummarySchema, productVariantRequestSchema, productVariantSchema, proratedPaidRefundBase, proratedPointRefund, proratedRefundBase, publicPlanSchema, publicPlansSchema, publishStorefrontVersionRequestSchema, purchaseDecisionExtendResultSchema, purchaseDecisionRequestResultSchema, purchaseEarnPolicySchema, purchaseEarnRateOf, quoteDelivery, quotePricing, refreshUserToken, refundPolicyPatchSchema, refundPolicySchema, rejectClaimRequestSchema, remoteAreaLabelOf, remoteAreaOf, remoteAreaSchema, remoteSurchargeOf, replaceStorefrontSourceRequestSchema, requiresCollection, requiresShipping, resolvePointPolicy, resolveRefundPolicy, resolveShippingPolicy, responsePlanCodeSchema, responsePointEntryTypeSchema, reviewListQuerySchema, reviewReportResultSchema, reviewRewardPointOf, reviewRewardPolicySchema, reviewSchema, reviewSortSchema, reviewWebhookEventDataSchema, reviewWebhookEventSchema, rollbackStorefrontRequestSchema, runStorefrontCheckRequestSchema, salesReportGroupBySchema, salesReportQuerySchema, salesReportRowSchema, salesReportSchema, salesTotalsSchema, saveLoginProviderRequestSchema, savedCustomInputRequestSchema, savedCustomInputSchema, savedOptionGroupRequestSchema, savedOptionGroupSchema, savedOptionSetCompositionSchema, savedOptionSetFromProductRequestSchema, savedOptionSetFromProductResultSchema, savedOptionSetListQuerySchema, savedOptionSetRequestSchema, savedOptionSetSchema, savedOptionSetSortSchema, savedOptionValueRequestSchema, savedOptionValueSchema, scopeAccessSchema, searchStorefrontFilesRequestSchema, sellerAddressListQuerySchema, sellerAddressRequestSchema, sellerAddressSchema, sellerCustomerInquirySchema, setStorefrontVisibilityRequestSchema, settleCouponShortfall, settlementDetailQuerySchema, settlementDetailSchema, settlementListQuerySchema, settlementStatusSchema, settlementSummarySchema, settlementWithDetailsSchema, shippingAddressSchema, shippingPolicyPatchSchema, shippingPolicySchema, splitRefund, storeCodeSchema, storeMemberRoleUpdatedSchema, storeMemberSchema, storePointPolicySchema, storeRoleSchema, storeSchema, storeScopeResourceSchema, storeSubscriptionSchema, storefrontBuildDependenciesSchema, storefrontBuildListQuerySchema, storefrontBuildSchema, storefrontBuildStatusSchema, storefrontCheckSchema, storefrontCheckStatusSchema, storefrontCustomDomainStatusSchema, storefrontCustomHostnameProblem, storefrontDependencyFindingSchema, storefrontDeploymentLogSchema, storefrontDeploymentSchema, storefrontDeploymentStepSchema, storefrontDnsRecordSchema, storefrontDomainSchema, storefrontDomainTxtNameOf, storefrontEditPreviewLabelOf, storefrontEditPreviewSchema, storefrontEditSessionSchema, storefrontEditSessionStatusSchema, storefrontEditingSchema, storefrontFileConflictDetailsSchema, storefrontFileContentQuerySchema, storefrontFileContentSchema, storefrontFileDeleteResultSchema, storefrontFileEncodingSchema, storefrontFileEntrySchema, storefrontFileHashSchema, storefrontFileListQuerySchema, storefrontFileListSchema, storefrontFileMoveResultSchema, storefrontFilePathSchema, storefrontFileSearchResultSchema, storefrontFileWriteResultSchema, storefrontHostingSchema, storefrontPreviewLinkSchema, storefrontProvisioningSchema, storefrontRuleResultSchema, storefrontRuleSeveritySchema, storefrontSiteDomainSchema, storefrontSiteDomainsSchema, storefrontSiteSchema, storefrontSiteStatusSchema, storefrontSlugAvailabilityQuerySchema, storefrontSlugAvailabilitySchema, storefrontSlugSchema, storefrontSourceArchivePartSchema, storefrontSourceArchiveQuerySchema, storefrontSourceBlobsResultSchema, storefrontSourceModeSchema, storefrontSourceRefSchema, storefrontSourceReplacedSchema, storefrontSourceSchema, storefrontSuspensionSchema, storefrontTemplateSchema, storefrontVerifyReportSchema, storefrontVersionCreatedSchema, storefrontVersionSchema, storefrontVersionStatusSchema, storefrontVisibilitySchema, subscriptionLimitsSchema, subscriptionStatusSchema, subscriptionUsageSchema, tossPaymentsCredentialsInputSchema, trackingStageResponseSchema, trackingUpdateResultSchema, updateCouponRequestSchema, updateLoginProviderRequestSchema, updateLoginSettingsRequestSchema, updateMemberRoleRequestSchema, updatePaymentProviderRequestSchema, updatePaymentSettingsRequestSchema, updatePointPolicyRequestSchema, updateStoreRequestSchema, uploadExtensionOf, uploadPurposeSchema, uploadRejection, uploadRequestSchema, uploadStorefrontSourceBlobsRequestSchema, uploadTicketSchema, upsertPortOneProviderRequestSchema, upsertTossPaymentsProviderRequestSchema, variantStockRequestSchema, variantStockSchema, verifyPaymentProviderRequestSchema, webhookCreatedSchema, webhookDeliveryDetailSchema, webhookDeliveryErrorCodeSchema, webhookDeliveryListQuerySchema, webhookDeliveryResourceSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEventSchema, webhookFailureReasonSchema, webhookRedeliverFailedResultSchema, webhookRequestHeaderSchema, webhookRequestSchema, webhookResourceTypeSchema, webhookSchema, webhookSecretRotatedSchema, webhookStatusSchema, webhookTestRequestSchema, webhookTestResultSchema, withdrawCustomerRequestSchema, writeDryRunResultSchema, writePreviewSchema, writeStorefrontFilesRequestSchema };
|
|
7433
|
+
export { APPROVAL_ALREADY_DECIDED_CODE, APPROVAL_REQUIRED_CODE, ApiError, ApprovalPendingError, BUSINESS_INFO_MAX_LENGTH, BUSINESS_NUMBER_PATTERN, CASH_RECEIPT_STATUS_VALUES, COLLECTION_BEST_SELLING_DAYS, COLLECTION_PREVIEW_SIZE, COLLECTION_PRODUCT_SORTS, COLLECTION_SALES_SORT_DEFAULT_DAYS, COLLECTION_SLUG_PATTERN, COLLECTION_TYPES, COUPON_CODE_PATTERN, COUPON_CONDITIONS_DEFAULTS, COUPON_TARGET_ALL, COUPON_TARGET_LIST_MAX, CUSTOM_INPUT_FORBIDDEN_WORDS, FULFILLMENT_RULES, MAX_ADDON_GROUPS, MAX_ANALYTICS_ALLOWED_ORIGINS, MAX_AUTO_TRANSITION_DAYS, MAX_COLLECTIONS, MAX_COLLECTION_BEST_SELLING_TOP, MAX_COLLECTION_CREATED_WITHIN_DAYS, MAX_COLLECTION_DESCRIPTION, MAX_COLLECTION_PRODUCTS, MAX_COLLECTION_PRODUCTS_PER_ADD, MAX_COLLECTION_RULES, MAX_COLLECTION_RULE_CATEGORIES, MAX_COLLECTION_TITLE, MAX_CUSTOM_INPUTS, MAX_CUSTOM_INPUT_LENGTH, MAX_OPTION_GROUPS, MAX_PRODUCT_IMAGES, MAX_SAVED_OPTION_SETS, MAX_SAVED_OPTION_SET_NAME, MAX_VALUES_PER_GROUP, MAX_VARIANTS, MCP_TELEMETRY_MAX_RESULTS, MIN_PAYMENT_AMOUNT, NO_COUPON_SETTLEMENT, NO_SHIPPING_BUNDLE_KEY, PAYMENT_ROUTING_EXCLUSION_CODES, POINT_ADJUSTMENT_MAX, POINT_EARN_RATE_BP_MAX, POINT_ENTRY_TYPES, POINT_EXPIRY_DAYS_MAX, POINT_EXPIRY_DAYS_MIN, POINT_LOT_SOURCES, POINT_POLICY_DEFAULTS, POINT_REVIEW_REWARD_MAX, POINT_USE_UNITS, PORTONE_CHANNEL_NAME_MAX_LENGTH, PORTONE_MAX_CHANNELS, PORTONE_MIN_CHANNELS, REFUND_POLICY_DEFAULTS, REFUND_POLICY_DELIVERY_FEE_KEYS, REMOTE_AREA_ZIP_RANGES, RESERVED_STOREFRONT_SLUGS, RESERVED_STORE_CODES, SHIPPING_POLICY_DEFAULTS, STOREFRONT_BLOCKED_PATH_SEGMENTS, STOREFRONT_BUILD_STAGES, STOREFRONT_BUILD_TERMINAL_STATUSES, STOREFRONT_CHECK_TERMINAL_STATUSES, STOREFRONT_CUSTOM_DOMAIN_LIMIT_DEFAULT, STOREFRONT_DOMAIN_DNS_GRACE_DAYS, STOREFRONT_DOMAIN_DNS_WAIT_DAYS, STOREFRONT_DOMAIN_TXT_LABEL, STOREFRONT_EDIT_ACTIVITY_TIMEOUT_MINUTES, STOREFRONT_EDIT_CAPACITY, STOREFRONT_EDIT_IDLE_MINUTES, STOREFRONT_EDIT_PREVIEW_SUFFIX, STOREFRONT_EDIT_START_STAGES, STOREFRONT_FILE_BATCH_MAX, STOREFRONT_FILE_MAX_BYTES, STOREFRONT_PATH_SEGMENT_PATTERN, STOREFRONT_PLATFORM_DOMAINS, STOREFRONT_PUBLIC_SUFFIXES, STOREFRONT_SEARCH_REGEX_MAX_LENGTH, STOREFRONT_SHOWCASE_SLUG_PREFIX, STOREFRONT_SITE_CREATE_LIMIT, STOREFRONT_SLUG_CHANGE_LIMIT, STOREFRONT_SLUG_CHANGE_WINDOW_DAYS, STOREFRONT_SLUG_HOLD_DAYS, STOREFRONT_SLUG_PATTERN, STOREFRONT_SOURCE_BLOB_BATCH_MAX, STOREFRONT_SOURCE_PART_BYTES, STOREFRONT_WORKSPACE_MAX_BYTES, STOREFRONT_WORKSPACE_MAX_FILES, STORE_CODE_PATTERN, STORE_ROLE_SCOPES, STORE_SCOPE_RESOURCES, STORE_SESSION_KEYS, TOSS_WIDGET_CLIENT_KEY_PATTERN, TOSS_WIDGET_KEY_MESSAGE, TOSS_WIDGET_SECRET_KEY_PATTERN, UPLOAD_PURPOSE_LIMITS, VARIANT_COUNT_WARNING, VARIANT_STOCK_EXCLUSIVE_MESSAGE, WEBHOOK_DEFAULT_TOLERANCE_SEC, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_FAILURE_REASONS, WEBHOOK_HEADERS, WEBHOOK_PAYLOAD_EXCERPT_MAX_BYTES, WEBHOOK_RESOURCE_TYPES, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_USER_AGENT, addStorefrontDomainRequestSchema, addonGroupRequestSchema, addonGroupSchema, addonValueRequestSchema, addonValueSchema, addressChangeRequestListSchema, addressTypeSchema, agentPolicyDecisionSchema, allocateByWeight, analyticsChannelSchema, analyticsCheckoutOutcomeSchema, analyticsCheckoutSchema, analyticsDeviceRowSchema, analyticsDevicesSchema, analyticsFunnelStepSchema, analyticsOriginSchema, analyticsOverviewSchema, analyticsPagesQuerySchema, analyticsPagesSchema, analyticsProductRowSchema, analyticsProductSortSchema, analyticsProductsQuerySchema, analyticsProductsSchema, analyticsRangeQuerySchema, analyticsRealtimeSchema, analyticsSearchQuerySchema, analyticsSearchSchema, analyticsSourceGroupBySchema, analyticsSourceRowSchema, analyticsSourcesQuerySchema, analyticsSourcesSchema, analyticsTotalsSchema, apiLogErrorSchema, apiLogListQuerySchema, apiLogPageSchema, apiLogPrincipalSchema, apiLogPrincipalTypeSchema, apiLogSchema, apiLogStatusFilterSchema, apiLogSummarySchema, approvalDecisionRequestSchema, approvalListQuerySchema, approvalPageSchema, approvalRequestSchema, approvalStatusSchema, approveClaimResultSchema, auditActorSchema, auditActorTypeSchema, auditLogListQuerySchema, auditLogOutcomeSchema, auditLogPageSchema, auditLogSchema, auditLogSourceSchema, bestSellingRuleOf, buildAuthorizeUrl, buildQuery, bulkResultSchema, businessInfoPatchShape, businessInfoResponseShape, businessNumberSchema, cancelBySellerRequestSchema, cancelBySellerResultSchema, carrierSchema, cashReceiptSchema, categoryAttributeSchema, categoryCreateRequestSchema, categoryDeleteQuerySchema, categoryDeleteStrategySchema, categoryListQuerySchema, categoryPatchRequestSchema, categoryProductSortSchema, categorySchema, categorySearchResultSchema, categoryTreeNodeSchema, categoryWithPathSchema, changeStorefrontSlugRequestSchema, changeStorefrontTemplateRequestSchema, changeTypeSchema, claimDetailSchema, claimHoldResultSchema, claimListQuerySchema, claimReasonSchema, claimReturnAddressSchema, claimSchema, claimStatusSchema, claimTypeSchema, claimWebhookEventDataSchema, claimWebhookEventSchema, collectionCreateRequestSchema, collectionListQuerySchema, collectionPageSchema, collectionPatchRequestSchema, collectionPreviewRequestSchema, collectionPreviewSchema, collectionProductListQuerySchema, collectionProductSchema, collectionProductSortRequestSchema, collectionProductsAddRequestSchema, collectionProductsReplaceRequestSchema, collectionRuleCategoryIds, collectionRuleSchema, collectionRuleViewSchema, collectionRulesPredicate, collectionRulesSchema, collectionSchema, collectionStateCountsSchema, collectionStateOf, collectionStateSchema, compareBySales, consentActionSchema, consentKindSchema, consentSourceSchema, couponBenefitSchema, couponConditionsInputSchema, couponConditionsSchema, couponDiscountOf, couponIssueListQuerySchema, couponIssueMethodSchema, couponIssueSchema, couponIssueStatusSchema, couponKindSchema, couponListQuerySchema, couponRedemptionListQuerySchema, couponRedemptionSchema, couponRejectReasonSchema, couponRuleSchema, couponSchema, couponStatsSchema, couponStatusSchema, couponTargetInputSchema, couponTargetSchema, createCouponRequestSchema, createPkcePair, createStoreClient, createStoreSession, createStorefrontEditPreviewLinkRequestSchema, createStorefrontPreviewLinkRequestSchema, createStorefrontSiteRequestSchema, createStorefrontVersionRequestSchema, customInputLabelForbiddenWord, customInputRequestSchema, customInputSchema, customInputValueSchema, customerAddressSchema, customerConsentListQuerySchema, customerConsentSchema, customerConsentStateSchema, customerConsentsSchema, customerCouponSchema, customerDelegationRequestSchema, customerDelegationSchema, customerDetailSchema, customerInquiryCategorySchema, customerInquiryListQuerySchema, customerListQuerySchema, customerOrderSchema, customerPointsSchema, customerSortSchema, customerStatsSchema, customerSummarySchema, customerWithdrawalBlockedDetailsSchema, deleteStorefrontFileRequestSchema, deliveryBundleKeyOf, deliveryFeeWaiverSchema, deliveryInfoSchema, deliveryMethodSchema, deliveryStatusSchema, deliveryTypeSchema, descendantCategoryIdsOf, disableStorefrontHostingRequestSchema, discountRequestSchema, discountSchema, dispatchRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, eventTypeSchema, exchangeAuthorizationCode, fulfillBulkRequestSchema, fulfillRequestSchema, fulfillmentRuleOf, fulfillmentTypeOf, fulfillmentTypeResponseSchema, fulfillmentTypeSchema, holdOrderItemRequestSchema, inquiryListQuerySchema, inquirySchema, inquiryWebhookEventDataSchema, inquiryWebhookEventSchema, invitationDeliveryStatusSchema, invitationListQuerySchema, invitationSchema, inviteMemberRequestSchema, isCouponTargetLine, isEditableStorefrontPath, isReservedStoreCode, isReservedStorefrontSlug, isShowcaseStorefrontSlug, isStoreScope, isWebOrigin, issueCouponRequestSchema, issueCouponResultSchema, liveGateConditionCodeSchema, liveGateConditionSchema, liveGateErrorDetailsSchema, liveGateSchema, loginProviderSchema, loginProviderStatusSchema, loginProviderTestSchema, loginSettingsSchema, maskedSecretSchema, matchesCollectionRules, mcpRuleResultSchema, mcpToolEventSchema, moveStorefrontFileRequestSchema, myAccountSchema, myStoreSchema, normalizeBusinessNumber, normalizeCouponCode, normalizeStorefrontHostname, normalizeStorefrontPath, oauthTokenResponseSchema, openFulfillmentUnion, optionGroupKindSchema, optionGroupRequestSchema, optionGroupSchema, optionModelRequestSchema, optionModelSchema, optionSelectionSchema, optionSortSchema, optionValueRequestSchema, optionValueSchema, orderCanceledWebhookEventDataSchema, orderCanceledWebhookEventSchema, orderDiscountSchema, orderFulfilledWebhookEventDataSchema, orderFulfilledWebhookEventSchema, orderItemFulfillmentSchema, orderItemFulfillmentSnapshotResponseSchema, orderItemFulfillmentSnapshotSchema, orderItemListQuerySchema, orderItemMemoResultSchema, orderItemPageSchema, orderItemSchema, orderItemStatusSchema, orderListQuerySchema, orderSchema, orderSummaryPageSchema, orderSummarySchema, orderWebhookEventDataSchema, orderWebhookEventSchema, pageInfoSchema, pageQueryShape, pageSchema, paymentAttemptRecordSchema, paymentAttemptStatusSchema, paymentCredentialSetSchema, paymentFailureWarningSchema, paymentListQuerySchema, paymentProviderSchema, paymentProviderVerificationSchema, paymentRecordDetailSchema, paymentRecordPageSchema, paymentRecordSchema, paymentRecordStatusSchema, paymentRefundRecordSchema, paymentSettingsSchema, pgEnvironmentSchema, pgPaymentMethodSchema, pgProviderSchema, pgVerificationResultSchema, planCodeSchema, planEntitlementsSchema, planErrorDetailsSchema, pointAdjustmentRequestSchema, pointAdjustmentResultSchema, pointEarnOf, pointEarnRateBpSchema, pointEarningEnabled, pointEntrySchema, pointExpiresAtOf, pointHistoryQuerySchema, pointLotSchema, pointPolicyNoticeSchema, pointPolicySchema, pointRestoreExpiresAtOf, pointUseOf, pointUsePolicySchema, policyDocumentUrlSchema, policyVersionSchema, portOneChannelSchema, portOneCredentialsInputSchema, productCreateRequestSchema, productFulfillmentCreateSchema, productFulfillmentResponseSchema, productFulfillmentSchema, productFulfillmentUpdateSchema, productImageRejection, productImageUrlSchema, productListQuerySchema, productOutOfStockWebhookEventDataSchema, productOutOfStockWebhookEventSchema, productPatchRequestSchema, productRefundPolicyOverride, productRefundPolicyPatchSchema, productReplaceRequestSchema, productSchema, productSortSchema, productStatusSchema, productSummarySchema, productVariantRequestSchema, productVariantSchema, proratedPaidRefundBase, proratedPointRefund, proratedRefundBase, publicPlanSchema, publicPlansSchema, publishStorefrontVersionRequestSchema, purchaseDecisionExtendResultSchema, purchaseDecisionRequestResultSchema, purchaseEarnPolicySchema, purchaseEarnRateOf, quoteDelivery, quotePricing, rankBestSelling, refreshUserToken, refundPolicyPatchSchema, refundPolicySchema, rejectClaimRequestSchema, remoteAreaLabelOf, remoteAreaOf, remoteAreaSchema, remoteSurchargeOf, replaceStorefrontSourceRequestSchema, requiresCollection, requiresShipping, resolvePointPolicy, resolveRefundPolicy, resolveShippingPolicy, responsePlanCodeSchema, responsePointEntryTypeSchema, reviewListQuerySchema, reviewReportResultSchema, reviewRewardPointOf, reviewRewardPolicySchema, reviewSchema, reviewSortSchema, reviewWebhookEventDataSchema, reviewWebhookEventSchema, rollbackStorefrontRequestSchema, runStorefrontCheckRequestSchema, salesReportGroupBySchema, salesReportQuerySchema, salesReportRowSchema, salesReportSchema, salesTotalsSchema, saveLoginProviderRequestSchema, savedCustomInputRequestSchema, savedCustomInputSchema, savedOptionGroupRequestSchema, savedOptionGroupSchema, savedOptionSetCompositionSchema, savedOptionSetFromProductRequestSchema, savedOptionSetFromProductResultSchema, savedOptionSetListQuerySchema, savedOptionSetRequestSchema, savedOptionSetSchema, savedOptionSetSortSchema, savedOptionValueRequestSchema, savedOptionValueSchema, scopeAccessSchema, searchStorefrontFilesRequestSchema, sellerAddressListQuerySchema, sellerAddressRequestSchema, sellerAddressSchema, sellerCustomerInquirySchema, setStorefrontVisibilityRequestSchema, settleCouponShortfall, settlementDetailQuerySchema, settlementDetailSchema, settlementListQuerySchema, settlementStatusSchema, settlementSummarySchema, settlementWithDetailsSchema, shippingAddressSchema, shippingPolicyPatchSchema, shippingPolicySchema, splitRefund, storeCodeSchema, storeMemberRoleUpdatedSchema, storeMemberSchema, storePointPolicySchema, storeRoleSchema, storeSchema, storeScopeResourceSchema, storeSubscriptionSchema, storefrontBuildDependenciesSchema, storefrontBuildListQuerySchema, storefrontBuildSchema, storefrontBuildStatusSchema, storefrontCheckSchema, storefrontCheckStatusSchema, storefrontCustomDomainStatusSchema, storefrontCustomHostnameProblem, storefrontDependencyFindingSchema, storefrontDeploymentLogSchema, storefrontDeploymentSchema, storefrontDeploymentStepSchema, storefrontDnsRecordSchema, storefrontDomainSchema, storefrontDomainTxtNameOf, storefrontEditPreviewLabelOf, storefrontEditPreviewSchema, storefrontEditSessionSchema, storefrontEditSessionStatusSchema, storefrontEditingSchema, storefrontFileConflictDetailsSchema, storefrontFileContentQuerySchema, storefrontFileContentSchema, storefrontFileDeleteResultSchema, storefrontFileEncodingSchema, storefrontFileEntrySchema, storefrontFileHashSchema, storefrontFileListQuerySchema, storefrontFileListSchema, storefrontFileMoveResultSchema, storefrontFilePathSchema, storefrontFileSearchResultSchema, storefrontFileWriteResultSchema, storefrontHostingSchema, storefrontPreviewLinkSchema, storefrontProvisioningSchema, storefrontRuleResultSchema, storefrontRuleSeveritySchema, storefrontSiteDomainSchema, storefrontSiteDomainsSchema, storefrontSiteSchema, storefrontSiteStatusSchema, storefrontSlugAvailabilityQuerySchema, storefrontSlugAvailabilitySchema, storefrontSlugSchema, storefrontSourceArchivePartSchema, storefrontSourceArchiveQuerySchema, storefrontSourceBlobsResultSchema, storefrontSourceModeSchema, storefrontSourceRefSchema, storefrontSourceReplacedSchema, storefrontSourceSchema, storefrontSuspensionSchema, storefrontTemplateSchema, storefrontVerifyReportSchema, storefrontVersionCreatedSchema, storefrontVersionSchema, storefrontVersionStatusSchema, storefrontVisibilitySchema, subscriptionLimitsSchema, subscriptionStatusSchema, subscriptionUsageSchema, tossPaymentsCredentialsInputSchema, trackingStageResponseSchema, trackingUpdateResultSchema, updateCouponRequestSchema, updateLoginProviderRequestSchema, updateLoginSettingsRequestSchema, updateMemberRoleRequestSchema, updatePaymentProviderRequestSchema, updatePaymentSettingsRequestSchema, updatePointPolicyRequestSchema, updateStoreRequestSchema, uploadExtensionOf, uploadPurposeSchema, uploadRejection, uploadRequestSchema, uploadStorefrontSourceBlobsRequestSchema, uploadTicketSchema, upsertPortOneProviderRequestSchema, upsertTossPaymentsProviderRequestSchema, variantStockRequestSchema, variantStockSchema, verifyPaymentProviderRequestSchema, webhookCreatedSchema, webhookDeliveryDetailSchema, webhookDeliveryErrorCodeSchema, webhookDeliveryListQuerySchema, webhookDeliveryResourceSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEventSchema, webhookFailureReasonSchema, webhookRedeliverFailedResultSchema, webhookRequestHeaderSchema, webhookRequestSchema, webhookResourceTypeSchema, webhookSchema, webhookSecretRotatedSchema, webhookStatusSchema, webhookTestRequestSchema, webhookTestResultSchema, withdrawCustomerRequestSchema, writeDryRunResultSchema, writePreviewSchema, writeStorefrontFilesRequestSchema };
|
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@ export const COLLECTION_TYPES = ["MANUAL", "AUTOMATIC"] as const;
|
|
|
28
28
|
export type CollectionType = (typeof COLLECTION_TYPES)[number];
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* 상품 정렬 — `MANUAL`은 직접 정한 순서(직접 선택 컬렉션만)다. `BEST_SELLING`(판매량순)은
|
|
31
|
+
* 상품 정렬 — `MANUAL`은 직접 정한 순서(직접 선택 컬렉션만)다. `BEST_SELLING`(판매량순)은 판매 수량이 많은 순이다(M3).
|
|
32
32
|
* 저장 값 전체 목록이고, 쓰기에서 받는 값은 `collectionProductSortRequestSchema`다.
|
|
33
33
|
*/
|
|
34
34
|
export const COLLECTION_PRODUCT_SORTS = [
|
|
@@ -44,9 +44,19 @@ export const COLLECTION_PRODUCT_SORTS = [
|
|
|
44
44
|
export type CollectionProductSort = (typeof COLLECTION_PRODUCT_SORTS)[number];
|
|
45
45
|
|
|
46
46
|
export const collectionProductSortRequestSchema = z
|
|
47
|
-
.enum([
|
|
47
|
+
.enum([
|
|
48
|
+
"MANUAL",
|
|
49
|
+
"LATEST",
|
|
50
|
+
"BEST_SELLING",
|
|
51
|
+
"PRICE_ASC",
|
|
52
|
+
"PRICE_DESC",
|
|
53
|
+
"REVIEW_COUNT",
|
|
54
|
+
"RATING_DESC",
|
|
55
|
+
"RECOMMEND",
|
|
56
|
+
])
|
|
48
57
|
.describe(
|
|
49
|
-
"스토어프론트 상품 기본 정렬. `MANUAL`(직접 정한 순서)·`LATEST`(최신순)·`PRICE_ASC`·`PRICE_DESC`·`REVIEW_COUNT`·`RATING_DESC`·`RECOMMEND`(추천순)"
|
|
58
|
+
"스토어프론트 상품 기본 정렬. `MANUAL`(직접 정한 순서)·`LATEST`(최신순)·`BEST_SELLING`(판매량순)·`PRICE_ASC`·`PRICE_DESC`·`REVIEW_COUNT`·`RATING_DESC`·`RECOMMEND`(추천순). " +
|
|
59
|
+
"판매량순의 기간은 판매량 상위 조건의 기간이고, 조건이 없으면 최근 30일이다",
|
|
50
60
|
);
|
|
51
61
|
|
|
52
62
|
/** 노출 상태 — 노출 여부와 기간에서 나온 값이다. 숨김이 기간보다 앞선다 */
|
|
@@ -73,6 +83,13 @@ export const MAX_COLLECTION_RULE_CATEGORIES = 20;
|
|
|
73
83
|
export const MAX_COLLECTION_CREATED_WITHIN_DAYS = 365;
|
|
74
84
|
/** 미리보기(`POST /v1/collections/preview`)가 싣는 상품 최대 개수 */
|
|
75
85
|
export const COLLECTION_PREVIEW_SIZE = 20;
|
|
86
|
+
/** 판매량 상위 조건의 기간 선택지(일, 오늘 포함 한국 날짜) */
|
|
87
|
+
export const COLLECTION_BEST_SELLING_DAYS = [7, 30, 90] as const;
|
|
88
|
+
export type CollectionBestSellingDays = (typeof COLLECTION_BEST_SELLING_DAYS)[number];
|
|
89
|
+
/** 판매량 상위 조건이 담는 상품 최대 개수 */
|
|
90
|
+
export const MAX_COLLECTION_BEST_SELLING_TOP = 100;
|
|
91
|
+
/** 판매량순(`BEST_SELLING`) 정렬의 기간 — 판매량 상위 조건이 없을 때 쓴다 */
|
|
92
|
+
export const COLLECTION_SALES_SORT_DEFAULT_DAYS: CollectionBestSellingDays = 30;
|
|
76
93
|
|
|
77
94
|
const createdWithinDaysRuleSchema = z.object({
|
|
78
95
|
field: z.literal("createdWithinDays"),
|
|
@@ -106,9 +123,23 @@ const discountedRuleSchema = z.object({
|
|
|
106
123
|
value: z.literal(true).describe("즉시할인이 지금 적용되는 상품"),
|
|
107
124
|
});
|
|
108
125
|
|
|
126
|
+
const bestSellingRuleSchema = z.object({
|
|
127
|
+
field: z.literal("bestSelling"),
|
|
128
|
+
days: z
|
|
129
|
+
.union([z.literal(7), z.literal(30), z.literal(90)])
|
|
130
|
+
.describe("판매량을 세는 기간(일). 7·30·90 중 하나이고 오늘을 포함한 한국 날짜 기준이다"),
|
|
131
|
+
top: z
|
|
132
|
+
.number()
|
|
133
|
+
.int()
|
|
134
|
+
.min(1)
|
|
135
|
+
.max(MAX_COLLECTION_BEST_SELLING_TOP)
|
|
136
|
+
.describe("담을 상품 수(1~100). 다른 조건을 만족하는 상품 중 판매 수량 상위 N개다"),
|
|
137
|
+
});
|
|
138
|
+
|
|
109
139
|
/**
|
|
110
140
|
* 조건 하나 — `field`로 가른다. 가격은 즉시할인을 반영한 판매가(`discountedPrice ?? salePrice`)다.
|
|
111
|
-
* 판매량 상위(`bestSelling`)는
|
|
141
|
+
* 판매량 상위(`bestSelling`)는 술어가 아니라 순위 자르기다. 다른 조건을 모두 만족한 상품 중 판매 수량 상위 N개만 남긴다(`rankBestSelling`).
|
|
142
|
+
* 판매 수량은 실결제 주문의 결제 수량에서 취소·반품 수량을 뺀 값이고, 날짜는 주문 시각의 한국 날짜다. 집계는 최대 10분 늦다.
|
|
112
143
|
*/
|
|
113
144
|
export const collectionRuleSchema = z
|
|
114
145
|
.discriminatedUnion("field", [
|
|
@@ -116,6 +147,7 @@ export const collectionRuleSchema = z
|
|
|
116
147
|
categoryRuleSchema,
|
|
117
148
|
priceRuleSchema,
|
|
118
149
|
discountedRuleSchema,
|
|
150
|
+
bestSellingRuleSchema,
|
|
119
151
|
])
|
|
120
152
|
.superRefine((rule, ctx) => {
|
|
121
153
|
if (rule.field !== "price") return;
|
|
@@ -163,6 +195,7 @@ export const collectionRuleViewSchema = z.union([
|
|
|
163
195
|
categoryRuleSchema,
|
|
164
196
|
priceRuleSchema,
|
|
165
197
|
discountedRuleSchema,
|
|
198
|
+
bestSellingRuleSchema,
|
|
166
199
|
z.looseObject({ field: z.string() }),
|
|
167
200
|
]);
|
|
168
201
|
|
|
@@ -213,6 +246,7 @@ export function descendantCategoryIdsOf(
|
|
|
213
246
|
/**
|
|
214
247
|
* 조건 판정 함수를 만든다 — 모든 조건을 만족해야 true다(AND). 카테고리 트리는 여기서 한 번만 푼다.
|
|
215
248
|
* 알 수 없는 조건(`field`)은 만족하지 않는 것으로 본다. 모르는 조건을 건너뛰면 상품이 예고 없이 늘어난다.
|
|
249
|
+
* 판매량 상위(`bestSelling`)는 여기서 모두 통과시킨다. 순위 자르기는 판매량을 아는 호출부가 `rankBestSelling`으로 한다.
|
|
216
250
|
* 판매 상태는 보지 않는다. 판매 중만 거르는 것은 호출부다.
|
|
217
251
|
*/
|
|
218
252
|
export function collectionRulesPredicate(
|
|
@@ -243,6 +277,8 @@ export function collectionRulesPredicate(
|
|
|
243
277
|
case "discounted":
|
|
244
278
|
return (product) =>
|
|
245
279
|
product.discountedPrice !== null && product.discountedPrice < product.salePrice;
|
|
280
|
+
case "bestSelling":
|
|
281
|
+
return () => true;
|
|
246
282
|
default:
|
|
247
283
|
return () => false;
|
|
248
284
|
}
|
|
@@ -259,6 +295,45 @@ export function matchesCollectionRules(
|
|
|
259
295
|
return collectionRulesPredicate(rules, context)(product);
|
|
260
296
|
}
|
|
261
297
|
|
|
298
|
+
/** 판매량 상위 조건 — 없으면 null. 같은 조건은 한 번만 쓰므로 첫 번째다 */
|
|
299
|
+
export function bestSellingRuleOf(
|
|
300
|
+
rules: readonly CollectionRuleView[],
|
|
301
|
+
): { days: CollectionBestSellingDays; top: number } | null {
|
|
302
|
+
for (const rule of rules) {
|
|
303
|
+
const parsed = bestSellingRuleSchema.safeParse(rule);
|
|
304
|
+
if (parsed.success) return { days: parsed.data.days, top: parsed.data.top };
|
|
305
|
+
}
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* 판매량 비교 — 판매 수량이 많은 순, 같으면 최근 등록 순, 그것도 같으면 상품 id 순이다. 결과가 입력 순서에 기대지 않는다.
|
|
311
|
+
* `sales`에 없는 상품은 0개다.
|
|
312
|
+
*/
|
|
313
|
+
export function compareBySales<T extends { productId: string; createdAt: string }>(
|
|
314
|
+
sales: ReadonlyMap<string, number>,
|
|
315
|
+
): (a: T, b: T) => number {
|
|
316
|
+
return (a, b) =>
|
|
317
|
+
(sales.get(b.productId) ?? 0) - (sales.get(a.productId) ?? 0) ||
|
|
318
|
+
Date.parse(b.createdAt) - Date.parse(a.createdAt) ||
|
|
319
|
+
(a.productId < b.productId ? -1 : a.productId > b.productId ? 1 : 0);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* 판매량 상위 자르기 — 다른 조건을 통과한 상품 중 판매 수량이 1개 이상인 상품을 `compareBySales` 순으로 `top`개 남긴다.
|
|
324
|
+
* 판매가 없는 상품은 넣지 않는다.
|
|
325
|
+
*/
|
|
326
|
+
export function rankBestSelling<T extends { productId: string; createdAt: string }>(
|
|
327
|
+
products: readonly T[],
|
|
328
|
+
sales: ReadonlyMap<string, number>,
|
|
329
|
+
top: number,
|
|
330
|
+
): T[] {
|
|
331
|
+
return products
|
|
332
|
+
.filter((product) => (sales.get(product.productId) ?? 0) > 0)
|
|
333
|
+
.sort(compareBySales(sales))
|
|
334
|
+
.slice(0, Math.max(0, top));
|
|
335
|
+
}
|
|
336
|
+
|
|
262
337
|
/** 조건이 참조하는 카테고리 id — 카테고리 삭제의 참조 검사에 쓴다 */
|
|
263
338
|
export function collectionRuleCategoryIds(rules: readonly CollectionRuleView[]): string[] {
|
|
264
339
|
const ids: string[] = [];
|
|
@@ -288,6 +363,14 @@ export const collectionSchema = z.object({
|
|
|
288
363
|
metaTitle: z.string().nullable(),
|
|
289
364
|
metaDescription: z.string().nullable(),
|
|
290
365
|
state: collectionStateSchema.describe("지금 노출 상태"),
|
|
366
|
+
salesComputedAt: z
|
|
367
|
+
.string()
|
|
368
|
+
.nullable()
|
|
369
|
+
.default(null)
|
|
370
|
+
.describe(
|
|
371
|
+
"판매량 기준 시각. 판매량 상위 조건이나 판매량순 정렬을 쓰는 컬렉션은 이 시각까지의 주문을 센다(최대 10분 늦다). " +
|
|
372
|
+
"판매량을 쓰지 않거나 아직 집계 전이면 null",
|
|
373
|
+
),
|
|
291
374
|
productCount: z
|
|
292
375
|
.number()
|
|
293
376
|
.int()
|
|
@@ -347,7 +430,7 @@ const periodRefine = (
|
|
|
347
430
|
/**
|
|
348
431
|
* `POST /v1/collections` — 컬렉션을 만든다. `slug`를 생략하면 `c-{id 뒤 8자}`로 만든다.
|
|
349
432
|
* 직접 선택(`MANUAL`)은 `productIds`가 처음 담을 상품과 순서다. 조건 자동(`AUTOMATIC`)은 `rules`가 있어야 하고 `productIds`를 받지 않는다.
|
|
350
|
-
* `productSort`를 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST
|
|
433
|
+
* `productSort`를 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST`(판매량 상위 조건이 있으면 `BEST_SELLING`)다. 조건 자동은 `MANUAL`을 쓸 수 없다.
|
|
351
434
|
*/
|
|
352
435
|
export const collectionCreateRequestSchema = z
|
|
353
436
|
.object({
|
|
@@ -365,7 +448,7 @@ export const collectionCreateRequestSchema = z
|
|
|
365
448
|
productSort: commonFields.productSort
|
|
366
449
|
.optional()
|
|
367
450
|
.describe(
|
|
368
|
-
"스토어프론트 상품 기본 정렬. 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST
|
|
451
|
+
"스토어프론트 상품 기본 정렬. 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST`(판매량 상위 조건이 있으면 `BEST_SELLING`)다. 조건 자동은 `MANUAL`을 쓸 수 없다",
|
|
369
452
|
),
|
|
370
453
|
visible: commonFields.visible.default(true),
|
|
371
454
|
startsAt: commonFields.startsAt,
|
|
@@ -483,7 +566,9 @@ export const collectionPreviewRequestSchema = z.object({
|
|
|
483
566
|
rules: collectionRulesSchema,
|
|
484
567
|
productSort: collectionProductSortRequestSchema
|
|
485
568
|
.optional()
|
|
486
|
-
.describe(
|
|
569
|
+
.describe(
|
|
570
|
+
"미리보기 순서. 생략하면 `LATEST`(판매량 상위 조건이 있으면 `BEST_SELLING`)이고, `MANUAL`이면 `LATEST`다",
|
|
571
|
+
),
|
|
487
572
|
});
|
|
488
573
|
|
|
489
574
|
export type CollectionPreviewRequest = z.infer<typeof collectionPreviewRequestSchema>;
|
|
@@ -492,6 +577,13 @@ export type CollectionPreviewRequest = z.infer<typeof collectionPreviewRequestSc
|
|
|
492
577
|
export const collectionPreviewSchema = z.object({
|
|
493
578
|
count: z.number().int().describe("조건을 만족하는 판매 중 상품 수(조회 시각 기준)"),
|
|
494
579
|
products: z.array(collectionProductSchema).describe("앞 20개(정렬 순)"),
|
|
580
|
+
salesComputedAt: z
|
|
581
|
+
.string()
|
|
582
|
+
.nullable()
|
|
583
|
+
.default(null)
|
|
584
|
+
.describe(
|
|
585
|
+
"판매량 기준 시각. 판매량 상위 조건이나 판매량순 정렬을 쓰면 이 시각까지의 주문을 센다. 판매량을 쓰지 않거나 집계 전이면 null",
|
|
586
|
+
),
|
|
495
587
|
});
|
|
496
588
|
|
|
497
589
|
export type CollectionPreview = z.infer<typeof collectionPreviewSchema>;
|