@tossplace/pos-plugin-sdk 0.0.5 → 0.0.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/sdk.d.ts CHANGED
@@ -1,19 +1,19 @@
1
- declare type AllPaymentCreateDto = PluginCardDto | PluginCashDto | PluginExternalDto;
2
-
3
- declare type AllPopupElements = BarcodeElements;
4
-
5
- declare type AllPopupResponse = BarcodeResponse;
1
+ import { WebView } from '@tossplace-nexus/pos-webview';
6
2
 
7
- /**
8
- * @publicApi
9
- */
10
- declare type AllPopupType = AllPopupElements['type'];
3
+ declare type AllPaymentCreateDto = PluginCardDto | PluginCashDto | PluginExternalDto;
11
4
 
12
5
  declare const AvailableLanguageCodes: {
13
6
  readonly Korean: "ko-KR";
14
7
  readonly English: "en-US";
15
8
  };
16
9
 
10
+ declare interface Barcode {
11
+ send(barcode: string): Promise<void>;
12
+ on(event: 'scan', callback: (barcode: string) => void): void;
13
+ useBarcodeScan(): void;
14
+ unUseBarcodeScan(): void;
15
+ }
16
+
17
17
  /**
18
18
  */
19
19
  declare type BarcodeElements = {
@@ -37,12 +37,12 @@ declare type BarcodeResponse = {
37
37
  };
38
38
 
39
39
  declare type BaseInput = {
40
+ id: string;
40
41
  label: string;
41
42
  required: boolean;
42
- id: string;
43
43
  };
44
44
 
45
- declare type CancelCallback = (order: PluginOrder, payment: PluginPayment) => Promise<PluginCancelledPaymentDto | undefined>;
45
+ declare type CancelCallback = (order: PluginOrder, payment: PluginPayment, ui: Ui) => Promise<PluginCancelledPaymentDto | undefined>;
46
46
 
47
47
  /**
48
48
  * @schema
@@ -61,7 +61,10 @@ export declare type CashReceipt = {
61
61
  cardNumber: string;
62
62
  };
63
63
 
64
- declare interface CashReceiptTypes {
64
+ /**
65
+ * @publicApi
66
+ */
67
+ export declare interface CashReceiptTypes {
65
68
  add: (receipt: CashReceipt) => Promise<void>;
66
69
  }
67
70
 
@@ -69,10 +72,18 @@ declare interface CashReceiptTypes {
69
72
  * @publicApi
70
73
  */
71
74
  export declare interface Catalog {
75
+ getCatalog: (catalogId: number) => Promise<PluginCatalogItem>;
72
76
  getCatalogs: () => Promise<PluginCatalogItem[]>;
73
- on: (event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: (menu: PluginCatalogItem) => void) => void;
77
+ on(event: 'update' | 'add' | 'delete', callback: CatalogEventCallback): void;
78
+ /**
79
+ * @deprecated 다음 버전에서 제거 예정입니다
80
+ */
81
+ on(event: 'sold-out' | 'on-sale', callback: CatalogEventCallback): void;
82
+ on(event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: CatalogEventCallback): void;
74
83
  }
75
84
 
85
+ declare type CatalogEventCallback = (catalog: PluginCatalogItem) => void;
86
+
76
87
  /**
77
88
  * @publicApi
78
89
  */
@@ -83,10 +94,12 @@ export declare type CatalogItemOptionChoiceState = 'ON_SALE' | 'SOLD_OUT';
83
94
  */
84
95
  export declare interface CategoryTypes {
85
96
  getCategories: () => Promise<PluginCatalogCategory[]>;
97
+ getCategory: (categoryId: number) => Promise<PluginCatalogCategory>;
86
98
  on: (event: 'update' | 'add' | 'delete', callback: (category: PluginCatalogCategory) => void) => void;
87
99
  }
88
100
 
89
101
  /**
102
+ * @publicApi
90
103
  * @return 선택된 values id의 배열 string[]
91
104
  * @example ['option1', 'option2']
92
105
  */
@@ -99,7 +112,22 @@ declare type CheckBoxInput = Omit<BaseInput, 'placeholder'> & {
99
112
  values: InputValue[];
100
113
  };
101
114
 
102
- declare type DeliveryOrder = Order & {
115
+ /**
116
+ * @publicApi
117
+ */
118
+ declare type CtaInput = {
119
+ type: 'cta';
120
+ id: string;
121
+ text: string;
122
+ ctaType: 'primary' | 'danger' | 'dark';
123
+ };
124
+
125
+ /**
126
+ * @publicApi
127
+ */
128
+ export declare type DeliveryConnectionStatusErrorCode = 'NOT_RUNNING' | 'NOT_LOGGED_IN' | 'UNKNOWN' | 'BAEMIN_NOT_SELECTED_PROGRAM';
129
+
130
+ declare type DeliveryOrder = Order_2 & {
103
131
  type: 'DELIVERY';
104
132
  /**
105
133
  * 배달 주체
@@ -122,8 +150,85 @@ declare type DeliveryOrder = Order & {
122
150
  */
123
151
  declare type DeliveryStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLED' | 'CANCELLED' | 'RIDER_ASSIGNED' | 'RIDER_ARRIVE_SOON' | 'RIDER_PICKUP_COMPLETED' | 'DONE';
124
152
 
153
+ /**
154
+ * @publicApi
155
+ */
156
+ export declare interface Device {
157
+ getDeviceInfo(): Promise<DeviceInfo>;
158
+ }
159
+
160
+ /**
161
+ * @publicApi
162
+ */
163
+ export declare type DeviceInfo = {
164
+ name: string;
165
+ version: string;
166
+ platform: Platform;
167
+ arch: string;
168
+ /**
169
+ * 포스 고유번호
170
+ */
171
+ serialNumber: string;
172
+ /**
173
+ * os 버전을 가져옵니다.
174
+ * https://www.electronjs.org/docs/latest/api/process#processgetsystemversion
175
+ * Windows와 macos에서만 지원됩니다
176
+ */
177
+ osVersion?: string;
178
+ businessType: {
179
+ business: {
180
+ type: 'CAFE' | 'RESTAURANT';
181
+ };
182
+ operation: {
183
+ payment: {
184
+ type: 'PAY_FIRST' | 'PAY_LATER';
185
+ };
186
+ table: {
187
+ enabled: boolean;
188
+ };
189
+ booking: {
190
+ enabled: boolean;
191
+ };
192
+ };
193
+ } | {
194
+ business: {
195
+ type: 'RETAIL' | 'SERVICE';
196
+ };
197
+ operation: {
198
+ payment: {
199
+ type: 'PAY_FIRST';
200
+ };
201
+ table: {
202
+ enabled: false;
203
+ };
204
+ booking: {
205
+ enabled: boolean;
206
+ };
207
+ };
208
+ };
209
+ };
210
+
125
211
  declare type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
126
212
 
213
+ /**
214
+ * @publicApi
215
+ */
216
+ export declare interface DraftOrder {
217
+ clear(): Promise<void>;
218
+ get(): Promise<PluginDraftOrder>;
219
+ addLineItem(lineItem: PluginDraftOrderItemDto): Promise<PluginDraftOrder>;
220
+ deleteLineItem(itemKey: string): Promise<PluginDraftOrder>;
221
+ updateItemQuantity(itemKey: string, quantity: number): Promise<PluginDraftOrder>;
222
+ updateItemOptionChoice(itemKey: string, choices: PluginCatalogItemOptionChoice[]): Promise<PluginDraftOrder>;
223
+ updateItemMemo(itemKey: string, memo: string): Promise<PluginDraftOrder>;
224
+ updateIgnorePrint(ignorePrint: boolean): Promise<PluginDraftOrder>;
225
+ deleteDiscount(indexOfDiscount: number): Promise<PluginDraftOrder>;
226
+ deleteItemDiscount(itemKey: string, indexOfDiscount: number): Promise<PluginDraftOrder>;
227
+ startPayment(): Promise<void>;
228
+ }
229
+
230
+ declare type Element_2 = BarcodeElements | InputElements;
231
+
127
232
  /**
128
233
  * @publicApi
129
234
  */
@@ -192,7 +297,10 @@ declare type FFIFunctionParam = {
192
297
  */
193
298
  declare type FFIFunctionReturn = 'void' | 'str' | 'int' | 'bool' | 'wchar *' | 'void *';
194
299
 
195
- declare interface FFITypes {
300
+ /**
301
+ * @publicApi
302
+ */
303
+ export declare interface FFITypes {
196
304
  download: (downloadInfo: FFIDownloadInfo) => Promise<{
197
305
  platform: keyof FFIDownloadInfo;
198
306
  }>;
@@ -206,14 +314,9 @@ declare interface FFITypes {
206
314
  addCallbackErrorHandler: (filePath: string, handler: (error: Error) => void) => void;
207
315
  }
208
316
 
209
- declare function getPluginInfo(): Promise<{
210
- name: string;
211
- version: string;
212
- }>;
213
-
214
317
  declare function getValues<T extends Record<string, number | string | string[] | boolean | undefined>>(): Promise<T>;
215
318
 
216
- declare type HereOrder = Order & {
319
+ declare type HereOrder = Order_2 & {
217
320
  type: 'HERE';
218
321
  memo: {
219
322
  store?: string;
@@ -246,6 +349,35 @@ export declare interface HttpTypes {
246
349
  patch: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
247
350
  }
248
351
 
352
+ declare type InputElements = {
353
+ type: 'input';
354
+ inputs: PluginInputs[];
355
+ title: string;
356
+ description?: string;
357
+ cta: {
358
+ cancel?: CtaInput;
359
+ submit: CtaInput;
360
+ };
361
+ };
362
+
363
+ declare type InputResponse = {
364
+ type: 'input';
365
+ complete: true;
366
+ data: {
367
+ inputs: Record<string, string | number | boolean | string[]>;
368
+ result: 'SUCCESS';
369
+ } | {
370
+ result: 'CANCELLED';
371
+ };
372
+ } | {
373
+ type: 'input';
374
+ complete: false;
375
+ errorMessage: string;
376
+ };
377
+
378
+ /**
379
+ * @publicApi
380
+ */
249
381
  declare type InputValue = {
250
382
  id: string;
251
383
  label: string;
@@ -260,19 +392,91 @@ declare type Languages = Record<PluginLanguageCode, string>;
260
392
  */
261
393
  export declare interface MenuOption {
262
394
  getOptions: () => Promise<PluginCatalogItemOption[]>;
263
- on: (event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: (option: PluginCatalogItemOption) => void) => void;
395
+ getOption: (optionId: number) => Promise<PluginCatalogItemOption>;
396
+ /**
397
+ * @deprecated 다음 버전에서 제거 예정입니다
398
+ */
399
+ on(event: 'sold-out' | 'on-sale', callback: (option: PluginCatalogItemOption) => void): void;
400
+ on(event: 'update' | 'add' | 'delete', callback: (option: PluginCatalogItemOption) => void): void;
401
+ on(event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: (option: PluginCatalogItemOption) => void): void;
264
402
  }
265
403
 
266
404
  /**
267
405
  * @publicApi
268
406
  */
269
- export declare interface MerchantTypes {
407
+ export declare interface Merchant {
270
408
  getMerchant: () => Promise<TossMerchant>;
271
409
  }
272
410
 
273
- declare function on(event: 'close', callback: () => Promise<void>): void;
411
+ /**
412
+ * @publicApi
413
+ */
414
+ export declare interface Navigation {
415
+ navigate(page: 'plugin-tab', packageName?: string): void;
416
+ navigate(page: 'business-type-setting'): void;
417
+ /**
418
+ * 포스에서 페이지를 이동합니다.
419
+ * @param page business-type-setting 업종유형 변경, plugin-tab 플러그인 탭 이동
420
+ * @param packageName 이동할 탭의 이름, 없는 경우 첫번째 플러그인 탭으로 이동합니다
421
+ */
422
+ navigate(page: 'business-type-setting' | 'plugin-tab', packageName?: string): void;
423
+ }
424
+
425
+ /**
426
+ * @publicApi
427
+ */
428
+ export declare class NavigationImpl implements Navigation {
429
+ navigate(page: 'plugin-tab', packageName?: string): void;
430
+ navigate(page: 'business-type-setting'): void;
431
+ }
432
+
433
+ /**
434
+ * @publicApi
435
+ * @return number
436
+ */
437
+ declare type NumberInput = BaseInput & {
438
+ type: 'number';
439
+ default: number;
440
+ placeholder?: string;
441
+ suffix?: string;
442
+ /**
443
+ * @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
444
+ * @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
445
+ */
446
+ candidates?: {
447
+ text: string;
448
+ value: number;
449
+ }[];
450
+ };
451
+
452
+ /**
453
+ * @publicApi
454
+ */
455
+ export declare interface Order {
456
+ getOrder: (id: string) => Promise<PluginOrder>;
457
+ /**
458
+ * @param start yyyy-MM-dd
459
+ * @param end yyyy-MM-dd
460
+ * @description createdAt 기준으로 주문을 조회합니다
461
+ */
462
+ getOrders: (range: {
463
+ start: string;
464
+ end: string;
465
+ }) => Promise<PluginOrder[]>;
466
+ /**
467
+ * @deprecated
468
+ */
469
+ on(event: 'cancel', callback: (order: PluginOrder) => void): void;
470
+ cancel: (id: string) => Promise<void>;
471
+ add: (order: PluginOrderDto) => Promise<PluginOrder>;
472
+ /**
473
+ * 새로 추가 된 메뉴만 order에 넣으세요
474
+ */
475
+ addMenu: (orderId: string, order: PluginOrderDto) => Promise<PluginOrder>;
476
+ complete: (id: string) => Promise<PluginOrder>;
477
+ }
274
478
 
275
- declare type Order = {
479
+ declare type Order_2 = {
276
480
  /**
277
481
  * 포스(사장님)에게 보여줄 주문유형
278
482
  * @example 가게배달, 장보기/쇼핑, 픽업, 배민1 등등
@@ -318,23 +522,6 @@ declare type OrderItemType = 'ITEM' | 'DELIVERY_FEE' | 'PREPAID_CARD' | 'MULTI_U
318
522
 
319
523
  /**
320
524
  * @publicApi
321
- */
322
- export declare interface OrderTypes {
323
- getOrder: (id: string) => Promise<PluginOrder>;
324
- /**
325
- * 토스 포스에서 카드결제를 취소하면 무조건 카드리딩해야함 그래서 on cancel은 늘 환불까지 된 상태임
326
- */
327
- on: (event: 'cancel', callback: (order: PluginOrder) => void) => void;
328
- cancel: (id: string) => Promise<void>;
329
- add: (order: PluginOrderDto) => Promise<PluginOrder>;
330
- /**
331
- * 새로 추가 된 메뉴만 order에 넣으세요
332
- */
333
- addMenu: (orderId: string, order: PluginOrderDto) => Promise<PluginOrder>;
334
- complete: (id: string) => Promise<PluginOrder>;
335
- }
336
-
337
- /**
338
525
  * @return string
339
526
  */
340
527
  declare type PasswordInput = BaseInput & {
@@ -343,7 +530,25 @@ declare type PasswordInput = BaseInput & {
343
530
  placeholder?: string;
344
531
  };
345
532
 
346
- declare type PayCallback = (order: PluginOrder, price: PluginPrice) => Promise<PaymentMethodResponse | undefined>;
533
+ declare type PayCallback = (order: PluginOrder, price: PluginPrice, ui: Ui) => Promise<PaymentMethodResponse | undefined>;
534
+
535
+ /**
536
+ * @publicApi
537
+ */
538
+ export declare interface Payment {
539
+ on: (event: 'cancel' | 'paid', callback: PaymentCallback) => void;
540
+ cancel: (order: {
541
+ id: string;
542
+ }, payment: {
543
+ id: string;
544
+ }) => Promise<void>;
545
+ add: (order: {
546
+ id: string;
547
+ }, paymentDto: PluginPaymentDto) => Promise<PluginPaymentOf<'CARD'> | PluginPaymentOf<'CASH'> | PluginPaymentOf<'EXTERNAL'>>;
548
+ getPayment: (paymentId: PluginPayment['id']) => Promise<PluginPayment>;
549
+ }
550
+
551
+ declare type PaymentCallback = (payment: PluginPayment) => void;
347
552
 
348
553
  /**
349
554
  * @publicApi
@@ -359,7 +564,10 @@ export declare type PaymentMethodResponse = {
359
564
  paymentKey: string;
360
565
  };
361
566
 
362
- declare type PaymentMethodType = {
567
+ /**
568
+ * @publicApi
569
+ */
570
+ export declare type PaymentMethodType = {
363
571
  add: (payload: {
364
572
  data: {
365
573
  /**
@@ -379,19 +587,7 @@ declare type PaymentMethodType = {
379
587
  }) => void;
380
588
  };
381
589
 
382
- declare interface PaymentTypes {
383
- on: (event: 'cancel', callback: (payload: PluginPaymentOf<'CASH'> | PluginPaymentOf<'CARD'> | PluginPaymentOf<'EXTERNAL'>) => void) => void;
384
- cancel: (order: {
385
- id: string;
386
- }, payment: {
387
- id: string;
388
- }) => Promise<void>;
389
- add: (order: {
390
- id: string;
391
- }, paymentDto: PluginPaymentDto) => Promise<PluginPaymentOf<'CARD'> | PluginPaymentOf<'CASH'> | PluginPaymentOf<'EXTERNAL'>>;
392
- }
393
-
394
- declare type PickupOrder = Order & {
590
+ declare type PickupOrder = Order_2 & {
395
591
  type: 'PICKUP';
396
592
  memo: {
397
593
  store?: string;
@@ -400,10 +596,65 @@ declare type PickupOrder = Order & {
400
596
  status: StoreStatus;
401
597
  };
402
598
 
403
- declare const plugin: {
404
- on: typeof on;
405
- getPluginInfo: typeof getPluginInfo;
406
- };
599
+ /**
600
+ * @publicApi
601
+ */
602
+ declare type Platform = 'macos' | 'windows' | 'android' | 'ios' | 'unknown';
603
+
604
+ /**
605
+ * @publicApi
606
+ */
607
+ export declare const plugin: PluginImpl;
608
+
609
+ /**
610
+ * @publicApi
611
+ */
612
+ declare interface Plugin_2 {
613
+ on(event: 'close', callback: () => Promise<void>): void;
614
+ getPluginInfo(): Promise<{
615
+ name: string;
616
+ version: string;
617
+ }>;
618
+ }
619
+ export { Plugin_2 as Plugin }
620
+
621
+ /**
622
+ * @publicApi
623
+ */
624
+ declare interface PluginAccountTransferPayment extends PluginPaymentBase {
625
+ sourceType: 'ACCOUNT_TRANSFER';
626
+ /** 계좌이체 정보 */
627
+ accountTransfer: {
628
+ /** 은행코드 */
629
+ bankCode: number;
630
+ /** 계좌번호 */
631
+ accountNumber: string;
632
+ };
633
+ }
634
+
635
+ /**
636
+ * @publicApi
637
+ */
638
+ declare interface PluginBarcodePayment extends PluginPaymentBase {
639
+ sourceType: 'BARCODE';
640
+ externalDetails: {
641
+ installmentMonth: PluginPaymentInstallment;
642
+ /**
643
+ * 발급사명
644
+ * @example 토스페이, 네이버체크, 카카오페이머니, ...
645
+ */
646
+ source: string;
647
+ /**
648
+ * 간편결제 구분자
649
+ * @example KKF, SG2, ZRP, ...
650
+ */
651
+ sourceId: string;
652
+ sourceType?: PluginPaymentExternalSourceType;
653
+ /** 매입사명 */
654
+ cardBrand?: string;
655
+ cardNo?: string;
656
+ };
657
+ }
407
658
 
408
659
  /**
409
660
  * @publicApi
@@ -503,6 +754,10 @@ export declare interface PluginCatalogItem {
503
754
  * @description 토스 포스에 등록된 메뉴의 고유 아이디
504
755
  */
505
756
  id: number;
757
+ /**
758
+ * 플러그인에서 생성하면 토스포스 서버에 저장되어 항상 같이 내려옴
759
+ */
760
+ code?: string;
506
761
  /**
507
762
  * @description 포스 내에서 보여주는 타이틀
508
763
  * @description 사장님께만 보입니다
@@ -530,7 +785,7 @@ export declare interface PluginCatalogItem {
530
785
  * @description 메뉴에 달린 벳지입니다
531
786
  */
532
787
  labels: PluginCatalogItemLabel[];
533
- imageUrl: string | null;
788
+ imageUrl?: string;
534
789
  /**
535
790
  * @description 상품의 가격정보
536
791
  */
@@ -539,6 +794,13 @@ export declare interface PluginCatalogItem {
539
794
  * @description 상품에서 사용가능한 옵션 리스트
540
795
  */
541
796
  options: PluginCatalogItemOption[];
797
+ /** POS에서 상품 표시시 색상 정보 */
798
+ color?: string;
799
+ /** 제조 및 유통 정보 */
800
+ provenance?: {
801
+ /** 제조사 */
802
+ displayProvenance: string;
803
+ };
542
804
  }
543
805
 
544
806
  /**
@@ -554,14 +816,20 @@ export declare interface PluginCatalogItemDto {
554
816
  description?: string;
555
817
  descriptionI18n?: PluginLanguagePack;
556
818
  categoryId: number;
557
- price: PluginCatalogItemPrice;
819
+ price: PluginCatalogItemPriceDto;
558
820
  labels: PluginCatalogItemLabel[];
559
- imageUrl: string | null;
821
+ imageUrl?: string;
560
822
  /**
561
823
  * @description 옵션을 먼저 만들고 id를 넣어달라
562
824
  */
563
825
  options: Pick<PluginCatalogItemOption, 'id'>[];
564
- kioskTitle?: string;
826
+ /** POS에서 상품 표시시 색상 정보 */
827
+ color?: string;
828
+ /** 제조 및 유통 정보 */
829
+ provenance?: {
830
+ /** 제조사 */
831
+ displayProvenance: string;
832
+ };
565
833
  }
566
834
 
567
835
  /**
@@ -615,7 +883,6 @@ export declare interface PluginCatalogItemOptionChoice {
615
883
  * @publicApi
616
884
  */
617
885
  export declare interface PluginCatalogItemPrice {
618
- id: number;
619
886
  /** 상품 가격명 */
620
887
  title: string;
621
888
  /** 기본 가격 여부 */
@@ -626,9 +893,9 @@ export declare interface PluginCatalogItemPrice {
626
893
  * 재고 관리 코드
627
894
  * @see https://en.wikipedia.org/wiki/Stock_keeping_unit
628
895
  */
629
- sku: string | null;
896
+ sku?: string;
630
897
  /** 상품 가격의 바코드 정보 */
631
- barcode: string | null;
898
+ barcode?: string;
632
899
  /** 가격 유형 */
633
900
  priceType: PluginCatalogItemPriceType;
634
901
  /** 가격의 기본 개수 */
@@ -642,10 +909,30 @@ export declare interface PluginCatalogItemPrice {
642
909
  /** 재고 관리여부 */
643
910
  isStockable: boolean;
644
911
  /** 현재 남아있는 재고 수 */
645
- stockQuantity: {
912
+ stockQuantity?: {
646
913
  remainQuantity: number;
647
914
  lastChangeDateTime: string;
648
- } | null;
915
+ };
916
+ }
917
+
918
+ /**
919
+ * @publicApi
920
+ */
921
+ export declare interface PluginCatalogItemPriceDto {
922
+ /** 상품 가격명 */
923
+ title: string;
924
+ /** 상품 가격의 바코드 정보 */
925
+ barcode?: string;
926
+ /** 가격 유형 */
927
+ priceType: PluginCatalogItemPriceType;
928
+ /** 가격의 기본 개수 */
929
+ priceUnit: number;
930
+ /**
931
+ * 부가가치세(VAT)가 포함된 가격
932
+ */
933
+ priceValue: number;
934
+ /** 비과세 여부 */
935
+ isTaxFree: boolean;
649
936
  }
650
937
 
651
938
  /**
@@ -672,6 +959,34 @@ export declare type PluginDelivery<T extends 'PICKUP' | 'HERE' | 'DELIVERY'> = E
672
959
  type: T;
673
960
  }>;
674
961
 
962
+ /**
963
+ * @publicApi
964
+ * */
965
+ export declare interface PluginDeliveryDiscount extends PluginDiscount {
966
+ discountBy: 'OWNER' | 'PLATFORM';
967
+ }
968
+
969
+ /**
970
+ * @publicApi
971
+ * @description order를 만들기 위한 dto
972
+ */
973
+ export declare type PluginDeliveryOrderDto = Omit<PluginOrderDto, 'lineItems' | 'discounts'> & {
974
+ cancelled: boolean;
975
+ delivery: PluginDelivery<'DELIVERY' | 'PICKUP' | 'HERE'>;
976
+ discounts: Array<PluginDeliveryDiscount>;
977
+ lineItems: Array<Omit<PluginOrderItem, 'id' | 'orderId' | 'item' | 'optionChoices' | 'discounts'> & {
978
+ item: {
979
+ title: string;
980
+ type: 'ITEM' | 'DELIVERY_FEE';
981
+ };
982
+ optionChoices: Array<{
983
+ title: string;
984
+ priceValue: number;
985
+ }>;
986
+ discounts?: Array<PluginDeliveryDiscount>;
987
+ }>;
988
+ };
989
+
675
990
  /**
676
991
  * @publicApi
677
992
  * 할인 정보
@@ -689,6 +1004,107 @@ export declare interface PluginDiscount {
689
1004
  titleI18n?: PluginLanguagePack;
690
1005
  }
691
1006
 
1007
+ /**
1008
+ * @publicApi
1009
+ */
1010
+ export declare interface PluginDraftOrder {
1011
+ /**
1012
+ * 주문ID
1013
+ * 서버 주문을 클라이언트 주문으로 변경했을 때 값이 존재
1014
+ */
1015
+ id?: string;
1016
+ /** 주문 항목 목록 */
1017
+ lineItems: Array<PluginDraftOrderItem>;
1018
+ /** 주문 요청사항 */
1019
+ memo?: string;
1020
+ /** 주문에 적용된 할인 목록 */
1021
+ discounts: PluginDiscount[];
1022
+ price: PluginDraftOrderPrice;
1023
+ /**
1024
+ * 이 주문에 대해 프린트 출력을 무시할지 여부
1025
+ * 이 옵션이 켜져 있는 경우 다른 포스에서도 프린트 출력이 무시됩니다.
1026
+ * 기본값은 false입니다.
1027
+ */
1028
+ ignorePrint: boolean;
1029
+ /** 해당 주문의 테이블 인원 수 */
1030
+ numGuests?: number;
1031
+ }
1032
+
1033
+ /**
1034
+ * @publicApi
1035
+ */
1036
+ export declare interface PluginDraftOrderItem {
1037
+ /**
1038
+ * 넣지 않으면 자동으로 생성됨
1039
+ */
1040
+ key: string;
1041
+ /** 상품 정보 */
1042
+ item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'options' | 'code'> & {
1043
+ type: OrderItemType;
1044
+ };
1045
+ /** 상품 가격 정보 */
1046
+ itemPrice: Pick<PluginCatalogItemPrice, 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
1047
+ /** 적용된 할인 목록 */
1048
+ discount: PluginDiscount[];
1049
+ /** 요청사항 */
1050
+ memo: string;
1051
+ /** 선택된 옵션 정보 */
1052
+ optionChoices: PluginCatalogItemOptionChoice[];
1053
+ /** 수량 */
1054
+ quantity: number;
1055
+ /** 식사 유형 */
1056
+ diningOption: PluginOrderDiningOption;
1057
+ /**
1058
+ * 서버에서 생성된 lineItemId
1059
+ */
1060
+ lineItemId?: string;
1061
+ metadata?: {
1062
+ /**
1063
+ * true : 유저가 메모 수정 불가
1064
+ */
1065
+ disableMemoEdit?: boolean;
1066
+ /**
1067
+ * true : 유저가 옵션 수정 불가
1068
+ */
1069
+ disableOptionEdit?: boolean;
1070
+ /**
1071
+ * true : 유저가 수량 변경 불가
1072
+ */
1073
+ disableQuantityEdit?: boolean;
1074
+ };
1075
+ }
1076
+
1077
+ /**
1078
+ * @publicApi
1079
+ * @desription key는 넣으면 할당되고 없으면 포스에서 자동생성
1080
+ */
1081
+ declare type PluginDraftOrderItemDto = PluginDraftOrderItem & {
1082
+ key?: string;
1083
+ itemPrice: Pick<PluginCatalogItemPrice, 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
1084
+ };
1085
+
1086
+ declare interface PluginDraftOrderPrice {
1087
+ /** (-)할인 금액 */
1088
+ orderDiscountValue: number;
1089
+ /**
1090
+ * 원주문 금액
1091
+ * Σ OrderItem.orderPrice.orderListPriceValue
1092
+ */
1093
+ orderListPriceValue: number;
1094
+ /**
1095
+ * 주문 금액 = 원주문금액 + 할인 금액 + 보증금 + 봉사료
1096
+ *
1097
+ * @see 보증금: DraftOrder.bookingFee
1098
+ */
1099
+ orderPriceValue: number;
1100
+ /** 봉사료 */
1101
+ orderTipValue: number;
1102
+ }
1103
+
1104
+ /**
1105
+ * 밴을 통하지 않으면 바코드결제라고 해도 externalPayment로 처리해주세요
1106
+ * 취소를 플러그인에서 따로 처리해야하면 externalPayment로 처리해주세요
1107
+ */
692
1108
  declare interface PluginExternalDto extends PluginPaymentDtoBase {
693
1109
  sourceType: 'EXTERNAL';
694
1110
  }
@@ -734,18 +1150,23 @@ export declare type PluginHttpResponse = {
734
1150
  code: number;
735
1151
  };
736
1152
 
737
- /**
738
- * @publicApi
739
- * @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
740
- */
741
- export declare type PluginInputs<T extends PluginInputType = any> = Extract<TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput, {
742
- type: T;
743
- }>;
1153
+ declare class PluginImpl implements Plugin_2 {
1154
+ private readonly webview;
1155
+ private pluginCallbacks;
1156
+ constructor(webview: WebView);
1157
+ private initializePlugin;
1158
+ on(event: 'close', callback: () => Promise<void>): void;
1159
+ getPluginInfo(): Promise<{
1160
+ name: string;
1161
+ version: string;
1162
+ }>;
1163
+ }
744
1164
 
745
1165
  /**
746
1166
  * @publicApi
1167
+ * @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
747
1168
  */
748
- declare type PluginInputType = PluginInputs['type'];
1169
+ export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
749
1170
 
750
1171
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
751
1172
 
@@ -757,6 +1178,26 @@ export declare interface PluginLanguagePack {
757
1178
  languages: Partial<Languages>;
758
1179
  }
759
1180
 
1181
+ /**
1182
+ * @publicApi
1183
+ */
1184
+ export declare interface PluginMessenger {
1185
+ broadcast<T = any>(message: T): void;
1186
+ on<T = any>(event: 'message', callback: (message: T) => void): void;
1187
+ }
1188
+
1189
+ /**
1190
+ * @publicApi
1191
+ */
1192
+ export declare const pluginMessenger: PluginMessengerImpl;
1193
+
1194
+ declare class PluginMessengerImpl implements PluginMessenger {
1195
+ private readonly webview;
1196
+ constructor(webview: WebView);
1197
+ broadcast<T = any>(message: T): void;
1198
+ on<T = any>(event: 'message', callback: (message: T) => void): void;
1199
+ }
1200
+
760
1201
  /**
761
1202
  * @publicApi
762
1203
  * @description pluginOrder orderDto를 서버에 저장 후 가공해서 내려 준 값
@@ -782,11 +1223,17 @@ export declare interface PluginOrder {
782
1223
  paymentPrice: PluginOrderPaymentPrice;
783
1224
  requestedInfo?: PluginOrderRequestInfo;
784
1225
  source: string;
1226
+ /** 해당 주문의 테이블 인원 수 */
1227
+ numGuests?: number;
785
1228
  memo?: string;
786
1229
  /**
1230
+ * @description 주문시각
787
1231
  * 해당값이 있다면 createdAt 대신 사용해주세요.
788
1232
  */
789
1233
  openedAt?: string;
1234
+ /**
1235
+ * @description 생성시각
1236
+ */
790
1237
  createdAt: string;
791
1238
  updatedAt?: string;
792
1239
  cancelledAt?: string;
@@ -840,14 +1287,14 @@ export declare interface PluginOrderItem {
840
1287
  id: string;
841
1288
  orderId: string;
842
1289
  diningOption: PluginOrderDiningOption;
843
- item: Pick<PluginCatalogItem, 'id' | 'title' | 'category'> & {
1290
+ item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'code'> & {
844
1291
  type: OrderItemType;
845
1292
  };
846
1293
  quantity: {
847
1294
  value: number;
848
1295
  };
849
1296
  /**
850
- * @description 실제 고객이 결제하는 금액에 대한 정보입니다.
1297
+ * @description 실제 고객이 결제하는 금액에 대한 정보입니다. (할인 적용 금액)
851
1298
  */
852
1299
  chargePrice: {
853
1300
  value: number;
@@ -911,7 +1358,7 @@ export declare type PluginOrderState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'C
911
1358
  /**
912
1359
  * @publicApi
913
1360
  */
914
- export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment) & {
1361
+ export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment | PluginAccountTransferPayment | PluginBarcodePayment) & {
915
1362
  paymentKey: string;
916
1363
  };
917
1364
 
@@ -970,11 +1417,23 @@ export declare type PluginPaymentDto<S extends PluginPaymentSourceType = PluginP
970
1417
  sourceType: S;
971
1418
  }>;
972
1419
 
973
- declare type PluginPaymentDtoBase = Pick<PluginPayment,
1420
+ declare interface PluginPaymentDtoBase extends Pick<PluginPayment,
974
1421
  /**
975
1422
  * orderId 그냥 열어두면 이상한 값 넣을가봐 걱정... 방어코드 필요
976
1423
  */
977
- 'orderId' | 'sourceType' | 'amountMoney' | 'taxMoney' | 'approvedNo' | 'approvedAt' | 'paymentKey' | 'supplyMoney' | 'tipMoney' | 'taxExemptMoney'>;
1424
+ 'orderId' | 'sourceType' | 'amountMoney' | 'taxMoney' | 'approvedNo' | 'approvedAt' | 'paymentKey' | 'supplyMoney' | 'tipMoney' | 'taxExemptMoney'> {
1425
+ /**
1426
+ * default: true
1427
+ * false로 설정 시, 결제 등록 후 자동으로 주문이 완료되지 않습니다.
1428
+ * 테이블의 주문인 경우 autocomplete를 false로 설정하면, 테이블이 비워지지 않습니다
1429
+ */
1430
+ autocomplete?: boolean;
1431
+ }
1432
+
1433
+ /**
1434
+ * @publicApi
1435
+ */
1436
+ declare type PluginPaymentExternalSourceType = 'CARD' | 'BANK_TRANSFER' | 'OTHER_GIFT_CARD' | 'POINT' | 'COUPON' | 'OTHER';
978
1437
 
979
1438
  /**
980
1439
  * @publicApi
@@ -998,7 +1457,7 @@ export declare type PluginPaymentOf<S extends PluginPaymentSourceType> = Extract
998
1457
  * BARCODE: 바코드/QR을 사용하는 간편결제
999
1458
  * EXTERNAL: 기타결제(쿠폰, 외상 등)
1000
1459
  */
1001
- export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL';
1460
+ export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL' | 'BARCODE' | 'ACCOUNT_TRANSFER';
1002
1461
 
1003
1462
  /**
1004
1463
  * @publicApi
@@ -1021,6 +1480,15 @@ export declare type PluginPrice = {
1021
1480
  taxExemptMoney: number;
1022
1481
  };
1023
1482
 
1483
+ /**
1484
+ * @publicApi
1485
+ * @internal
1486
+ */
1487
+ export declare interface PluginServerOnHttpRequest extends HttpRequest {
1488
+ path: string;
1489
+ port: number;
1490
+ }
1491
+
1024
1492
  /**
1025
1493
  * @publicApi
1026
1494
  */
@@ -1030,6 +1498,8 @@ export declare interface PluginTable {
1030
1498
  hallId: number;
1031
1499
  /** 테이블명 */
1032
1500
  title: string;
1501
+ /** 인원수 */
1502
+ capacity?: number;
1033
1503
  group?: PluginTableGroup;
1034
1504
  }
1035
1505
 
@@ -1044,22 +1514,26 @@ export declare interface PluginTableGroup {
1044
1514
  tableIds: number[];
1045
1515
  }
1046
1516
 
1047
- declare type PluginTypes = typeof plugin;
1048
-
1049
1517
  /**
1050
1518
  * @publicApi
1051
1519
  */
1052
- export declare type PopupActionResponse<T extends AllPopupType> = Extract<AllPopupResponse, {
1520
+ export declare type PopupActionResponse<T extends PopupType> = Extract<Response_2, {
1053
1521
  type: T;
1054
- }>;
1522
+ complete: true;
1523
+ }>['data'];
1055
1524
 
1056
1525
  /**
1057
1526
  * @publicApi
1058
1527
  */
1059
- export declare type PopupElements<T extends AllPopupType> = Extract<AllPopupElements, {
1528
+ export declare type PopupElement<T extends PopupType> = Extract<Element_2, {
1060
1529
  type: T;
1061
1530
  }>;
1062
1531
 
1532
+ /**
1533
+ * @publicApi
1534
+ */
1535
+ declare type PopupType = Element_2['type'];
1536
+
1063
1537
  /**
1064
1538
  * @publicApi
1065
1539
  */
@@ -1070,17 +1544,21 @@ export declare type PosPluginSdk = {
1070
1544
  option: MenuOption;
1071
1545
  storage: StorageTypes;
1072
1546
  cashReceipt: CashReceiptTypes;
1073
- order: OrderTypes;
1074
- payment: PaymentTypes;
1547
+ order: Order;
1548
+ payment: Payment;
1075
1549
  http: HttpTypes;
1076
1550
  toast: ToastTypes;
1077
- merchant: MerchantTypes;
1078
- ui: UiType;
1551
+ device: Device;
1552
+ merchant: Merchant;
1079
1553
  paymentMethod: PaymentMethodType;
1080
1554
  websocket: WebsocketTypes;
1081
1555
  ffi: FFITypes;
1082
- plugin: PluginTypes;
1556
+ barcode: Barcode;
1557
+ plugin: Plugin_2;
1558
+ pluginMessenger: PluginMessenger;
1083
1559
  setting: SettingTypes;
1560
+ draftOrder: DraftOrder;
1561
+ navigation: Navigation;
1084
1562
  };
1085
1563
 
1086
1564
  /**
@@ -1097,6 +1575,15 @@ export declare class PosPluginSdkError extends Error {
1097
1575
  }
1098
1576
 
1099
1577
  /**
1578
+ * @publicApi
1579
+ */
1580
+ export declare class PosPluginSdkRateLimitError extends PosPluginSdkError {
1581
+ constructor(message: string);
1582
+ static isPosPluginSdkRateLimitError(error: unknown): error is PosPluginSdkRateLimitError;
1583
+ }
1584
+
1585
+ /**
1586
+ * @publicApi
1100
1587
  * @return string values.id
1101
1588
  */
1102
1589
  declare type RadioInput = Omit<BaseInput, 'placeholder'> & {
@@ -1108,6 +1595,8 @@ declare type RadioInput = Omit<BaseInput, 'placeholder'> & {
1108
1595
  values: InputValue[];
1109
1596
  };
1110
1597
 
1598
+ declare type Response_2 = BarcodeResponse | InputResponse;
1599
+
1111
1600
  declare function setInputs(inputs: Array<PluginInputs>): void;
1112
1601
 
1113
1602
  declare const setting: {
@@ -1115,9 +1604,13 @@ declare const setting: {
1115
1604
  getValues: typeof getValues;
1116
1605
  };
1117
1606
 
1118
- declare type SettingTypes = typeof setting;
1607
+ /**
1608
+ * @publicApi
1609
+ */
1610
+ export declare type SettingTypes = typeof setting;
1119
1611
 
1120
1612
  /**
1613
+ * @publicApi
1121
1614
  * @return number 0 25 50 75 100
1122
1615
  */
1123
1616
  declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
@@ -1146,34 +1639,52 @@ declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLE
1146
1639
  */
1147
1640
  | 'DONE';
1148
1641
 
1149
- declare interface Table {
1150
- getTables: () => Promise<{
1151
- table: PluginTable;
1152
- order?: PluginOrder;
1153
- }[]>;
1642
+ /**
1643
+ * @publicApi
1644
+ */
1645
+ export declare interface Table {
1646
+ getTables: () => Promise<PluginTable[]>;
1647
+ getTable: (tableId: number) => Promise<PluginTable>;
1648
+ /**
1649
+ * @deprecated 다음버전에서 제거 예정. order.on 사용 권장
1650
+ */
1154
1651
  on(event: 'order-update' | 'order-add', callback: (order: PluginOrder) => void): void;
1155
1652
  on(event: 'clear' | 'add' | 'delete' | 'update', callback: (table: PluginTable) => void): void;
1156
- on(event: 'swap' | 'move' | 'merge', callback: (before: PluginTable, after: PluginTable) => void): void;
1157
- clearTable: (payload: {
1653
+ on(event: 'move', callback: (before: PluginTable, after: PluginTable) => void): void;
1654
+ clearTable: ({ table, order }: {
1158
1655
  table: PluginTable;
1159
1656
  order?: PluginOrder;
1160
1657
  }) => Promise<void>;
1161
1658
  }
1162
1659
 
1163
1660
  /**
1661
+ * @publicApi
1164
1662
  * @return string
1165
1663
  */
1166
1664
  declare type TextInput = BaseInput & {
1167
1665
  type: 'text';
1168
1666
  default: string;
1169
1667
  placeholder?: string;
1668
+ suffix?: string;
1669
+ /**
1670
+ * @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
1671
+ * @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
1672
+ */
1673
+ candidates?: {
1674
+ text: string;
1675
+ value: string;
1676
+ }[];
1170
1677
  };
1171
1678
 
1172
- declare type ToastTypes = {
1679
+ /**
1680
+ * @publicApi
1681
+ */
1682
+ export declare type ToastTypes = {
1173
1683
  open(message: string): void;
1174
1684
  };
1175
1685
 
1176
1686
  /**
1687
+ * @publicApi
1177
1688
  * @return boolean
1178
1689
  */
1179
1690
  declare type ToggleInput = Omit<BaseInput, 'placeholder'> & {
@@ -1189,17 +1700,32 @@ export declare type TossMerchant = {
1189
1700
  name: string;
1190
1701
  id: number;
1191
1702
  businessNumber: string;
1192
- serialNumber: string;
1193
1703
  franchise?: {
1194
1704
  id: string;
1195
1705
  name: string;
1196
1706
  };
1197
1707
  };
1198
1708
 
1199
- declare type UiType = {
1200
- openPopup<T extends AllPopupType>(message: PopupElements<T>): Promise<PopupActionResponse<T>>;
1709
+ /**
1710
+ * @publicApi
1711
+ */
1712
+ export declare type Ui = {
1713
+ openBarcode(message: Omit<PopupElement<'barcode'>, 'type'>): Promise<PopupActionResponse<'barcode'>>;
1714
+ openInputModal(message: Omit<PopupElement<'input'>, 'type'>): Promise<PopupActionResponse<'input'>>;
1201
1715
  };
1202
1716
 
1717
+ /**
1718
+ * @publicApi
1719
+ */
1720
+ export declare const ui: UiImpl;
1721
+
1722
+ declare class UiImpl implements Ui {
1723
+ openBarcode(data: {
1724
+ productName: string;
1725
+ }): Promise<PopupActionResponse<'barcode'>>;
1726
+ openInputModal(data: Omit<PopupElement<'input'>, 'type'>): Promise<PopupActionResponse<'input'>>;
1727
+ }
1728
+
1203
1729
  declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
1204
1730
 
1205
1731
  /**
@@ -1207,7 +1733,10 @@ declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof Obje
1207
1733
  */
1208
1734
  export declare type VanType = 'NICE' | 'KIS' | 'SMARTRO' | 'KOVAN';
1209
1735
 
1210
- declare class Websocket {
1736
+ /**
1737
+ * @publicApi
1738
+ */
1739
+ export declare class Websocket {
1211
1740
  private readonly url;
1212
1741
  private readonly headers;
1213
1742
  private readonly options?;
@@ -1234,7 +1763,10 @@ declare class Websocket {
1234
1763
  onOpen(callback: () => void): void;
1235
1764
  }
1236
1765
 
1237
- declare type WebsocketTypes = {
1766
+ /**
1767
+ * @publicApi
1768
+ */
1769
+ export declare type WebsocketTypes = {
1238
1770
  create: (url: string, headers: Record<string, string>, options?: {
1239
1771
  rejectUnauthorized?: boolean;
1240
1772
  followRedirects?: boolean;