@sayren/store-sdk 0.29.6 → 0.29.7

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 CHANGED
@@ -165,9 +165,9 @@ 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";
170
169
  ALLOW: "ALLOW";
170
+ APPROVAL_REQUIRED: "APPROVAL_REQUIRED";
171
171
  }>;
172
172
  export type AgentPolicyDecision = z.infer<typeof agentPolicyDecisionSchema>;
173
173
  export declare const writePreviewSchema: z.ZodObject<{
@@ -190,9 +190,9 @@ 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";
195
194
  ALLOW: "ALLOW";
195
+ APPROVAL_REQUIRED: "APPROVAL_REQUIRED";
196
196
  }>;
197
197
  reason: z.ZodNullable<z.ZodString>;
198
198
  preview: z.ZodObject<{
@@ -2022,10 +2022,15 @@ export declare const couponStatusSchema: z.ZodEnum<{
2022
2022
  ENDED: "ENDED";
2023
2023
  }>;
2024
2024
  export type CouponStatus = z.infer<typeof couponStatusSchema>;
2025
- /** 지금 만들 수 있는 발급 방식 — 다운로드·가입 자동 지급은 뒤 단계다 */
2025
+ /**
2026
+ * 발급 방식 — 코드 입력·셀러 지급·다운로드(구매자가 받기)·회원가입 자동 지급(이슈 #110).
2027
+ * 응답(`couponSchema.issueMethod`)은 값이 늘 수 있어 문자열로 받는다. 이 enum은 요청 검증용이다.
2028
+ */
2026
2029
  export declare const couponIssueMethodSchema: z.ZodEnum<{
2027
2030
  MANUAL: "MANUAL";
2028
2031
  CODE: "CODE";
2032
+ DOWNLOAD: "DOWNLOAD";
2033
+ SIGNUP: "SIGNUP";
2029
2034
  }>;
2030
2035
  export type CouponIssueMethod = z.infer<typeof couponIssueMethodSchema>;
2031
2036
  /** 코드 형식 — 영문·숫자·`-`·`_` 6~30자. 대소문자를 구분하지 않고 서버가 대문자로 저장한다 */
@@ -2078,6 +2083,8 @@ export declare const createCouponRequestSchema: z.ZodObject<{
2078
2083
  issueMethod: z.ZodEnum<{
2079
2084
  MANUAL: "MANUAL";
2080
2085
  CODE: "CODE";
2086
+ DOWNLOAD: "DOWNLOAD";
2087
+ SIGNUP: "SIGNUP";
2081
2088
  }>;
2082
2089
  code: z.ZodOptional<z.ZodString>;
2083
2090
  startsAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
@@ -2196,6 +2203,8 @@ export declare const couponListQuerySchema: z.ZodObject<{
2196
2203
  issueMethod: z.ZodOptional<z.ZodEnum<{
2197
2204
  MANUAL: "MANUAL";
2198
2205
  CODE: "CODE";
2206
+ DOWNLOAD: "DOWNLOAD";
2207
+ SIGNUP: "SIGNUP";
2199
2208
  }>>;
2200
2209
  q: z.ZodOptional<z.ZodString>;
2201
2210
  }, z.core.$strip>;
@@ -2206,6 +2215,7 @@ export declare const couponIssueSchema: z.ZodObject<{
2206
2215
  couponId: z.ZodString;
2207
2216
  customerId: z.ZodString;
2208
2217
  customerName: z.ZodNullable<z.ZodString>;
2218
+ source: z.ZodOptional<z.ZodString>;
2209
2219
  status: z.ZodString;
2210
2220
  validFrom: z.ZodString;
2211
2221
  validUntil: z.ZodNullable<z.ZodString>;
@@ -2284,6 +2294,7 @@ export declare const customerCouponSchema: z.ZodObject<{
2284
2294
  couponId: z.ZodString;
2285
2295
  customerId: z.ZodString;
2286
2296
  customerName: z.ZodNullable<z.ZodString>;
2297
+ source: z.ZodOptional<z.ZodString>;
2287
2298
  status: z.ZodString;
2288
2299
  validFrom: z.ZodString;
2289
2300
  validUntil: z.ZodNullable<z.ZodString>;
@@ -2384,8 +2395,8 @@ export type ConsentAction = z.infer<typeof consentActionSchema>;
2384
2395
  * `RECONSENT` 약관 개정 재동의 · `MEMBER_UPDATE` 구매자가 직접 변경 · `SELLER` 셀러가 처리
2385
2396
  */
2386
2397
  export declare const consentSourceSchema: z.ZodEnum<{
2387
- SELLER: "SELLER";
2388
2398
  SIGNUP: "SIGNUP";
2399
+ SELLER: "SELLER";
2389
2400
  SOCIAL_SIGNUP: "SOCIAL_SIGNUP";
2390
2401
  DELEGATED: "DELEGATED";
2391
2402
  RECONSENT: "RECONSENT";
@@ -2407,8 +2418,8 @@ export declare const customerConsentSchema: z.ZodObject<{
2407
2418
  AGREED: "AGREED";
2408
2419
  }>;
2409
2420
  source: z.ZodEnum<{
2410
- SELLER: "SELLER";
2411
2421
  SIGNUP: "SIGNUP";
2422
+ SELLER: "SELLER";
2412
2423
  SOCIAL_SIGNUP: "SOCIAL_SIGNUP";
2413
2424
  DELEGATED: "DELEGATED";
2414
2425
  RECONSENT: "RECONSENT";
@@ -10325,7 +10336,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
10325
10336
  version: string | null;
10326
10337
  documentUrl: string | null;
10327
10338
  action: "WITHDRAWN" | "AGREED";
10328
- source: "SELLER" | "SIGNUP" | "SOCIAL_SIGNUP" | "DELEGATED" | "RECONSENT" | "MEMBER_UPDATE";
10339
+ source: "SIGNUP" | "SELLER" | "SOCIAL_SIGNUP" | "DELEGATED" | "RECONSENT" | "MEMBER_UPDATE";
10329
10340
  occurredAt: string;
10330
10341
  }[];
10331
10342
  }>;
@@ -10348,6 +10359,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
10348
10359
  value: number;
10349
10360
  maxDiscountAmount: number | null;
10350
10361
  };
10362
+ source?: string | undefined;
10351
10363
  }[]>;
10352
10364
  withdraw: (customerId: string, body: WithdrawCustomerRequest) => Promise<void>;
10353
10365
  };
@@ -10669,6 +10681,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
10669
10681
  usedOrderId: string | null;
10670
10682
  issuedAt: string;
10671
10683
  revokedAt: string | null;
10684
+ source?: string | undefined;
10672
10685
  }[];
10673
10686
  }>;
10674
10687
  redemptions: (couponId: string, params?: PageParams & {
@@ -10716,6 +10729,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
10716
10729
  usedOrderId: string | null;
10717
10730
  issuedAt: string;
10718
10731
  revokedAt: string | null;
10732
+ source?: string | undefined;
10719
10733
  }>;
10720
10734
  };
10721
10735
  customerInquiries: {
package/dist/index.mjs CHANGED
@@ -2984,8 +2984,16 @@ const couponStatusSchema = z.enum([
2984
2984
  "PAUSED",
2985
2985
  "ENDED"
2986
2986
  ]).describe("쿠폰 상태. `ACTIVE`=사용 중, `PAUSED`=중지(재개 가능), `ENDED`=종료(되돌릴 수 없음)");
2987
- /** 지금 만들 수 있는 발급 방식 — 다운로드·가입 자동 지급은 뒤 단계다 */
2988
- const couponIssueMethodSchema = z.enum(["CODE", "MANUAL"]).describe("발급 방식. `CODE`=구매자가 주문서에 코드를 입력한다, `MANUAL`=셀러가 회원을 골라 지급한다");
2987
+ /**
2988
+ * 발급 방식 — 코드 입력·셀러 지급·다운로드(구매자가 받기)·회원가입 자동 지급(이슈 #110).
2989
+ * 응답(`couponSchema.issueMethod`)은 값이 늘 수 있어 문자열로 받는다. 이 enum은 요청 검증용이다.
2990
+ */
2991
+ const couponIssueMethodSchema = z.enum([
2992
+ "CODE",
2993
+ "MANUAL",
2994
+ "DOWNLOAD",
2995
+ "SIGNUP"
2996
+ ]).describe("발급 방식. `CODE`=구매자가 주문서에 코드를 입력한다, `MANUAL`=셀러가 회원을 골라 지급한다, `DOWNLOAD`=구매자가 스토어프론트에서 받는다, `SIGNUP`=회원가입 때 자동으로 지급한다");
2989
2997
  /** 코드 형식 — 영문·숫자·`-`·`_` 6~30자. 대소문자를 구분하지 않고 서버가 대문자로 저장한다 */
2990
2998
  const COUPON_CODE_PATTERN = /^[A-Za-z0-9_-]{6,30}$/;
2991
2999
  /** 코드 정규화 — 대문자, 앞뒤 공백 제거. 입력·저장·조회가 같은 함수를 쓴다 */
@@ -2999,10 +3007,10 @@ const descriptions$1 = {
2999
3007
  code: "쿠폰 코드 — 발급 방식이 `CODE`일 때 필수. 영문·숫자·`-`·`_` 6~30자, 대소문자 구분 없음(대문자로 저장). 상점 안에서 유일하다",
3000
3008
  startsAt: "사용 시작 시각(ISO 8601, 시간대 포함). 생략하면 바로 쓸 수 있다",
3001
3009
  endsAt: "사용 종료 시각(ISO 8601, 시간대 포함). 이 시각부터 못 쓴다. 생략하면 제한이 없다. 이미 지급한 쿠폰의 유효 기간은 지급 때 정해지므로 뒤에 종료일을 늦춰도 늘어나지 않는다",
3002
- validDaysAfterIssue: "발급 후 유효 일수 — 셀러 지급(`MANUAL`) 쿠폰만. 쿠폰 종료일과 둘 중 먼저 끝나는 쪽이 적용된다",
3003
- totalIssueLimit: "총 발급 수 한도. 생략하면 무제한",
3010
+ validDaysAfterIssue: "발급 후 유효 일수 — 발급형(`MANUAL`·`DOWNLOAD`·`SIGNUP`) 쿠폰만. 쿠폰 종료일과 둘 중 먼저 끝나는 쪽이 적용된다",
3011
+ totalIssueLimit: "총 발급 수 한도. 생략하면 무제한. 다운로드·회원가입 쿠폰은 한도에 닿으면 더 발급하지 않는다",
3004
3012
  totalUseLimit: "총 사용 수 한도. 결제 중인 예약도 센다. 생략하면 무제한",
3005
- perMemberIssueLimit: "1인 발급 수 한도(셀러 지급). 생략하면 1인 1장",
3013
+ perMemberIssueLimit: "1인 발급 수 한도(셀러 지급·다운로드). 생략하면 1인 1장. 회원가입 쿠폰은 1장 고정이라 1만 받는다",
3006
3014
  perMemberUseLimit: "1인 사용 수 한도(코드 입력형). 생략하면 무제한. 비회원에게 여는 쿠폰은 둘 수 없다"
3007
3015
  };
3008
3016
  /** 조건 입력 — 생략한 항목은 기본값(`COUPON_CONDITIONS_DEFAULTS`)이다 */
@@ -3046,8 +3054,9 @@ const createCouponRequestSchema = z.strictObject({
3046
3054
  if (body.issueMethod === "CODE" && !body.code) issue("code", "코드 입력형 쿠폰은 코드가 필요합니다");
3047
3055
  if (body.issueMethod !== "CODE" && body.code) issue("code", "코드는 코드 입력형 쿠폰에만 둡니다");
3048
3056
  if (body.issueMethod === "CODE" && body.validDaysAfterIssue != null) issue("validDaysAfterIssue", "발급 후 유효 일수는 셀러 지급 쿠폰에만 둡니다");
3049
- if (body.issueMethod === "CODE" && body.perMemberIssueLimit != null) issue("perMemberIssueLimit", "1인 발급 수 한도는 셀러 지급 쿠폰에만 둡니다");
3050
- if (body.issueMethod === "MANUAL" && body.perMemberUseLimit != null) issue("perMemberUseLimit", "셀러 지급 쿠폰은 발급 한 장이 한 번 쓰입니다. 1인 발급 수 한도를 쓰십시오");
3057
+ if (body.issueMethod === "CODE" && body.perMemberIssueLimit != null) issue("perMemberIssueLimit", "1인 발급 수 한도는 발급형 쿠폰에만 둡니다");
3058
+ if (body.issueMethod === "SIGNUP" && body.perMemberIssueLimit != null && body.perMemberIssueLimit !== 1) issue("perMemberIssueLimit", "회원가입 쿠폰은 1인 1장입니다");
3059
+ if (body.issueMethod !== "CODE" && body.perMemberUseLimit != null) issue("perMemberUseLimit", "발급형 쿠폰은 발급 한 장이 한 번 쓰입니다. 1인 발급 수 한도를 사용하십시오");
3051
3060
  if (!(body.conditions?.memberOnly ?? COUPON_CONDITIONS_DEFAULTS.memberOnly) && (body.issueMethod !== "CODE" || body.perMemberUseLimit != null)) issue("conditions", "비회원에게 여는 쿠폰은 코드 입력형이면서 1인 사용 한도가 없어야 합니다");
3052
3061
  if (body.startsAt && body.endsAt && Date.parse(body.endsAt) <= Date.parse(body.startsAt)) issue("endsAt", "종료 시각은 시작 시각보다 뒤여야 합니다");
3053
3062
  });
@@ -3079,7 +3088,7 @@ const couponSchema = z.object({
3079
3088
  benefit: couponBenefitSchema,
3080
3089
  conditions: couponConditionsSchema,
3081
3090
  target: couponTargetSchema,
3082
- issueMethod: z.string().describe("발급 방식. 현재 값은 `CODE`·`MANUAL`이고 값이 추가될 수 있어 문자열로 받는다(다운로드·가입 자동 지급 예정)"),
3091
+ issueMethod: z.string().describe("발급 방식. 현재 값은 `CODE`·`MANUAL`·`DOWNLOAD`(구매자가 받기)·`SIGNUP`(회원가입 자동 지급)이고 값이 추가될 수 있어 문자열로 받는다"),
3083
3092
  code: z.string().nullable().describe("쿠폰 코드(대문자). 코드 입력형이 아니면 null"),
3084
3093
  startsAt: z.string().nullable(),
3085
3094
  endsAt: z.string().nullable(),
@@ -3112,6 +3121,7 @@ const couponIssueSchema = z.object({
3112
3121
  couponId: z.string(),
3113
3122
  customerId: z.string(),
3114
3123
  customerName: z.string().nullable().describe("구매자 이름. 탈퇴한 구매자는 null"),
3124
+ source: z.string().optional().describe("발급 경로(이슈 #110). 현재 값은 `MANUAL`(셀러 지급)·`DOWNLOAD`(구매자가 받음)·`SIGNUP`(회원가입 자동 지급)이고 값이 추가될 수 있다. 서버는 항상 싣는다"),
3115
3125
  status: couponIssueStatusSchema,
3116
3126
  validFrom: z.string(),
3117
3127
  validUntil: z.string().nullable(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sayren/store-sdk",
3
- "version": "0.29.6",
3
+ "version": "0.29.7",
4
4
  "main": "./dist/index.mjs",
5
5
  "types": "./dist/index.d.mts",
6
6
  "exports": {
@@ -23,11 +23,15 @@ export const couponStatusSchema = z
23
23
  .describe("쿠폰 상태. `ACTIVE`=사용 중, `PAUSED`=중지(재개 가능), `ENDED`=종료(되돌릴 수 없음)");
24
24
  export type CouponStatus = z.infer<typeof couponStatusSchema>;
25
25
 
26
- /** 지금 만들 수 있는 발급 방식 — 다운로드·가입 자동 지급은 뒤 단계다 */
26
+ /**
27
+ * 발급 방식 — 코드 입력·셀러 지급·다운로드(구매자가 받기)·회원가입 자동 지급(이슈 #110).
28
+ * 응답(`couponSchema.issueMethod`)은 값이 늘 수 있어 문자열로 받는다. 이 enum은 요청 검증용이다.
29
+ */
27
30
  export const couponIssueMethodSchema = z
28
- .enum(["CODE", "MANUAL"])
31
+ .enum(["CODE", "MANUAL", "DOWNLOAD", "SIGNUP"])
29
32
  .describe(
30
- "발급 방식. `CODE`=구매자가 주문서에 코드를 입력한다, `MANUAL`=셀러가 회원을 골라 지급한다",
33
+ "발급 방식. `CODE`=구매자가 주문서에 코드를 입력한다, `MANUAL`=셀러가 회원을 골라 지급한다, " +
34
+ "`DOWNLOAD`=구매자가 스토어프론트에서 받는다, `SIGNUP`=회원가입 때 자동으로 지급한다",
31
35
  );
32
36
  export type CouponIssueMethod = z.infer<typeof couponIssueMethodSchema>;
33
37
 
@@ -51,10 +55,12 @@ const descriptions = {
51
55
  "사용 종료 시각(ISO 8601, 시간대 포함). 이 시각부터 못 쓴다. 생략하면 제한이 없다. " +
52
56
  "이미 지급한 쿠폰의 유효 기간은 지급 때 정해지므로 뒤에 종료일을 늦춰도 늘어나지 않는다",
53
57
  validDaysAfterIssue:
54
- "발급 후 유효 일수 — 셀러 지급(`MANUAL`) 쿠폰만. 쿠폰 종료일과 둘 중 먼저 끝나는 쪽이 적용된다",
55
- totalIssueLimit: "총 발급 수 한도. 생략하면 무제한",
58
+ "발급 후 유효 일수 — 발급형(`MANUAL`·`DOWNLOAD`·`SIGNUP`) 쿠폰만. 쿠폰 종료일과 둘 중 먼저 끝나는 쪽이 적용된다",
59
+ totalIssueLimit:
60
+ "총 발급 수 한도. 생략하면 무제한. 다운로드·회원가입 쿠폰은 한도에 닿으면 더 발급하지 않는다",
56
61
  totalUseLimit: "총 사용 수 한도. 결제 중인 예약도 센다. 생략하면 무제한",
57
- perMemberIssueLimit: "1인 발급 수 한도(셀러 지급). 생략하면 1인 1장",
62
+ perMemberIssueLimit:
63
+ "1인 발급 수 한도(셀러 지급·다운로드). 생략하면 1인 1장. 회원가입 쿠폰은 1장 고정이라 1만 받는다",
58
64
  perMemberUseLimit:
59
65
  "1인 사용 수 한도(코드 입력형). 생략하면 무제한. 비회원에게 여는 쿠폰은 둘 수 없다",
60
66
  } as const;
@@ -117,12 +123,19 @@ export const createCouponRequestSchema = z
117
123
  issue("validDaysAfterIssue", "발급 후 유효 일수는 셀러 지급 쿠폰에만 둡니다");
118
124
  }
119
125
  if (body.issueMethod === "CODE" && body.perMemberIssueLimit != null) {
120
- issue("perMemberIssueLimit", "1인 발급 수 한도는 셀러 지급 쿠폰에만 둡니다");
126
+ issue("perMemberIssueLimit", "1인 발급 수 한도는 발급형 쿠폰에만 둡니다");
127
+ }
128
+ if (
129
+ body.issueMethod === "SIGNUP" &&
130
+ body.perMemberIssueLimit != null &&
131
+ body.perMemberIssueLimit !== 1
132
+ ) {
133
+ issue("perMemberIssueLimit", "회원가입 쿠폰은 1인 1장입니다");
121
134
  }
122
- if (body.issueMethod === "MANUAL" && body.perMemberUseLimit != null) {
135
+ if (body.issueMethod !== "CODE" && body.perMemberUseLimit != null) {
123
136
  issue(
124
137
  "perMemberUseLimit",
125
- "셀러 지급 쿠폰은 발급 한 장이 한 번 쓰입니다. 1인 발급 수 한도를 쓰십시오",
138
+ "발급형 쿠폰은 발급 한 장이 한 번 쓰입니다. 1인 발급 수 한도를 사용하십시오",
126
139
  );
127
140
  }
128
141
  const memberOnly = body.conditions?.memberOnly ?? COUPON_CONDITIONS_DEFAULTS.memberOnly;
@@ -168,7 +181,7 @@ export const couponSchema = z.object({
168
181
  issueMethod: z
169
182
  .string()
170
183
  .describe(
171
- "발급 방식. 현재 값은 `CODE`·`MANUAL`이고 값이 추가될 수 있어 문자열로 받는다(다운로드·가입 자동 지급 예정)",
184
+ "발급 방식. 현재 값은 `CODE`·`MANUAL`·`DOWNLOAD`(구매자가 받기)·`SIGNUP`(회원가입 자동 지급)이고 값이 추가될 수 있어 문자열로 받는다",
172
185
  ),
173
186
  code: z.string().nullable().describe("쿠폰 코드(대문자). 코드 입력형이 아니면 null"),
174
187
  startsAt: z.string().nullable(),
@@ -214,6 +227,12 @@ export const couponIssueSchema = z.object({
214
227
  couponId: z.string(),
215
228
  customerId: z.string(),
216
229
  customerName: z.string().nullable().describe("구매자 이름. 탈퇴한 구매자는 null"),
230
+ source: z
231
+ .string()
232
+ .optional()
233
+ .describe(
234
+ "발급 경로(이슈 #110). 현재 값은 `MANUAL`(셀러 지급)·`DOWNLOAD`(구매자가 받음)·`SIGNUP`(회원가입 자동 지급)이고 값이 추가될 수 있다. 서버는 항상 싣는다",
235
+ ),
217
236
  status: couponIssueStatusSchema,
218
237
  validFrom: z.string(),
219
238
  validUntil: z.string().nullable(),