@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/types/index.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
  */
@@ -179,7 +284,10 @@ declare type FFIFunctionParam = {
179
284
  */
180
285
  declare type FFIFunctionReturn = 'void' | 'str' | 'int' | 'bool' | 'wchar *' | 'void *';
181
286
 
182
- declare interface FFITypes {
287
+ /**
288
+ * @publicApi
289
+ */
290
+ export declare interface FFITypes {
183
291
  download: (downloadInfo: FFIDownloadInfo) => Promise<{
184
292
  platform: keyof FFIDownloadInfo;
185
293
  }>;
@@ -193,14 +301,9 @@ declare interface FFITypes {
193
301
  addCallbackErrorHandler: (filePath: string, handler: (error: Error) => void) => void;
194
302
  }
195
303
 
196
- declare function getPluginInfo(): Promise<{
197
- name: string;
198
- version: string;
199
- }>;
200
-
201
304
  declare function getValues<T extends Record<string, number | string | string[] | boolean | undefined>>(): Promise<T>;
202
305
 
203
- declare type HereOrder = Order & {
306
+ declare type HereOrder = Order_2 & {
204
307
  type: 'HERE';
205
308
  memo: {
206
309
  store?: string;
@@ -233,6 +336,35 @@ export declare interface HttpTypes {
233
336
  patch: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
234
337
  }
235
338
 
339
+ declare type InputElements = {
340
+ type: 'input';
341
+ inputs: PluginInputs[];
342
+ title: string;
343
+ description?: string;
344
+ cta: {
345
+ cancel?: CtaInput;
346
+ submit: CtaInput;
347
+ };
348
+ };
349
+
350
+ declare type InputResponse = {
351
+ type: 'input';
352
+ complete: true;
353
+ data: {
354
+ inputs: Record<string, string | number | boolean | string[]>;
355
+ result: 'SUCCESS';
356
+ } | {
357
+ result: 'CANCELLED';
358
+ };
359
+ } | {
360
+ type: 'input';
361
+ complete: false;
362
+ errorMessage: string;
363
+ };
364
+
365
+ /**
366
+ * @publicApi
367
+ */
236
368
  declare type InputValue = {
237
369
  id: string;
238
370
  label: string;
@@ -247,19 +379,91 @@ declare type Languages = Record<PluginLanguageCode, string>;
247
379
  */
248
380
  export declare interface MenuOption {
249
381
  getOptions: () => Promise<PluginCatalogItemOption[]>;
250
- on: (event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: (option: PluginCatalogItemOption) => void) => void;
382
+ getOption: (optionId: number) => Promise<PluginCatalogItemOption>;
383
+ /**
384
+ * @deprecated 다음 버전에서 제거 예정입니다
385
+ */
386
+ on(event: 'sold-out' | 'on-sale', callback: (option: PluginCatalogItemOption) => void): void;
387
+ on(event: 'update' | 'add' | 'delete', callback: (option: PluginCatalogItemOption) => void): void;
388
+ on(event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: (option: PluginCatalogItemOption) => void): void;
251
389
  }
252
390
 
253
391
  /**
254
392
  * @publicApi
255
393
  */
256
- export declare interface MerchantTypes {
394
+ export declare interface Merchant {
257
395
  getMerchant: () => Promise<TossMerchant>;
258
396
  }
259
397
 
260
- declare function on(event: 'close', callback: () => Promise<void>): void;
398
+ /**
399
+ * @publicApi
400
+ */
401
+ export declare interface Navigation {
402
+ navigate(page: 'plugin-tab', packageName?: string): void;
403
+ navigate(page: 'business-type-setting'): void;
404
+ /**
405
+ * 포스에서 페이지를 이동합니다.
406
+ * @param page business-type-setting 업종유형 변경, plugin-tab 플러그인 탭 이동
407
+ * @param packageName 이동할 탭의 이름, 없는 경우 첫번째 플러그인 탭으로 이동합니다
408
+ */
409
+ navigate(page: 'business-type-setting' | 'plugin-tab', packageName?: string): void;
410
+ }
261
411
 
262
- declare type Order = {
412
+ /**
413
+ * @publicApi
414
+ */
415
+ export declare class NavigationImpl implements Navigation {
416
+ navigate(page: 'plugin-tab', packageName?: string): void;
417
+ navigate(page: 'business-type-setting'): void;
418
+ }
419
+
420
+ /**
421
+ * @publicApi
422
+ * @return number
423
+ */
424
+ declare type NumberInput = BaseInput & {
425
+ type: 'number';
426
+ default: number;
427
+ placeholder?: string;
428
+ suffix?: string;
429
+ /**
430
+ * @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
431
+ * @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
432
+ */
433
+ candidates?: {
434
+ text: string;
435
+ value: number;
436
+ }[];
437
+ };
438
+
439
+ /**
440
+ * @publicApi
441
+ */
442
+ export declare interface Order {
443
+ getOrder: (id: string) => Promise<PluginOrder>;
444
+ /**
445
+ * @param start yyyy-MM-dd
446
+ * @param end yyyy-MM-dd
447
+ * @description createdAt 기준으로 주문을 조회합니다
448
+ */
449
+ getOrders: (range: {
450
+ start: string;
451
+ end: string;
452
+ }) => Promise<PluginOrder[]>;
453
+ /**
454
+ * @deprecated
455
+ */
456
+ on(event: 'cancel', callback: (order: PluginOrder) => void): void;
457
+ cancel: (id: string) => Promise<void>;
458
+ add: (order: PluginOrderDto) => Promise<PluginOrder>;
459
+ /**
460
+ * 새로 추가 된 메뉴만 order에 넣으세요
461
+ */
462
+ addMenu: (orderId: string, order: PluginOrderDto) => Promise<PluginOrder>;
463
+ complete: (id: string) => Promise<PluginOrder>;
464
+ }
465
+
466
+ declare type Order_2 = {
263
467
  /**
264
468
  * 포스(사장님)에게 보여줄 주문유형
265
469
  * @example 가게배달, 장보기/쇼핑, 픽업, 배민1 등등
@@ -305,23 +509,6 @@ declare type OrderItemType = 'ITEM' | 'DELIVERY_FEE' | 'PREPAID_CARD' | 'MULTI_U
305
509
 
306
510
  /**
307
511
  * @publicApi
308
- */
309
- export declare interface OrderTypes {
310
- getOrder: (id: string) => Promise<PluginOrder>;
311
- /**
312
- * 토스 포스에서 카드결제를 취소하면 무조건 카드리딩해야함 그래서 on cancel은 늘 환불까지 된 상태임
313
- */
314
- on: (event: 'cancel', callback: (order: PluginOrder) => void) => void;
315
- cancel: (id: string) => Promise<void>;
316
- add: (order: PluginOrderDto) => Promise<PluginOrder>;
317
- /**
318
- * 새로 추가 된 메뉴만 order에 넣으세요
319
- */
320
- addMenu: (orderId: string, order: PluginOrderDto) => Promise<PluginOrder>;
321
- complete: (id: string) => Promise<PluginOrder>;
322
- }
323
-
324
- /**
325
512
  * @return string
326
513
  */
327
514
  declare type PasswordInput = BaseInput & {
@@ -330,7 +517,25 @@ declare type PasswordInput = BaseInput & {
330
517
  placeholder?: string;
331
518
  };
332
519
 
333
- declare type PayCallback = (order: PluginOrder, price: PluginPrice) => Promise<PaymentMethodResponse | undefined>;
520
+ declare type PayCallback = (order: PluginOrder, price: PluginPrice, ui: Ui) => Promise<PaymentMethodResponse | undefined>;
521
+
522
+ /**
523
+ * @publicApi
524
+ */
525
+ export declare interface Payment {
526
+ on: (event: 'cancel' | 'paid', callback: PaymentCallback) => void;
527
+ cancel: (order: {
528
+ id: string;
529
+ }, payment: {
530
+ id: string;
531
+ }) => Promise<void>;
532
+ add: (order: {
533
+ id: string;
534
+ }, paymentDto: PluginPaymentDto) => Promise<PluginPaymentOf<'CARD'> | PluginPaymentOf<'CASH'> | PluginPaymentOf<'EXTERNAL'>>;
535
+ getPayment: (paymentId: PluginPayment['id']) => Promise<PluginPayment>;
536
+ }
537
+
538
+ declare type PaymentCallback = (payment: PluginPayment) => void;
334
539
 
335
540
  /**
336
541
  * @publicApi
@@ -346,7 +551,10 @@ export declare type PaymentMethodResponse = {
346
551
  paymentKey: string;
347
552
  };
348
553
 
349
- declare type PaymentMethodType = {
554
+ /**
555
+ * @publicApi
556
+ */
557
+ export declare type PaymentMethodType = {
350
558
  add: (payload: {
351
559
  data: {
352
560
  /**
@@ -366,19 +574,7 @@ declare type PaymentMethodType = {
366
574
  }) => void;
367
575
  };
368
576
 
369
- declare interface PaymentTypes {
370
- on: (event: 'cancel', callback: (payload: PluginPaymentOf<'CASH'> | PluginPaymentOf<'CARD'> | PluginPaymentOf<'EXTERNAL'>) => void) => void;
371
- cancel: (order: {
372
- id: string;
373
- }, payment: {
374
- id: string;
375
- }) => Promise<void>;
376
- add: (order: {
377
- id: string;
378
- }, paymentDto: PluginPaymentDto) => Promise<PluginPaymentOf<'CARD'> | PluginPaymentOf<'CASH'> | PluginPaymentOf<'EXTERNAL'>>;
379
- }
380
-
381
- declare type PickupOrder = Order & {
577
+ declare type PickupOrder = Order_2 & {
382
578
  type: 'PICKUP';
383
579
  memo: {
384
580
  store?: string;
@@ -387,10 +583,65 @@ declare type PickupOrder = Order & {
387
583
  status: StoreStatus;
388
584
  };
389
585
 
390
- declare const plugin: {
391
- on: typeof on;
392
- getPluginInfo: typeof getPluginInfo;
393
- };
586
+ /**
587
+ * @publicApi
588
+ */
589
+ declare type Platform = 'macos' | 'windows' | 'android' | 'ios' | 'unknown';
590
+
591
+ /**
592
+ * @publicApi
593
+ */
594
+ export declare const plugin: PluginImpl;
595
+
596
+ /**
597
+ * @publicApi
598
+ */
599
+ declare interface Plugin_2 {
600
+ on(event: 'close', callback: () => Promise<void>): void;
601
+ getPluginInfo(): Promise<{
602
+ name: string;
603
+ version: string;
604
+ }>;
605
+ }
606
+ export { Plugin_2 as Plugin }
607
+
608
+ /**
609
+ * @publicApi
610
+ */
611
+ declare interface PluginAccountTransferPayment extends PluginPaymentBase {
612
+ sourceType: 'ACCOUNT_TRANSFER';
613
+ /** 계좌이체 정보 */
614
+ accountTransfer: {
615
+ /** 은행코드 */
616
+ bankCode: number;
617
+ /** 계좌번호 */
618
+ accountNumber: string;
619
+ };
620
+ }
621
+
622
+ /**
623
+ * @publicApi
624
+ */
625
+ declare interface PluginBarcodePayment extends PluginPaymentBase {
626
+ sourceType: 'BARCODE';
627
+ externalDetails: {
628
+ installmentMonth: PluginPaymentInstallment;
629
+ /**
630
+ * 발급사명
631
+ * @example 토스페이, 네이버체크, 카카오페이머니, ...
632
+ */
633
+ source: string;
634
+ /**
635
+ * 간편결제 구분자
636
+ * @example KKF, SG2, ZRP, ...
637
+ */
638
+ sourceId: string;
639
+ sourceType?: PluginPaymentExternalSourceType;
640
+ /** 매입사명 */
641
+ cardBrand?: string;
642
+ cardNo?: string;
643
+ };
644
+ }
394
645
 
395
646
  /**
396
647
  * @publicApi
@@ -490,6 +741,10 @@ export declare interface PluginCatalogItem {
490
741
  * @description 토스 포스에 등록된 메뉴의 고유 아이디
491
742
  */
492
743
  id: number;
744
+ /**
745
+ * 플러그인에서 생성하면 토스포스 서버에 저장되어 항상 같이 내려옴
746
+ */
747
+ code?: string;
493
748
  /**
494
749
  * @description 포스 내에서 보여주는 타이틀
495
750
  * @description 사장님께만 보입니다
@@ -517,7 +772,7 @@ export declare interface PluginCatalogItem {
517
772
  * @description 메뉴에 달린 벳지입니다
518
773
  */
519
774
  labels: PluginCatalogItemLabel[];
520
- imageUrl: string | null;
775
+ imageUrl?: string;
521
776
  /**
522
777
  * @description 상품의 가격정보
523
778
  */
@@ -526,6 +781,13 @@ export declare interface PluginCatalogItem {
526
781
  * @description 상품에서 사용가능한 옵션 리스트
527
782
  */
528
783
  options: PluginCatalogItemOption[];
784
+ /** POS에서 상품 표시시 색상 정보 */
785
+ color?: string;
786
+ /** 제조 및 유통 정보 */
787
+ provenance?: {
788
+ /** 제조사 */
789
+ displayProvenance: string;
790
+ };
529
791
  }
530
792
 
531
793
  /**
@@ -541,14 +803,20 @@ export declare interface PluginCatalogItemDto {
541
803
  description?: string;
542
804
  descriptionI18n?: PluginLanguagePack;
543
805
  categoryId: number;
544
- price: PluginCatalogItemPrice;
806
+ price: PluginCatalogItemPriceDto;
545
807
  labels: PluginCatalogItemLabel[];
546
- imageUrl: string | null;
808
+ imageUrl?: string;
547
809
  /**
548
810
  * @description 옵션을 먼저 만들고 id를 넣어달라
549
811
  */
550
812
  options: Pick<PluginCatalogItemOption, 'id'>[];
551
- kioskTitle?: string;
813
+ /** POS에서 상품 표시시 색상 정보 */
814
+ color?: string;
815
+ /** 제조 및 유통 정보 */
816
+ provenance?: {
817
+ /** 제조사 */
818
+ displayProvenance: string;
819
+ };
552
820
  }
553
821
 
554
822
  /**
@@ -602,7 +870,6 @@ export declare interface PluginCatalogItemOptionChoice {
602
870
  * @publicApi
603
871
  */
604
872
  export declare interface PluginCatalogItemPrice {
605
- id: number;
606
873
  /** 상품 가격명 */
607
874
  title: string;
608
875
  /** 기본 가격 여부 */
@@ -613,9 +880,9 @@ export declare interface PluginCatalogItemPrice {
613
880
  * 재고 관리 코드
614
881
  * @see https://en.wikipedia.org/wiki/Stock_keeping_unit
615
882
  */
616
- sku: string | null;
883
+ sku?: string;
617
884
  /** 상품 가격의 바코드 정보 */
618
- barcode: string | null;
885
+ barcode?: string;
619
886
  /** 가격 유형 */
620
887
  priceType: PluginCatalogItemPriceType;
621
888
  /** 가격의 기본 개수 */
@@ -629,10 +896,30 @@ export declare interface PluginCatalogItemPrice {
629
896
  /** 재고 관리여부 */
630
897
  isStockable: boolean;
631
898
  /** 현재 남아있는 재고 수 */
632
- stockQuantity: {
899
+ stockQuantity?: {
633
900
  remainQuantity: number;
634
901
  lastChangeDateTime: string;
635
- } | null;
902
+ };
903
+ }
904
+
905
+ /**
906
+ * @publicApi
907
+ */
908
+ export declare interface PluginCatalogItemPriceDto {
909
+ /** 상품 가격명 */
910
+ title: string;
911
+ /** 상품 가격의 바코드 정보 */
912
+ barcode?: string;
913
+ /** 가격 유형 */
914
+ priceType: PluginCatalogItemPriceType;
915
+ /** 가격의 기본 개수 */
916
+ priceUnit: number;
917
+ /**
918
+ * 부가가치세(VAT)가 포함된 가격
919
+ */
920
+ priceValue: number;
921
+ /** 비과세 여부 */
922
+ isTaxFree: boolean;
636
923
  }
637
924
 
638
925
  /**
@@ -659,6 +946,34 @@ export declare type PluginDelivery<T extends 'PICKUP' | 'HERE' | 'DELIVERY'> = E
659
946
  type: T;
660
947
  }>;
661
948
 
949
+ /**
950
+ * @publicApi
951
+ * */
952
+ export declare interface PluginDeliveryDiscount extends PluginDiscount {
953
+ discountBy: 'OWNER' | 'PLATFORM';
954
+ }
955
+
956
+ /**
957
+ * @publicApi
958
+ * @description order를 만들기 위한 dto
959
+ */
960
+ export declare type PluginDeliveryOrderDto = Omit<PluginOrderDto, 'lineItems' | 'discounts'> & {
961
+ cancelled: boolean;
962
+ delivery: PluginDelivery<'DELIVERY' | 'PICKUP' | 'HERE'>;
963
+ discounts: Array<PluginDeliveryDiscount>;
964
+ lineItems: Array<Omit<PluginOrderItem, 'id' | 'orderId' | 'item' | 'optionChoices' | 'discounts'> & {
965
+ item: {
966
+ title: string;
967
+ type: 'ITEM' | 'DELIVERY_FEE';
968
+ };
969
+ optionChoices: Array<{
970
+ title: string;
971
+ priceValue: number;
972
+ }>;
973
+ discounts?: Array<PluginDeliveryDiscount>;
974
+ }>;
975
+ };
976
+
662
977
  /**
663
978
  * @publicApi
664
979
  * 할인 정보
@@ -676,6 +991,107 @@ export declare interface PluginDiscount {
676
991
  titleI18n?: PluginLanguagePack;
677
992
  }
678
993
 
994
+ /**
995
+ * @publicApi
996
+ */
997
+ export declare interface PluginDraftOrder {
998
+ /**
999
+ * 주문ID
1000
+ * 서버 주문을 클라이언트 주문으로 변경했을 때 값이 존재
1001
+ */
1002
+ id?: string;
1003
+ /** 주문 항목 목록 */
1004
+ lineItems: Array<PluginDraftOrderItem>;
1005
+ /** 주문 요청사항 */
1006
+ memo?: string;
1007
+ /** 주문에 적용된 할인 목록 */
1008
+ discounts: PluginDiscount[];
1009
+ price: PluginDraftOrderPrice;
1010
+ /**
1011
+ * 이 주문에 대해 프린트 출력을 무시할지 여부
1012
+ * 이 옵션이 켜져 있는 경우 다른 포스에서도 프린트 출력이 무시됩니다.
1013
+ * 기본값은 false입니다.
1014
+ */
1015
+ ignorePrint: boolean;
1016
+ /** 해당 주문의 테이블 인원 수 */
1017
+ numGuests?: number;
1018
+ }
1019
+
1020
+ /**
1021
+ * @publicApi
1022
+ */
1023
+ export declare interface PluginDraftOrderItem {
1024
+ /**
1025
+ * 넣지 않으면 자동으로 생성됨
1026
+ */
1027
+ key: string;
1028
+ /** 상품 정보 */
1029
+ item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'options' | 'code'> & {
1030
+ type: OrderItemType;
1031
+ };
1032
+ /** 상품 가격 정보 */
1033
+ itemPrice: Pick<PluginCatalogItemPrice, 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
1034
+ /** 적용된 할인 목록 */
1035
+ discount: PluginDiscount[];
1036
+ /** 요청사항 */
1037
+ memo: string;
1038
+ /** 선택된 옵션 정보 */
1039
+ optionChoices: PluginCatalogItemOptionChoice[];
1040
+ /** 수량 */
1041
+ quantity: number;
1042
+ /** 식사 유형 */
1043
+ diningOption: PluginOrderDiningOption;
1044
+ /**
1045
+ * 서버에서 생성된 lineItemId
1046
+ */
1047
+ lineItemId?: string;
1048
+ metadata?: {
1049
+ /**
1050
+ * true : 유저가 메모 수정 불가
1051
+ */
1052
+ disableMemoEdit?: boolean;
1053
+ /**
1054
+ * true : 유저가 옵션 수정 불가
1055
+ */
1056
+ disableOptionEdit?: boolean;
1057
+ /**
1058
+ * true : 유저가 수량 변경 불가
1059
+ */
1060
+ disableQuantityEdit?: boolean;
1061
+ };
1062
+ }
1063
+
1064
+ /**
1065
+ * @publicApi
1066
+ * @desription key는 넣으면 할당되고 없으면 포스에서 자동생성
1067
+ */
1068
+ declare type PluginDraftOrderItemDto = PluginDraftOrderItem & {
1069
+ key?: string;
1070
+ itemPrice: Pick<PluginCatalogItemPrice, 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
1071
+ };
1072
+
1073
+ declare interface PluginDraftOrderPrice {
1074
+ /** (-)할인 금액 */
1075
+ orderDiscountValue: number;
1076
+ /**
1077
+ * 원주문 금액
1078
+ * Σ OrderItem.orderPrice.orderListPriceValue
1079
+ */
1080
+ orderListPriceValue: number;
1081
+ /**
1082
+ * 주문 금액 = 원주문금액 + 할인 금액 + 보증금 + 봉사료
1083
+ *
1084
+ * @see 보증금: DraftOrder.bookingFee
1085
+ */
1086
+ orderPriceValue: number;
1087
+ /** 봉사료 */
1088
+ orderTipValue: number;
1089
+ }
1090
+
1091
+ /**
1092
+ * 밴을 통하지 않으면 바코드결제라고 해도 externalPayment로 처리해주세요
1093
+ * 취소를 플러그인에서 따로 처리해야하면 externalPayment로 처리해주세요
1094
+ */
679
1095
  declare interface PluginExternalDto extends PluginPaymentDtoBase {
680
1096
  sourceType: 'EXTERNAL';
681
1097
  }
@@ -721,18 +1137,23 @@ export declare type PluginHttpResponse = {
721
1137
  code: number;
722
1138
  };
723
1139
 
724
- /**
725
- * @publicApi
726
- * @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
727
- */
728
- export declare type PluginInputs<T extends PluginInputType = any> = Extract<TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput, {
729
- type: T;
730
- }>;
1140
+ declare class PluginImpl implements Plugin_2 {
1141
+ private readonly webview;
1142
+ private pluginCallbacks;
1143
+ constructor(webview: WebView);
1144
+ private initializePlugin;
1145
+ on(event: 'close', callback: () => Promise<void>): void;
1146
+ getPluginInfo(): Promise<{
1147
+ name: string;
1148
+ version: string;
1149
+ }>;
1150
+ }
731
1151
 
732
1152
  /**
733
1153
  * @publicApi
1154
+ * @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
734
1155
  */
735
- declare type PluginInputType = PluginInputs['type'];
1156
+ export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
736
1157
 
737
1158
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
738
1159
 
@@ -744,6 +1165,26 @@ export declare interface PluginLanguagePack {
744
1165
  languages: Partial<Languages>;
745
1166
  }
746
1167
 
1168
+ /**
1169
+ * @publicApi
1170
+ */
1171
+ export declare interface PluginMessenger {
1172
+ broadcast<T = any>(message: T): void;
1173
+ on<T = any>(event: 'message', callback: (message: T) => void): void;
1174
+ }
1175
+
1176
+ /**
1177
+ * @publicApi
1178
+ */
1179
+ export declare const pluginMessenger: PluginMessengerImpl;
1180
+
1181
+ declare class PluginMessengerImpl implements PluginMessenger {
1182
+ private readonly webview;
1183
+ constructor(webview: WebView);
1184
+ broadcast<T = any>(message: T): void;
1185
+ on<T = any>(event: 'message', callback: (message: T) => void): void;
1186
+ }
1187
+
747
1188
  /**
748
1189
  * @publicApi
749
1190
  * @description pluginOrder orderDto를 서버에 저장 후 가공해서 내려 준 값
@@ -769,11 +1210,17 @@ export declare interface PluginOrder {
769
1210
  paymentPrice: PluginOrderPaymentPrice;
770
1211
  requestedInfo?: PluginOrderRequestInfo;
771
1212
  source: string;
1213
+ /** 해당 주문의 테이블 인원 수 */
1214
+ numGuests?: number;
772
1215
  memo?: string;
773
1216
  /**
1217
+ * @description 주문시각
774
1218
  * 해당값이 있다면 createdAt 대신 사용해주세요.
775
1219
  */
776
1220
  openedAt?: string;
1221
+ /**
1222
+ * @description 생성시각
1223
+ */
777
1224
  createdAt: string;
778
1225
  updatedAt?: string;
779
1226
  cancelledAt?: string;
@@ -827,14 +1274,14 @@ export declare interface PluginOrderItem {
827
1274
  id: string;
828
1275
  orderId: string;
829
1276
  diningOption: PluginOrderDiningOption;
830
- item: Pick<PluginCatalogItem, 'id' | 'title' | 'category'> & {
1277
+ item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'code'> & {
831
1278
  type: OrderItemType;
832
1279
  };
833
1280
  quantity: {
834
1281
  value: number;
835
1282
  };
836
1283
  /**
837
- * @description 실제 고객이 결제하는 금액에 대한 정보입니다.
1284
+ * @description 실제 고객이 결제하는 금액에 대한 정보입니다. (할인 적용 금액)
838
1285
  */
839
1286
  chargePrice: {
840
1287
  value: number;
@@ -898,7 +1345,7 @@ export declare type PluginOrderState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'C
898
1345
  /**
899
1346
  * @publicApi
900
1347
  */
901
- export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment) & {
1348
+ export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment | PluginAccountTransferPayment | PluginBarcodePayment) & {
902
1349
  paymentKey: string;
903
1350
  };
904
1351
 
@@ -957,11 +1404,23 @@ export declare type PluginPaymentDto<S extends PluginPaymentSourceType = PluginP
957
1404
  sourceType: S;
958
1405
  }>;
959
1406
 
960
- declare type PluginPaymentDtoBase = Pick<PluginPayment,
1407
+ declare interface PluginPaymentDtoBase extends Pick<PluginPayment,
961
1408
  /**
962
1409
  * orderId 그냥 열어두면 이상한 값 넣을가봐 걱정... 방어코드 필요
963
1410
  */
964
- 'orderId' | 'sourceType' | 'amountMoney' | 'taxMoney' | 'approvedNo' | 'approvedAt' | 'paymentKey' | 'supplyMoney' | 'tipMoney' | 'taxExemptMoney'>;
1411
+ 'orderId' | 'sourceType' | 'amountMoney' | 'taxMoney' | 'approvedNo' | 'approvedAt' | 'paymentKey' | 'supplyMoney' | 'tipMoney' | 'taxExemptMoney'> {
1412
+ /**
1413
+ * default: true
1414
+ * false로 설정 시, 결제 등록 후 자동으로 주문이 완료되지 않습니다.
1415
+ * 테이블의 주문인 경우 autocomplete를 false로 설정하면, 테이블이 비워지지 않습니다
1416
+ */
1417
+ autocomplete?: boolean;
1418
+ }
1419
+
1420
+ /**
1421
+ * @publicApi
1422
+ */
1423
+ declare type PluginPaymentExternalSourceType = 'CARD' | 'BANK_TRANSFER' | 'OTHER_GIFT_CARD' | 'POINT' | 'COUPON' | 'OTHER';
965
1424
 
966
1425
  /**
967
1426
  * @publicApi
@@ -985,7 +1444,7 @@ export declare type PluginPaymentOf<S extends PluginPaymentSourceType> = Extract
985
1444
  * BARCODE: 바코드/QR을 사용하는 간편결제
986
1445
  * EXTERNAL: 기타결제(쿠폰, 외상 등)
987
1446
  */
988
- export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL';
1447
+ export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL' | 'BARCODE' | 'ACCOUNT_TRANSFER';
989
1448
 
990
1449
  /**
991
1450
  * @publicApi
@@ -1008,6 +1467,8 @@ export declare type PluginPrice = {
1008
1467
  taxExemptMoney: number;
1009
1468
  };
1010
1469
 
1470
+ /* Excluded from this release type: PluginServerOnHttpRequest */
1471
+
1011
1472
  /**
1012
1473
  * @publicApi
1013
1474
  */
@@ -1017,6 +1478,8 @@ export declare interface PluginTable {
1017
1478
  hallId: number;
1018
1479
  /** 테이블명 */
1019
1480
  title: string;
1481
+ /** 인원수 */
1482
+ capacity?: number;
1020
1483
  group?: PluginTableGroup;
1021
1484
  }
1022
1485
 
@@ -1031,22 +1494,26 @@ export declare interface PluginTableGroup {
1031
1494
  tableIds: number[];
1032
1495
  }
1033
1496
 
1034
- declare type PluginTypes = typeof plugin;
1035
-
1036
1497
  /**
1037
1498
  * @publicApi
1038
1499
  */
1039
- export declare type PopupActionResponse<T extends AllPopupType> = Extract<AllPopupResponse, {
1500
+ export declare type PopupActionResponse<T extends PopupType> = Extract<Response_2, {
1040
1501
  type: T;
1041
- }>;
1502
+ complete: true;
1503
+ }>['data'];
1042
1504
 
1043
1505
  /**
1044
1506
  * @publicApi
1045
1507
  */
1046
- export declare type PopupElements<T extends AllPopupType> = Extract<AllPopupElements, {
1508
+ export declare type PopupElement<T extends PopupType> = Extract<Element_2, {
1047
1509
  type: T;
1048
1510
  }>;
1049
1511
 
1512
+ /**
1513
+ * @publicApi
1514
+ */
1515
+ declare type PopupType = Element_2['type'];
1516
+
1050
1517
  /**
1051
1518
  * @publicApi
1052
1519
  */
@@ -1057,17 +1524,21 @@ export declare type PosPluginSdk = {
1057
1524
  option: MenuOption;
1058
1525
  storage: StorageTypes;
1059
1526
  cashReceipt: CashReceiptTypes;
1060
- order: OrderTypes;
1061
- payment: PaymentTypes;
1527
+ order: Order;
1528
+ payment: Payment;
1062
1529
  http: HttpTypes;
1063
1530
  toast: ToastTypes;
1064
- merchant: MerchantTypes;
1065
- ui: UiType;
1531
+ device: Device;
1532
+ merchant: Merchant;
1066
1533
  paymentMethod: PaymentMethodType;
1067
1534
  websocket: WebsocketTypes;
1068
1535
  ffi: FFITypes;
1069
- plugin: PluginTypes;
1536
+ barcode: Barcode;
1537
+ plugin: Plugin_2;
1538
+ pluginMessenger: PluginMessenger;
1070
1539
  setting: SettingTypes;
1540
+ draftOrder: DraftOrder;
1541
+ navigation: Navigation;
1071
1542
  };
1072
1543
 
1073
1544
  /**
@@ -1084,6 +1555,15 @@ export declare class PosPluginSdkError extends Error {
1084
1555
  }
1085
1556
 
1086
1557
  /**
1558
+ * @publicApi
1559
+ */
1560
+ export declare class PosPluginSdkRateLimitError extends PosPluginSdkError {
1561
+ constructor(message: string);
1562
+ static isPosPluginSdkRateLimitError(error: unknown): error is PosPluginSdkRateLimitError;
1563
+ }
1564
+
1565
+ /**
1566
+ * @publicApi
1087
1567
  * @return string values.id
1088
1568
  */
1089
1569
  declare type RadioInput = Omit<BaseInput, 'placeholder'> & {
@@ -1095,6 +1575,8 @@ declare type RadioInput = Omit<BaseInput, 'placeholder'> & {
1095
1575
  values: InputValue[];
1096
1576
  };
1097
1577
 
1578
+ declare type Response_2 = BarcodeResponse | InputResponse;
1579
+
1098
1580
  declare function setInputs(inputs: Array<PluginInputs>): void;
1099
1581
 
1100
1582
  declare const setting: {
@@ -1102,9 +1584,13 @@ declare const setting: {
1102
1584
  getValues: typeof getValues;
1103
1585
  };
1104
1586
 
1105
- declare type SettingTypes = typeof setting;
1587
+ /**
1588
+ * @publicApi
1589
+ */
1590
+ export declare type SettingTypes = typeof setting;
1106
1591
 
1107
1592
  /**
1593
+ * @publicApi
1108
1594
  * @return number 0 25 50 75 100
1109
1595
  */
1110
1596
  declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
@@ -1133,34 +1619,52 @@ declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLE
1133
1619
  */
1134
1620
  | 'DONE';
1135
1621
 
1136
- declare interface Table {
1137
- getTables: () => Promise<{
1138
- table: PluginTable;
1139
- order?: PluginOrder;
1140
- }[]>;
1622
+ /**
1623
+ * @publicApi
1624
+ */
1625
+ export declare interface Table {
1626
+ getTables: () => Promise<PluginTable[]>;
1627
+ getTable: (tableId: number) => Promise<PluginTable>;
1628
+ /**
1629
+ * @deprecated 다음버전에서 제거 예정. order.on 사용 권장
1630
+ */
1141
1631
  on(event: 'order-update' | 'order-add', callback: (order: PluginOrder) => void): void;
1142
1632
  on(event: 'clear' | 'add' | 'delete' | 'update', callback: (table: PluginTable) => void): void;
1143
- on(event: 'swap' | 'move' | 'merge', callback: (before: PluginTable, after: PluginTable) => void): void;
1144
- clearTable: (payload: {
1633
+ on(event: 'move', callback: (before: PluginTable, after: PluginTable) => void): void;
1634
+ clearTable: ({ table, order }: {
1145
1635
  table: PluginTable;
1146
1636
  order?: PluginOrder;
1147
1637
  }) => Promise<void>;
1148
1638
  }
1149
1639
 
1150
1640
  /**
1641
+ * @publicApi
1151
1642
  * @return string
1152
1643
  */
1153
1644
  declare type TextInput = BaseInput & {
1154
1645
  type: 'text';
1155
1646
  default: string;
1156
1647
  placeholder?: string;
1648
+ suffix?: string;
1649
+ /**
1650
+ * @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
1651
+ * @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
1652
+ */
1653
+ candidates?: {
1654
+ text: string;
1655
+ value: string;
1656
+ }[];
1157
1657
  };
1158
1658
 
1159
- declare type ToastTypes = {
1659
+ /**
1660
+ * @publicApi
1661
+ */
1662
+ export declare type ToastTypes = {
1160
1663
  open(message: string): void;
1161
1664
  };
1162
1665
 
1163
1666
  /**
1667
+ * @publicApi
1164
1668
  * @return boolean
1165
1669
  */
1166
1670
  declare type ToggleInput = Omit<BaseInput, 'placeholder'> & {
@@ -1176,17 +1680,32 @@ export declare type TossMerchant = {
1176
1680
  name: string;
1177
1681
  id: number;
1178
1682
  businessNumber: string;
1179
- serialNumber: string;
1180
1683
  franchise?: {
1181
1684
  id: string;
1182
1685
  name: string;
1183
1686
  };
1184
1687
  };
1185
1688
 
1186
- declare type UiType = {
1187
- openPopup<T extends AllPopupType>(message: PopupElements<T>): Promise<PopupActionResponse<T>>;
1689
+ /**
1690
+ * @publicApi
1691
+ */
1692
+ export declare type Ui = {
1693
+ openBarcode(message: Omit<PopupElement<'barcode'>, 'type'>): Promise<PopupActionResponse<'barcode'>>;
1694
+ openInputModal(message: Omit<PopupElement<'input'>, 'type'>): Promise<PopupActionResponse<'input'>>;
1188
1695
  };
1189
1696
 
1697
+ /**
1698
+ * @publicApi
1699
+ */
1700
+ export declare const ui: UiImpl;
1701
+
1702
+ declare class UiImpl implements Ui {
1703
+ openBarcode(data: {
1704
+ productName: string;
1705
+ }): Promise<PopupActionResponse<'barcode'>>;
1706
+ openInputModal(data: Omit<PopupElement<'input'>, 'type'>): Promise<PopupActionResponse<'input'>>;
1707
+ }
1708
+
1190
1709
  declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
1191
1710
 
1192
1711
  /**
@@ -1194,7 +1713,10 @@ declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof Obje
1194
1713
  */
1195
1714
  export declare type VanType = 'NICE' | 'KIS' | 'SMARTRO' | 'KOVAN';
1196
1715
 
1197
- declare class Websocket {
1716
+ /**
1717
+ * @publicApi
1718
+ */
1719
+ export declare class Websocket {
1198
1720
  private readonly url;
1199
1721
  private readonly headers;
1200
1722
  private readonly options?;
@@ -1221,7 +1743,10 @@ declare class Websocket {
1221
1743
  onOpen(callback: () => void): void;
1222
1744
  }
1223
1745
 
1224
- declare type WebsocketTypes = {
1746
+ /**
1747
+ * @publicApi
1748
+ */
1749
+ export declare type WebsocketTypes = {
1225
1750
  create: (url: string, headers: Record<string, string>, options?: {
1226
1751
  rejectUnauthorized?: boolean;
1227
1752
  followRedirects?: boolean;