@tossplace/pos-plugin-sdk 0.0.26 → 0.0.28

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/types/index.d.ts CHANGED
@@ -60,7 +60,7 @@ export declare type CashReceipt = {
60
60
  orderId: string;
61
61
  /** 현금영수증 발행 금액입니다 */
62
62
  amount: number;
63
- /** 현금영수증 발행 날짜입니다 yyyyMMddHHmmss */
63
+ /** 현금영수증 발행 날짜입니다 yyyy-MM-ddTHH:mm:ss */
64
64
  issueDate: string;
65
65
  /** 현금영수증 발행 번호입니다 */
66
66
  issueNumber: string;
@@ -82,8 +82,19 @@ export declare interface Catalog {
82
82
  getCatalog: (catalogId: number) => Promise<PluginCatalogItem>;
83
83
  getCatalogs: () => Promise<PluginCatalogItem[]>;
84
84
  on(event: 'update' | 'add' | 'delete', callback: CatalogEventCallback): void;
85
+ on(event: 'before-add', callback: CatalogBeforeAddCallback): void;
85
86
  }
86
87
 
88
+ /**
89
+ * @publicApi
90
+ */
91
+ export declare type CatalogBeforeAddCallback = (payload: {
92
+ payload: Partial<PluginCatalogItemDto>;
93
+ ui: Ui;
94
+ }) => Promise<{
95
+ initialValue?: PluginCatalogItemDto;
96
+ }>;
97
+
87
98
  declare type CatalogEventCallback = (id: PluginCatalogItem['id']) => void;
88
99
 
89
100
  /**
@@ -163,11 +174,23 @@ export declare interface DeliveryCatalogOption {
163
174
  */
164
175
  export declare type DeliveryConnectionStatusErrorCode = 'BMPC_NOT_RUNNING' | 'NOT_RUNNING' | 'BMPC_NOT_LOGGED_IN' | 'NOT_LOGGED_IN' | 'BMPC_UNKNOWN' | 'UNKNOWN' | 'BAEMIN_NOT_SELECTED_PROGRAM' | string;
165
176
 
177
+ /**
178
+ * @publicApi
179
+ */
180
+ export declare interface DeliveryDispatch {
181
+ on(event: 'update', callback: (payload: DispatchChangePayload) => void): void;
182
+ getDispatch(params: {
183
+ orderId: PluginOrder['id'];
184
+ }): Promise<Dispatch | null>;
185
+ }
186
+
166
187
  /**
167
188
  * @publicApi
168
189
  */
169
190
  export declare type DeliveryItemStatus = 'sold-out' | 'hide' | 'active' | 'invisible';
170
191
 
192
+ /* Excluded from this release type: DeliveryOperationStatus */
193
+
171
194
  declare type DeliveryOrder = Order_2 & {
172
195
  type: 'DELIVERY';
173
196
  /**
@@ -186,6 +209,8 @@ declare type DeliveryOrder = Order_2 & {
186
209
  status: DeliveryStatus;
187
210
  };
188
211
 
212
+ /* Excluded from this release type: DeliveryPauseDuration */
213
+
189
214
  /**
190
215
  * @publicApi
191
216
  */
@@ -198,6 +223,41 @@ export declare interface Device {
198
223
  getDeviceInfo(): Promise<DeviceInfo>;
199
224
  }
200
225
 
226
+ /**
227
+ * @publicApi
228
+ */
229
+ declare type DeviceBusinessType = {
230
+ business: {
231
+ type: 'CAFE' | 'RESTAURANT';
232
+ };
233
+ operation: {
234
+ payment: {
235
+ type: 'PAY_FIRST' | 'PAY_LATER';
236
+ };
237
+ table: {
238
+ enabled: boolean;
239
+ };
240
+ booking: {
241
+ enabled: boolean;
242
+ };
243
+ };
244
+ } | {
245
+ business: {
246
+ type: 'RETAIL' | 'SERVICE';
247
+ };
248
+ operation: {
249
+ payment: {
250
+ type: 'PAY_FIRST';
251
+ };
252
+ table: {
253
+ enabled: false;
254
+ };
255
+ booking: {
256
+ enabled: boolean;
257
+ };
258
+ };
259
+ };
260
+
201
261
  /**
202
262
  * @publicApi
203
263
  */
@@ -216,41 +276,50 @@ export declare type DeviceInfo = {
216
276
  * Windows와 macos에서만 지원됩니다
217
277
  */
218
278
  osVersion?: string;
219
- businessType: {
220
- business: {
221
- type: 'CAFE' | 'RESTAURANT';
222
- };
223
- operation: {
224
- payment: {
225
- type: 'PAY_FIRST' | 'PAY_LATER';
226
- };
227
- table: {
228
- enabled: boolean;
229
- };
230
- booking: {
231
- enabled: boolean;
232
- };
233
- };
234
- } | {
235
- business: {
236
- type: 'RETAIL' | 'SERVICE';
237
- };
238
- operation: {
239
- payment: {
240
- type: 'PAY_FIRST';
241
- };
242
- table: {
243
- enabled: false;
244
- };
245
- booking: {
246
- enabled: boolean;
247
- };
248
- };
249
- };
279
+ /**
280
+ * @deprecated device.setting.request의 DeviceSetting을 사용해주세요
281
+ */
282
+ businessType: DeviceBusinessType;
250
283
  };
251
284
 
252
285
  declare type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
253
286
 
287
+ /**
288
+ * @publicApi
289
+ */
290
+ export declare interface Dispatch {
291
+ dispatchId: number;
292
+ orderId: string;
293
+ status: DispatchStatus;
294
+ riderStatus: DispatchDeliveryStatus;
295
+ provider: DispatchProvider;
296
+ }
297
+
298
+ /**
299
+ * @publicApi
300
+ */
301
+ export declare type DispatchChangePayload = Pick<Dispatch, 'orderId' | 'dispatchId'>;
302
+
303
+ /**
304
+ * @publicApi
305
+ */
306
+ export declare type DispatchDeliveryStatus = 'NOT_ALLOCATION' | 'ASSIGNED' | 'PICKUP_COMPLETED' | 'DELIVERY_COMPLETED';
307
+
308
+ /**
309
+ * @publicApi
310
+ */
311
+ export declare interface DispatchProvider {
312
+ type: 'SELF' | 'AGENCY';
313
+ id: number;
314
+ code: string;
315
+ name: string;
316
+ }
317
+
318
+ /**
319
+ * @publicApi
320
+ */
321
+ export declare type DispatchStatus = 'WAITING_ALLOCATION' | 'ALLOCATION_COMPLETED' | 'CANCEL_WAITING' | 'CANCEL_COMPLETED' | 'COMPLETED';
322
+
254
323
  /**
255
324
  * @publicApi
256
325
  */
@@ -445,12 +514,13 @@ declare type MovePayload = {
445
514
  export declare interface Navigation {
446
515
  navigate(page: 'plugin-tab', packageName?: string): void;
447
516
  navigate(page: 'business-type-setting'): void;
517
+ navigate(page: 'delivery-connection'): void;
448
518
  /**
449
519
  * 포스에서 페이지를 이동합니다.
450
- * @param page business-type-setting 업종유형 변경, plugin-tab 플러그인 탭 이동
520
+ * @param page business-type-setting 업종유형 변경, delivery-connection 설정 > 배달앱, plugin-tab 플러그인 탭 이동
451
521
  * @param packageName 이동할 탭의 이름, 없는 경우 첫번째 플러그인 탭으로 이동합니다
452
522
  */
453
- navigate(page: 'business-type-setting' | 'plugin-tab', packageName?: string): void;
523
+ navigate(page: 'business-type-setting' | 'delivery-connection' | 'plugin-tab', packageName?: string): void;
454
524
  }
455
525
 
456
526
  /**
@@ -459,6 +529,7 @@ export declare interface Navigation {
459
529
  export declare class NavigationImpl implements Navigation {
460
530
  navigate(page: 'plugin-tab', packageName?: string): void;
461
531
  navigate(page: 'business-type-setting'): void;
532
+ navigate(page: 'delivery-connection'): void;
462
533
  }
463
534
 
464
535
  /**
@@ -586,6 +657,7 @@ declare type PayCallback = (order: PluginOrder, price: PluginPrice, ui: Ui) => P
586
657
  export declare interface Payment {
587
658
  on(event: 'cancel' | 'paid', callback: PaymentCallback): void;
588
659
  on(event: 'before-cancel', callback: PaymentBeforeCancelCallback): void;
660
+ on(event: 'before-cancel-all', callback: PaymentBeforeCancelAllCallback): void;
589
661
  cancel: (order: {
590
662
  id: string;
591
663
  }, payment: {
@@ -597,6 +669,14 @@ export declare interface Payment {
597
669
  getPayment: (paymentId: PluginPayment['id']) => Promise<PluginPayment>;
598
670
  }
599
671
 
672
+ /**
673
+ * @publicApi
674
+ */
675
+ export declare type PaymentBeforeCancelAllCallback = (payload: {
676
+ order: PluginOrder;
677
+ payments: PluginPayment[];
678
+ }) => Promise<void>;
679
+
600
680
  /**
601
681
  * @publicApi
602
682
  */
@@ -931,6 +1011,7 @@ export declare interface PluginCatalogItemOption {
931
1011
  export declare interface PluginCatalogItemOptionChoice {
932
1012
  id: number;
933
1013
  title: string;
1014
+ code?: string;
934
1015
  titleI18n?: PluginLanguagePack;
935
1016
  /** 옵션에 딸린 가격이 없는 경우 0 */
936
1017
  priceValue: number;
@@ -1036,8 +1117,7 @@ export declare type PluginDeliveryOrderDtoV2 = Omit<PluginOrderDto, 'lineItems'
1036
1117
  delivery: PluginDelivery<'DELIVERY' | 'PICKUP' | 'HERE'>;
1037
1118
  discounts: Array<PluginDeliveryDiscount>;
1038
1119
  lineItems: Array<Omit<PluginOrderItem, 'id' | 'orderId' | 'item' | 'optionChoices' | 'discounts' | 'chargePrice'> & {
1039
- item: {
1040
- title: string;
1120
+ item: Pick<PluginCatalogItem, 'title' | 'code'> & {
1041
1121
  type: 'ITEM' | 'DELIVERY_FEE';
1042
1122
  };
1043
1123
  /**
@@ -1046,9 +1126,7 @@ export declare type PluginDeliveryOrderDtoV2 = Omit<PluginOrderDto, 'lineItems'
1046
1126
  itemPrice: {
1047
1127
  value: number;
1048
1128
  };
1049
- optionChoices: Array<{
1050
- title: string;
1051
- priceValue: number;
1129
+ optionChoices: Array<Pick<PluginCatalogItemOptionChoice, 'title' | 'code' | 'priceValue'> & {
1052
1130
  quantity: number;
1053
1131
  }>;
1054
1132
  discounts?: Array<PluginDeliveryDiscount>;
@@ -1180,6 +1258,22 @@ declare interface PluginExternalDto extends PluginPaymentDtoBase {
1180
1258
  sourceType: 'EXTERNAL';
1181
1259
  }
1182
1260
 
1261
+ /**
1262
+ * @publicApi
1263
+ */
1264
+ declare interface PluginExternalLoyaltyPointDetails {
1265
+ source: '제휴사포인트';
1266
+ sourceId: 'EXTERNAL_LOYALTY_POINT';
1267
+ /** 제휴사 구분자 */
1268
+ provider: 'OKCASHBAG' | 'LPOINT';
1269
+ /** 포인트 카드 번호 */
1270
+ code: string;
1271
+ approvalNo: string;
1272
+ amount: number;
1273
+ /** 포인트 잔액 */
1274
+ balance: number;
1275
+ }
1276
+
1183
1277
  /**
1184
1278
  * @publicApi
1185
1279
  */
@@ -1331,6 +1425,26 @@ export declare interface PluginLanguagePack {
1331
1425
  languages: Partial<Languages>;
1332
1426
  }
1333
1427
 
1428
+ /**
1429
+ * @publicApi
1430
+ */
1431
+ declare interface PluginMobileVoucherDetails {
1432
+ /** 상품권 소스 */
1433
+ source: '모바일 상품권' | string;
1434
+ /** 상품권 구분자 */
1435
+ sourceId: 'MOBILE_VOUCHER' | string;
1436
+ /** 상품권 번호 */
1437
+ code: string;
1438
+ /** 상품권 발행사 */
1439
+ provider?: 'COOP_MARKETING' | 'KPC' | 'UNKNOWN' | '페이코' | string;
1440
+ approvalNo?: string;
1441
+ amount?: number;
1442
+ /** 상품권 PIN (오프라인 상품권이나 PIN 입력이 강제되는 온라인 상품권의 경우에만 사용) */
1443
+ pin?: string;
1444
+ /** 상품권 잔액 */
1445
+ balance?: number;
1446
+ }
1447
+
1334
1448
  /**
1335
1449
  * @publicApi
1336
1450
  * @description pluginOrder orderDto를 서버에 저장 후 가공해서 내려 준 값
@@ -1540,7 +1654,7 @@ export declare type PluginOrderState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'C
1540
1654
  /**
1541
1655
  * @publicApi
1542
1656
  */
1543
- export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment | PluginAccountTransferPayment | PluginBarcodePayment) & {
1657
+ export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment | PluginAccountTransferPayment | PluginBarcodePayment | PluginPrepaidValuePayment) & {
1544
1658
  paymentKey: string;
1545
1659
  };
1546
1660
 
@@ -1638,14 +1752,29 @@ export declare type PluginPaymentOf<S extends PluginPaymentSourceType> = Extract
1638
1752
  * CASH: 현금
1639
1753
  * BARCODE: 바코드/QR을 사용하는 간편결제
1640
1754
  * EXTERNAL: 기타결제(쿠폰, 외상 등)
1755
+ * PREPAID_VALUE: 상품권/제휴사포인트
1641
1756
  */
1642
- export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL' | 'BARCODE' | 'ACCOUNT_TRANSFER';
1757
+ export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL' | 'BARCODE' | 'ACCOUNT_TRANSFER' | 'PREPAID_VALUE';
1643
1758
 
1644
1759
  /**
1645
1760
  * @publicApi
1646
1761
  */
1647
1762
  export declare type PluginPaymentState = 'APPROVED' | 'COMPLETED' | 'CANCELLED';
1648
1763
 
1764
+ /**
1765
+ * @publicApi
1766
+ */
1767
+ declare type PluginPrepaidValueDetails = PluginMobileVoucherDetails | PluginExternalLoyaltyPointDetails;
1768
+
1769
+ /**
1770
+ * @publicApi
1771
+ * 상품권/제휴사포인트 결제
1772
+ */
1773
+ declare interface PluginPrepaidValuePayment extends PluginPaymentBase {
1774
+ sourceType: 'PREPAID_VALUE';
1775
+ prepaidValueDetails: PluginPrepaidValueDetails;
1776
+ }
1777
+
1649
1778
  /**
1650
1779
  * @publicApi
1651
1780
  */
@@ -1762,6 +1891,9 @@ export declare type PosPluginSdk = {
1762
1891
  kdsOrder: KdsOrder;
1763
1892
  pluginUnicast: PluginUnicastTypes;
1764
1893
  navigation: Navigation;
1894
+ delivery: {
1895
+ dispatch: DeliveryDispatch;
1896
+ };
1765
1897
  };
1766
1898
 
1767
1899
  /**
@@ -1793,14 +1925,20 @@ export declare const PosRateLimiter: () => MethodDecorator;
1793
1925
  export declare type PowerSaverTypes = {
1794
1926
  /**
1795
1927
  * 절전모드 방지를 시작합니다.
1928
+ *
1929
+ * windows, macos에서만 지원되며, 그 외 플랫폼에서는 에러가 발생합니다.
1796
1930
  */
1797
1931
  startBlocking(): Promise<void>;
1798
1932
  /**
1799
1933
  * 절전모드 방지를 해제합니다.
1934
+ *
1935
+ * windows, macos에서만 지원되며, 그 외 플랫폼에서는 에러가 발생합니다.
1800
1936
  */
1801
1937
  stopBlocking(): Promise<void>;
1802
1938
  /**
1803
1939
  * 절전모드 방지가 활성화 상태인지 확인합니다.
1940
+ *
1941
+ * windows, macos에서만 지원되며, 그 외 플랫폼에서는 에러가 발생합니다.
1804
1942
  */
1805
1943
  isBlocked(): Promise<boolean>;
1806
1944
  };
@@ -1998,7 +2136,7 @@ declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof Obje
1998
2136
  /**
1999
2137
  * @publicApi
2000
2138
  */
2001
- export declare type VanType = 'NICE' | 'KIS' | 'SMARTRO' | 'KOVAN';
2139
+ export declare type VanType = 'NICE' | 'KIS' | 'SMARTRO' | 'KOVAN' | 'DAOU' | 'KSNET' | 'SECTA9' | 'KPN' | 'KOCES';
2002
2140
 
2003
2141
  /**
2004
2142
  * @publicApi