@sayren/store-sdk 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -100,6 +100,7 @@ export declare const analyticsOverviewSchema: z.ZodObject<{
100
100
  conversionRate: z.ZodNullable<z.ZodNumber>;
101
101
  date: z.ZodString;
102
102
  }, z.core.$strip>>;
103
+ excludedBotSessions: z.ZodNumber;
103
104
  from: z.ZodString;
104
105
  to: z.ZodString;
105
106
  timezone: z.ZodLiteral<"Asia/Seoul">;
@@ -144,6 +145,7 @@ export declare const analyticsProductRowSchema: z.ZodObject<{
144
145
  quantity: z.ZodNumber;
145
146
  revenue: z.ZodNumber;
146
147
  purchaseRate: z.ZodNullable<z.ZodNumber>;
148
+ clickThroughRate: z.ZodNullable<z.ZodNumber>;
147
149
  }, z.core.$strip>;
148
150
  export type AnalyticsProductRow = z.infer<typeof analyticsProductRowSchema>;
149
151
  export declare const analyticsProductsSchema: z.ZodObject<{
@@ -165,6 +167,7 @@ export declare const analyticsProductsSchema: z.ZodObject<{
165
167
  quantity: z.ZodNumber;
166
168
  revenue: z.ZodNumber;
167
169
  purchaseRate: z.ZodNullable<z.ZodNumber>;
170
+ clickThroughRate: z.ZodNullable<z.ZodNumber>;
168
171
  }, z.core.$strip>>;
169
172
  from: z.ZodString;
170
173
  to: z.ZodString;
@@ -279,6 +282,159 @@ export declare const analyticsSourcesSchema: z.ZodObject<{
279
282
  lastComputedAt: z.ZodNullable<z.ZodString>;
280
283
  }, z.core.$strip>;
281
284
  export type AnalyticsSources = z.infer<typeof analyticsSourcesSchema>;
285
+ export declare const analyticsRealtimeSchema: z.ZodObject<{
286
+ asOf: z.ZodString;
287
+ windowMinutes: z.ZodLiteral<5>;
288
+ visitors: z.ZodNumber;
289
+ sessions: z.ZodNumber;
290
+ pageViews: z.ZodNumber;
291
+ pages: z.ZodArray<z.ZodObject<{
292
+ path: z.ZodString;
293
+ visitors: z.ZodNumber;
294
+ pageViews: z.ZodNumber;
295
+ }, z.core.$strip>>;
296
+ }, z.core.$strip>;
297
+ export type AnalyticsRealtime = z.infer<typeof analyticsRealtimeSchema>;
298
+ export declare const analyticsDeviceRowSchema: z.ZodObject<{
299
+ device: z.ZodEnum<{
300
+ unknown: "unknown";
301
+ desktop: "desktop";
302
+ mobile: "mobile";
303
+ tablet: "tablet";
304
+ }>;
305
+ sessions: z.ZodNumber;
306
+ productViewSessions: z.ZodNumber;
307
+ addToCartSessions: z.ZodNumber;
308
+ beginCheckoutSessions: z.ZodNumber;
309
+ purchaseSessions: z.ZodNumber;
310
+ conversionRate: z.ZodNullable<z.ZodNumber>;
311
+ }, z.core.$strip>;
312
+ export type AnalyticsDeviceRow = z.infer<typeof analyticsDeviceRowSchema>;
313
+ export declare const analyticsDevicesSchema: z.ZodObject<{
314
+ rows: z.ZodArray<z.ZodObject<{
315
+ device: z.ZodEnum<{
316
+ unknown: "unknown";
317
+ desktop: "desktop";
318
+ mobile: "mobile";
319
+ tablet: "tablet";
320
+ }>;
321
+ sessions: z.ZodNumber;
322
+ productViewSessions: z.ZodNumber;
323
+ addToCartSessions: z.ZodNumber;
324
+ beginCheckoutSessions: z.ZodNumber;
325
+ purchaseSessions: z.ZodNumber;
326
+ conversionRate: z.ZodNullable<z.ZodNumber>;
327
+ }, z.core.$strip>>;
328
+ from: z.ZodString;
329
+ to: z.ZodString;
330
+ timezone: z.ZodLiteral<"Asia/Seoul">;
331
+ currency: z.ZodLiteral<"KRW">;
332
+ includeTest: z.ZodBoolean;
333
+ lastComputedAt: z.ZodNullable<z.ZodString>;
334
+ }, z.core.$strip>;
335
+ export type AnalyticsDevices = z.infer<typeof analyticsDevicesSchema>;
336
+ export declare const analyticsPagesQuerySchema: z.ZodObject<{
337
+ from: z.ZodString;
338
+ to: z.ZodString;
339
+ includeTest: z.ZodOptional<z.ZodEnum<{
340
+ true: "true";
341
+ false: "false";
342
+ }>>;
343
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
344
+ }, z.core.$strip>;
345
+ export type AnalyticsPagesParams = z.infer<typeof analyticsPagesQuerySchema>;
346
+ export declare const analyticsPagesSchema: z.ZodObject<{
347
+ landings: z.ZodArray<z.ZodObject<{
348
+ path: z.ZodString;
349
+ entrances: z.ZodNumber;
350
+ bounces: z.ZodNumber;
351
+ bounceRate: z.ZodNullable<z.ZodNumber>;
352
+ }, z.core.$strip>>;
353
+ exits: z.ZodArray<z.ZodObject<{
354
+ path: z.ZodString;
355
+ pageViews: z.ZodNumber;
356
+ exits: z.ZodNumber;
357
+ exitRate: z.ZodNullable<z.ZodNumber>;
358
+ }, z.core.$strip>>;
359
+ from: z.ZodString;
360
+ to: z.ZodString;
361
+ timezone: z.ZodLiteral<"Asia/Seoul">;
362
+ currency: z.ZodLiteral<"KRW">;
363
+ includeTest: z.ZodBoolean;
364
+ lastComputedAt: z.ZodNullable<z.ZodString>;
365
+ }, z.core.$strip>;
366
+ export type AnalyticsPages = z.infer<typeof analyticsPagesSchema>;
367
+ export declare const analyticsSearchQuerySchema: z.ZodObject<{
368
+ from: z.ZodString;
369
+ to: z.ZodString;
370
+ includeTest: z.ZodOptional<z.ZodEnum<{
371
+ true: "true";
372
+ false: "false";
373
+ }>>;
374
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
375
+ }, z.core.$strip>;
376
+ export type AnalyticsSearchParams = z.infer<typeof analyticsSearchQuerySchema>;
377
+ export declare const analyticsSearchSchema: z.ZodObject<{
378
+ summary: z.ZodObject<{
379
+ searches: z.ZodNumber;
380
+ zeroResultSearches: z.ZodNumber;
381
+ searchSessions: z.ZodNumber;
382
+ purchaseSessions: z.ZodNumber;
383
+ conversionRate: z.ZodNullable<z.ZodNumber>;
384
+ }, z.core.$strip>;
385
+ terms: z.ZodArray<z.ZodObject<{
386
+ term: z.ZodString;
387
+ searches: z.ZodNumber;
388
+ zeroResultSearches: z.ZodNumber;
389
+ searchSessions: z.ZodNumber;
390
+ purchaseSessions: z.ZodNumber;
391
+ conversionRate: z.ZodNullable<z.ZodNumber>;
392
+ }, z.core.$strip>>;
393
+ zeroResultTerms: z.ZodArray<z.ZodObject<{
394
+ term: z.ZodString;
395
+ searches: z.ZodNumber;
396
+ zeroResultSearches: z.ZodNumber;
397
+ }, z.core.$strip>>;
398
+ from: z.ZodString;
399
+ to: z.ZodString;
400
+ timezone: z.ZodLiteral<"Asia/Seoul">;
401
+ currency: z.ZodLiteral<"KRW">;
402
+ includeTest: z.ZodBoolean;
403
+ lastComputedAt: z.ZodNullable<z.ZodString>;
404
+ }, z.core.$strip>;
405
+ export type AnalyticsSearch = z.infer<typeof analyticsSearchSchema>;
406
+ export declare const analyticsCheckoutOutcomeSchema: z.ZodEnum<{
407
+ OTHER: "OTHER";
408
+ COMPLETED: "COMPLETED";
409
+ NOT_OPENED: "NOT_OPENED";
410
+ USER_CANCELED: "USER_CANCELED";
411
+ DECLINED: "DECLINED";
412
+ PREPARE_FAILURE: "PREPARE_FAILURE";
413
+ IN_PROGRESS: "IN_PROGRESS";
414
+ }>;
415
+ export type AnalyticsCheckoutOutcome = z.infer<typeof analyticsCheckoutOutcomeSchema>;
416
+ export declare const analyticsCheckoutSchema: z.ZodObject<{
417
+ sessions: z.ZodNumber;
418
+ outcomes: z.ZodArray<z.ZodObject<{
419
+ outcome: z.ZodEnum<{
420
+ OTHER: "OTHER";
421
+ COMPLETED: "COMPLETED";
422
+ NOT_OPENED: "NOT_OPENED";
423
+ USER_CANCELED: "USER_CANCELED";
424
+ DECLINED: "DECLINED";
425
+ PREPARE_FAILURE: "PREPARE_FAILURE";
426
+ IN_PROGRESS: "IN_PROGRESS";
427
+ }>;
428
+ sessions: z.ZodNumber;
429
+ }, z.core.$strip>>;
430
+ from: z.ZodString;
431
+ to: z.ZodString;
432
+ timezone: z.ZodLiteral<"Asia/Seoul">;
433
+ currency: z.ZodLiteral<"KRW">;
434
+ includeTest: z.ZodBoolean;
435
+ lastComputedAt: z.ZodNullable<z.ZodString>;
436
+ }, z.core.$strip>;
437
+ export type AnalyticsCheckout = z.infer<typeof analyticsCheckoutSchema>;
282
438
  //#endregion
283
439
  //#region src/schemas/api-client.d.ts
284
440
  /**
@@ -976,11 +1132,14 @@ export declare const claimSchema: z.ZodObject<{
976
1132
  }, z.core.$strip>>;
977
1133
  requestedAt: z.ZodString;
978
1134
  completedAt: z.ZodNullable<z.ZodString>;
1135
+ holdExpiresAt: z.ZodNullable<z.ZodString>;
1136
+ holdUsed: z.ZodBoolean;
979
1137
  }, z.core.$strip>;
980
1138
  export type Claim = z.infer<typeof claimSchema>;
981
1139
  export interface ClaimListParams extends PageParams {
982
1140
  type?: ClaimType;
983
- status?: ClaimStatus;
1141
+ /** 여러 상태를 한 번에 거를 수 있다(처리 대기 목록 등) */
1142
+ status?: ClaimStatus | ClaimStatus[];
984
1143
  orderItemId?: string;
985
1144
  requestedFrom?: string;
986
1145
  requestedTo?: string;
@@ -994,17 +1153,7 @@ export declare const claimListQuerySchema: z.ZodObject<{
994
1153
  EXCHANGE: "EXCHANGE";
995
1154
  CANCEL: "CANCEL";
996
1155
  }>>;
997
- status: z.ZodOptional<z.ZodEnum<{
998
- REQUESTED: "REQUESTED";
999
- HELD: "HELD";
1000
- COLLECTING: "COLLECTING";
1001
- COLLECTED: "COLLECTED";
1002
- REDELIVERING: "REDELIVERING";
1003
- APPROVED: "APPROVED";
1004
- REJECTED: "REJECTED";
1005
- COMPLETED: "COMPLETED";
1006
- WITHDRAWN: "WITHDRAWN";
1007
- }>>;
1156
+ status: z.ZodOptional<z.ZodString>;
1008
1157
  orderItemId: z.ZodOptional<z.ZodString>;
1009
1158
  requestedFrom: z.ZodOptional<z.ZodString>;
1010
1159
  requestedTo: z.ZodOptional<z.ZodString>;
@@ -1061,6 +1210,8 @@ export declare const claimDetailSchema: z.ZodObject<{
1061
1210
  }, z.core.$strip>>;
1062
1211
  requestedAt: z.ZodString;
1063
1212
  completedAt: z.ZodNullable<z.ZodString>;
1213
+ holdExpiresAt: z.ZodNullable<z.ZodString>;
1214
+ holdUsed: z.ZodBoolean;
1064
1215
  histories: z.ZodOptional<z.ZodArray<z.ZodObject<{
1065
1216
  status: z.ZodEnum<{
1066
1217
  REQUESTED: "REQUESTED";
@@ -1245,7 +1396,7 @@ export declare const withdrawCustomerRequestSchema: z.ZodObject<{
1245
1396
  memo: z.ZodOptional<z.ZodString>;
1246
1397
  }, z.core.$strip>;
1247
1398
  export type WithdrawCustomerRequest = z.infer<typeof withdrawCustomerRequestSchema>;
1248
- /** `WITHDRAWAL_BLOCKED`의 `error.details` — 탈퇴를 막는 항목 수(스토어프런트 탈퇴와 같다) */
1399
+ /** `WITHDRAWAL_BLOCKED`의 `error.details` — 탈퇴를 막는 항목 수(스토어프론트 탈퇴와 같다) */
1249
1400
  export declare const customerWithdrawalBlockedDetailsSchema: z.ZodObject<{
1250
1401
  inProgressOrderItems: z.ZodNumber;
1251
1402
  openClaims: z.ZodNumber;
@@ -3542,7 +3693,7 @@ export declare function isReservedStoreCode(code: string): boolean;
3542
3693
  export declare const storeCodeSchema: z.ZodString;
3543
3694
  /** `https://shop.example.com`처럼 경로·쿼리 없는 http(s) 오리진인가 */
3544
3695
  export declare function isWebOrigin(value: string): boolean;
3545
- /** 방문 분석을 보낼 수 있는 스토어프런트 오리진 — 스킴·호스트(·포트)만. 서버가 소문자·끝 슬래시 제거로 정규화한다 */
3696
+ /** 방문 분석을 보낼 수 있는 스토어프론트 오리진 — 스킴·호스트(·포트)만. 서버가 소문자·끝 슬래시 제거로 정규화한다 */
3546
3697
  export declare const analyticsOriginSchema: z.ZodString;
3547
3698
  /** 허용 오리진 상한 */
3548
3699
  export declare const MAX_ANALYTICS_ALLOWED_ORIGINS = 20;
@@ -4589,6 +4740,8 @@ export declare function createStoreClient(options: StoreClientOptions): {
4589
4740
  } | null;
4590
4741
  requestedAt: string;
4591
4742
  completedAt: string | null;
4743
+ holdExpiresAt: string | null;
4744
+ holdUsed: boolean;
4592
4745
  }[];
4593
4746
  }>;
4594
4747
  get: (claimId: string) => Promise<{
@@ -4615,6 +4768,8 @@ export declare function createStoreClient(options: StoreClientOptions): {
4615
4768
  } | null;
4616
4769
  requestedAt: string;
4617
4770
  completedAt: string | null;
4771
+ holdExpiresAt: string | null;
4772
+ holdUsed: boolean;
4618
4773
  histories?: {
4619
4774
  status: "REQUESTED" | "HELD" | "COLLECTING" | "COLLECTED" | "REDELIVERING" | "APPROVED" | "REJECTED" | "COMPLETED" | "WITHDRAWN";
4620
4775
  actor: "BUYER" | "SELLER" | "SYSTEM";
@@ -4639,6 +4794,34 @@ export declare function createStoreClient(options: StoreClientOptions): {
4639
4794
  holdExpiresAt: string;
4640
4795
  }>;
4641
4796
  releaseHold: (claimId: string) => Promise<void>;
4797
+ /** 교환 완료 — 재배송 중인 교환을 셀러가 명시적으로 끝낸다 */
4798
+ completeExchange: (claimId: string) => Promise<{
4799
+ claimId: string;
4800
+ type: "RETURN" | "EXCHANGE" | "CANCEL";
4801
+ status: "REQUESTED" | "HELD" | "COLLECTING" | "COLLECTED" | "REDELIVERING" | "APPROVED" | "REJECTED" | "COMPLETED" | "WITHDRAWN";
4802
+ orderId: string;
4803
+ orderItemId: string;
4804
+ productName: string;
4805
+ quantity: number;
4806
+ reason: "CHANGE_OF_MIND" | "WRONG_ORDER" | "DEFECTIVE" | "WRONG_DELIVERY" | "DIFFERENT_FROM_PAGE" | "DELAY";
4807
+ reasonDetail: string | null;
4808
+ responsibility: "BUYER" | "SELLER";
4809
+ claimDeliveryFee: number;
4810
+ expectedRefundAmount: number | null;
4811
+ exchangeOption: {
4812
+ optionId: string;
4813
+ optionName: string;
4814
+ } | null;
4815
+ collect: {
4816
+ method: "SELLER_PICKUP" | "BUYER_SEND";
4817
+ carrierCode: string | null;
4818
+ trackingNumber: string | null;
4819
+ } | null;
4820
+ requestedAt: string;
4821
+ completedAt: string | null;
4822
+ holdExpiresAt: string | null;
4823
+ holdUsed: boolean;
4824
+ }>;
4642
4825
  };
4643
4826
  inquiries: {
4644
4827
  list: (params?: PageParams & {
@@ -4993,7 +5176,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
4993
5176
  }>;
4994
5177
  };
4995
5178
  /**
4996
- * 방문 분석 — 스코프 `analytics:r`. 스토어프런트가 `@sayren/storefront-sdk`로 수집한 이벤트를 Asia/Seoul 날짜별로
5179
+ * 방문 분석 — 스코프 `analytics:r`. 스토어프론트가 `@sayren/storefront-sdk`로 수집한 이벤트를 Asia/Seoul 날짜별로
4997
5180
  * 집계한 값이다. 집계는 주기적으로 갱신되고 응답 `lastComputedAt`이 마지막 집계 시각이다. 봇 세션은 빠진다.
4998
5181
  * 기간은 양끝 포함 최대 92일이고, 테스트 결제 구매는 `includeTest: "true"`일 때만 포함한다.
4999
5182
  */
@@ -5038,6 +5221,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
5038
5221
  conversionRate: number | null;
5039
5222
  date: string;
5040
5223
  }[];
5224
+ excludedBotSessions: number;
5041
5225
  from: string;
5042
5226
  to: string;
5043
5227
  timezone: "Asia/Seoul";
@@ -5059,6 +5243,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
5059
5243
  quantity: number;
5060
5244
  revenue: number;
5061
5245
  purchaseRate: number | null;
5246
+ clickThroughRate: number | null;
5062
5247
  }[];
5063
5248
  from: string;
5064
5249
  to: string;
@@ -5091,6 +5276,101 @@ export declare function createStoreClient(options: StoreClientOptions): {
5091
5276
  includeTest: boolean;
5092
5277
  lastComputedAt: string | null;
5093
5278
  }>;
5279
+ /** `GET /v1/analytics/realtime` — 최근 5분 방문자·세션·페이지(원본 이벤트 기준, 봇 제외) */
5280
+ realtime: () => Promise<{
5281
+ asOf: string;
5282
+ windowMinutes: 5;
5283
+ visitors: number;
5284
+ sessions: number;
5285
+ pageViews: number;
5286
+ pages: {
5287
+ path: string;
5288
+ visitors: number;
5289
+ pageViews: number;
5290
+ }[];
5291
+ }>;
5292
+ /** `GET /v1/analytics/devices` — 기기별 세션 퍼널 */
5293
+ devices: (params: AnalyticsRangeParams) => Promise<{
5294
+ rows: {
5295
+ device: "unknown" | "desktop" | "mobile" | "tablet";
5296
+ sessions: number;
5297
+ productViewSessions: number;
5298
+ addToCartSessions: number;
5299
+ beginCheckoutSessions: number;
5300
+ purchaseSessions: number;
5301
+ conversionRate: number | null;
5302
+ }[];
5303
+ from: string;
5304
+ to: string;
5305
+ timezone: "Asia/Seoul";
5306
+ currency: "KRW";
5307
+ includeTest: boolean;
5308
+ lastComputedAt: string | null;
5309
+ }>;
5310
+ /** `GET /v1/analytics/pages` — 첫 페이지(진입·반송)와 이탈 페이지 */
5311
+ pages: (params: AnalyticsPagesParams) => Promise<{
5312
+ landings: {
5313
+ path: string;
5314
+ entrances: number;
5315
+ bounces: number;
5316
+ bounceRate: number | null;
5317
+ }[];
5318
+ exits: {
5319
+ path: string;
5320
+ pageViews: number;
5321
+ exits: number;
5322
+ exitRate: number | null;
5323
+ }[];
5324
+ from: string;
5325
+ to: string;
5326
+ timezone: "Asia/Seoul";
5327
+ currency: "KRW";
5328
+ includeTest: boolean;
5329
+ lastComputedAt: string | null;
5330
+ }>;
5331
+ /** `GET /v1/analytics/search` — 검색어별 검색·결과 0개·검색 후 구매 */
5332
+ search: (params: AnalyticsSearchParams) => Promise<{
5333
+ summary: {
5334
+ searches: number;
5335
+ zeroResultSearches: number;
5336
+ searchSessions: number;
5337
+ purchaseSessions: number;
5338
+ conversionRate: number | null;
5339
+ };
5340
+ terms: {
5341
+ term: string;
5342
+ searches: number;
5343
+ zeroResultSearches: number;
5344
+ searchSessions: number;
5345
+ purchaseSessions: number;
5346
+ conversionRate: number | null;
5347
+ }[];
5348
+ zeroResultTerms: {
5349
+ term: string;
5350
+ searches: number;
5351
+ zeroResultSearches: number;
5352
+ }[];
5353
+ from: string;
5354
+ to: string;
5355
+ timezone: "Asia/Seoul";
5356
+ currency: "KRW";
5357
+ includeTest: boolean;
5358
+ lastComputedAt: string | null;
5359
+ }>;
5360
+ /** `GET /v1/analytics/checkout` — 결제 세션의 결과별 수(결제 단계 이탈 이유) */
5361
+ checkout: (params: AnalyticsRangeParams) => Promise<{
5362
+ sessions: number;
5363
+ outcomes: {
5364
+ outcome: "OTHER" | "COMPLETED" | "NOT_OPENED" | "USER_CANCELED" | "DECLINED" | "PREPARE_FAILURE" | "IN_PROGRESS";
5365
+ sessions: number;
5366
+ }[];
5367
+ from: string;
5368
+ to: string;
5369
+ timezone: "Asia/Seoul";
5370
+ currency: "KRW";
5371
+ includeTest: boolean;
5372
+ lastComputedAt: string | null;
5373
+ }>;
5094
5374
  };
5095
5375
  /**
5096
5376
  * 결제 내역 — 스코프 `settlement:r`. 결제 건(세션) 단위이고 주문 목록과 다르다. 주문이 만들어지지 않은
@@ -6124,7 +6404,7 @@ export declare function createStoreClient(options: StoreClientOptions): {
6124
6404
  }>;
6125
6405
  /**
6126
6406
  * `PATCH /v1/store` — 스코프 `store:rw`. 바꿀 필드만 보낸다. `analyticsAllowedOrigins`는 방문 분석 수집을 받을
6127
- * 스토어프런트 오리진 목록이다(빈 배열이면 모든 오리진 허용).
6407
+ * 스토어프론트 오리진 목록이다(빈 배열이면 모든 오리진 허용).
6128
6408
  */
6129
6409
  update: (body: UpdateStoreRequest) => Promise<{
6130
6410
  storeId: string;