@tossplace/pos-plugin-sdk 0.0.5 → 0.0.6

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,13 +1,6 @@
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";
@@ -37,12 +30,18 @@ declare type BarcodeResponse = {
37
30
  };
38
31
 
39
32
  declare type BaseInput = {
33
+ id: string;
34
+ label: string;
35
+ required: boolean;
36
+ };
37
+
38
+ declare type BaseInput_2 = {
40
39
  label: string;
41
40
  required: boolean;
42
41
  id: string;
43
42
  };
44
43
 
45
- declare type CancelCallback = (order: PluginOrder, payment: PluginPayment) => Promise<PluginCancelledPaymentDto | undefined>;
44
+ declare type CancelCallback = (order: PluginOrder, payment: PluginPayment, ui: Ui) => Promise<PluginCancelledPaymentDto | undefined>;
46
45
 
47
46
  /**
48
47
  * @schema
@@ -61,7 +60,10 @@ export declare type CashReceipt = {
61
60
  cardNumber: string;
62
61
  };
63
62
 
64
- declare interface CashReceiptTypes {
63
+ /**
64
+ * @publicApi
65
+ */
66
+ export declare interface CashReceiptTypes {
65
67
  add: (receipt: CashReceipt) => Promise<void>;
66
68
  }
67
69
 
@@ -70,14 +72,24 @@ declare interface CashReceiptTypes {
70
72
  */
71
73
  export declare interface Catalog {
72
74
  getCatalogs: () => Promise<PluginCatalogItem[]>;
73
- on: (event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: (menu: PluginCatalogItem) => void) => void;
75
+ on(event: 'sold-out' | 'on-sale' | 'update' | 'add' | 'delete', callback: CatalogEventCallback): void;
76
+ on(event: 'before-add', callback: CatalogRequiredResponseEventCallback): void;
74
77
  }
75
78
 
79
+ declare type CatalogEventCallback = (catalog: PluginCatalogItem) => void;
80
+
76
81
  /**
77
82
  * @publicApi
78
83
  */
79
84
  export declare type CatalogItemOptionChoiceState = 'ON_SALE' | 'SOLD_OUT';
80
85
 
86
+ declare type CatalogRequiredResponseEventCallback = (payload: {
87
+ payload: Partial<PluginCatalogItemDto>;
88
+ ui: Ui;
89
+ }) => Promise<{
90
+ initialValue?: PluginCatalogItemDto;
91
+ }>;
92
+
81
93
  /**
82
94
  * @publicApi
83
95
  */
@@ -99,7 +111,27 @@ declare type CheckBoxInput = Omit<BaseInput, 'placeholder'> & {
99
111
  values: InputValue[];
100
112
  };
101
113
 
102
- declare type DeliveryOrder = Order & {
114
+ /**
115
+ * @return 선택된 values id의 배열 string[]
116
+ * @example ['option1', 'option2']
117
+ */
118
+ declare type CheckBoxInput_2 = Omit<BaseInput_2, 'placeholder'> & {
119
+ type: 'checkbox';
120
+ /**
121
+ * @description 선택된 value의 id의 배열
122
+ */
123
+ default: string[];
124
+ values: InputValue_2[];
125
+ };
126
+
127
+ declare type CtaInput = {
128
+ type: 'cta';
129
+ id: string;
130
+ text: string;
131
+ ctaType: 'primary' | 'danger' | 'weak';
132
+ };
133
+
134
+ declare type DeliveryOrder = Order_2 & {
103
135
  type: 'DELIVERY';
104
136
  /**
105
137
  * 배달 주체
@@ -122,8 +154,85 @@ declare type DeliveryOrder = Order & {
122
154
  */
123
155
  declare type DeliveryStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLED' | 'CANCELLED' | 'RIDER_ASSIGNED' | 'RIDER_ARRIVE_SOON' | 'RIDER_PICKUP_COMPLETED' | 'DONE';
124
156
 
157
+ /**
158
+ * @publicApi
159
+ */
160
+ export declare interface Device {
161
+ getDeviceInfo(): Promise<DeviceInfo>;
162
+ }
163
+
164
+ /**
165
+ * @publicApi
166
+ */
167
+ export declare type DeviceInfo = {
168
+ name: string;
169
+ version: string;
170
+ platform: Platform;
171
+ arch: string;
172
+ /**
173
+ * 포스 고유번호
174
+ */
175
+ serialNumber: string;
176
+ /**
177
+ * os 버전을 가져옵니다.
178
+ * https://www.electronjs.org/docs/latest/api/process#processgetsystemversion
179
+ * Windows와 macos에서만 지원됩니다
180
+ */
181
+ osVersion?: string;
182
+ businessType: {
183
+ business: {
184
+ type: 'CARE' | 'RESTAURANT';
185
+ };
186
+ operation: {
187
+ payment: {
188
+ type: 'PAY_FIRST' | 'PAY_LATER';
189
+ };
190
+ table: {
191
+ enabled: boolean;
192
+ };
193
+ booking: {
194
+ enabled: boolean;
195
+ };
196
+ };
197
+ } | {
198
+ business: {
199
+ type: 'RETAIL' | 'SERVICE';
200
+ };
201
+ operation: {
202
+ payment: {
203
+ type: 'PAY_FIRST';
204
+ };
205
+ table: {
206
+ enabled: false;
207
+ };
208
+ booking: {
209
+ enabled: boolean;
210
+ };
211
+ };
212
+ };
213
+ };
214
+
125
215
  declare type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
126
216
 
217
+ /**
218
+ * @publicApi
219
+ */
220
+ export declare interface DraftOrder {
221
+ clear(): Promise<void>;
222
+ get(): Promise<PluginDraftOrder>;
223
+ addLineItem(lineItem: PluginDraftOrderItemDto): Promise<PluginDraftOrder>;
224
+ deleteLineItem(itemKey: string): Promise<PluginDraftOrder>;
225
+ updateItemQuantity(itemKey: string, quantity: number): Promise<PluginDraftOrder>;
226
+ updateItemOptionChoice(itemKey: string, choices: PluginCatalogItemOptionChoice[]): Promise<PluginDraftOrder>;
227
+ updateItemMemo(itemKey: string, memo: string): Promise<PluginDraftOrder>;
228
+ updateIgnorePrint(ignorePrint: boolean): Promise<PluginDraftOrder>;
229
+ deleteDiscount(indexOfDiscount: number): Promise<PluginDraftOrder>;
230
+ deleteItemDiscount(itemKey: string, indexOfDiscount: number): Promise<PluginDraftOrder>;
231
+ startPayment(): Promise<void>;
232
+ }
233
+
234
+ declare type Element_2 = BarcodeElements | InputElements;
235
+
127
236
  /**
128
237
  * @publicApi
129
238
  */
@@ -192,7 +301,10 @@ declare type FFIFunctionParam = {
192
301
  */
193
302
  declare type FFIFunctionReturn = 'void' | 'str' | 'int' | 'bool' | 'wchar *' | 'void *';
194
303
 
195
- declare interface FFITypes {
304
+ /**
305
+ * @publicApi
306
+ */
307
+ export declare interface FFITypes {
196
308
  download: (downloadInfo: FFIDownloadInfo) => Promise<{
197
309
  platform: keyof FFIDownloadInfo;
198
310
  }>;
@@ -206,14 +318,9 @@ declare interface FFITypes {
206
318
  addCallbackErrorHandler: (filePath: string, handler: (error: Error) => void) => void;
207
319
  }
208
320
 
209
- declare function getPluginInfo(): Promise<{
210
- name: string;
211
- version: string;
212
- }>;
213
-
214
321
  declare function getValues<T extends Record<string, number | string | string[] | boolean | undefined>>(): Promise<T>;
215
322
 
216
- declare type HereOrder = Order & {
323
+ declare type HereOrder = Order_2 & {
217
324
  type: 'HERE';
218
325
  memo: {
219
326
  store?: string;
@@ -246,15 +353,52 @@ export declare interface HttpTypes {
246
353
  patch: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
247
354
  }
248
355
 
356
+ declare type InputElements = {
357
+ type: 'input';
358
+ inputs: PluginInputs[];
359
+ title: string;
360
+ description?: string;
361
+ cta: {
362
+ cancel?: CtaInput;
363
+ submit: CtaInput;
364
+ };
365
+ };
366
+
367
+ declare type InputResponse = {
368
+ type: 'input';
369
+ complete: true;
370
+ data: {
371
+ inputs: Record<string, string | number | boolean | string[]>;
372
+ result: 'SUCCESS';
373
+ } | {
374
+ result: 'CANCELLED';
375
+ };
376
+ } | {
377
+ type: 'input';
378
+ complete: false;
379
+ errorMessage: string;
380
+ };
381
+
249
382
  declare type InputValue = {
250
383
  id: string;
251
384
  label: string;
252
385
  };
253
386
 
387
+ declare type InputValue_2 = {
388
+ id: string;
389
+ label: string;
390
+ };
391
+
254
392
  declare type Join<T extends string, U extends string> = `${T}${U}` | '0';
255
393
 
256
394
  declare type Languages = Record<PluginLanguageCode, string>;
257
395
 
396
+ /**
397
+ * @publicApi
398
+ * @deprecated
399
+ */
400
+ declare type LegacyPluginInputType = PluginInputsLegacy['type'];
401
+
258
402
  /**
259
403
  * @publicApi
260
404
  */
@@ -266,13 +410,78 @@ export declare interface MenuOption {
266
410
  /**
267
411
  * @publicApi
268
412
  */
269
- export declare interface MerchantTypes {
413
+ export declare interface Merchant {
270
414
  getMerchant: () => Promise<TossMerchant>;
271
415
  }
272
416
 
273
- declare function on(event: 'close', callback: () => Promise<void>): void;
417
+ /**
418
+ * @publicApi
419
+ */
420
+ export declare interface Navigation {
421
+ navigate(page: 'plugin-tab', packageName?: string): void;
422
+ navigate(page: 'business-type-setting'): void;
423
+ /**
424
+ * 포스에서 페이지를 이동합니다.
425
+ * @param page business-type-setting 업종유형 변경, plugin-tab 플러그인 탭 이동
426
+ * @param packageName 이동할 탭의 이름, 없는 경우 첫번째 플러그인 탭으로 이동합니다
427
+ */
428
+ navigate(page: 'business-type-setting' | 'plugin-tab', packageName?: string): void;
429
+ }
430
+
431
+ /**
432
+ * @publicApi
433
+ */
434
+ export declare class NavigationImpl implements Navigation {
435
+ navigate(page: 'plugin-tab', packageName?: string): void;
436
+ navigate(page: 'business-type-setting'): void;
437
+ }
438
+
439
+ /**
440
+ * @return number
441
+ */
442
+ declare type NumberInput = BaseInput & {
443
+ type: 'number';
444
+ default: number;
445
+ placeholder?: string;
446
+ suffix?: string;
447
+ /**
448
+ * @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
449
+ * @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
450
+ */
451
+ candidates?: {
452
+ text: string;
453
+ value: number;
454
+ }[];
455
+ };
274
456
 
275
- declare type Order = {
457
+ /**
458
+ * @publicApi
459
+ */
460
+ export declare interface Order {
461
+ getOrder: (id: string) => Promise<PluginOrder>;
462
+ /**
463
+ * @param start yyyyMMdd
464
+ * @param end yyyyMMdd
465
+ * @description createdAt 기준으로 주문을 조회합니다
466
+ */
467
+ getOrders: (range: {
468
+ start: string;
469
+ end: string;
470
+ }) => Promise<PluginOrder[]>;
471
+ /**
472
+ * 토스 포스에서 카드결제를 취소하면 무조건 카드리딩해야함 그래서 on cancel은 늘 환불까지 된 상태임
473
+ */
474
+ on: (event: 'cancel', callback: (order: PluginOrder) => void) => void;
475
+ cancel: (id: string) => Promise<void>;
476
+ add: (order: PluginOrderDto) => Promise<PluginOrder>;
477
+ /**
478
+ * 새로 추가 된 메뉴만 order에 넣으세요
479
+ */
480
+ addMenu: (orderId: string, order: PluginOrderDto) => Promise<PluginOrder>;
481
+ complete: (id: string) => Promise<PluginOrder>;
482
+ }
483
+
484
+ declare type Order_2 = {
276
485
  /**
277
486
  * 포스(사장님)에게 보여줄 주문유형
278
487
  * @example 가게배달, 장보기/쇼핑, 픽업, 배민1 등등
@@ -317,33 +526,41 @@ declare type Order = {
317
526
  declare type OrderItemType = 'ITEM' | 'DELIVERY_FEE' | 'PREPAID_CARD' | 'MULTI_USE_TICKET';
318
527
 
319
528
  /**
320
- * @publicApi
529
+ * @return string
321
530
  */
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
- }
531
+ declare type PasswordInput = BaseInput & {
532
+ type: 'password';
533
+ default: string;
534
+ placeholder?: string;
535
+ };
336
536
 
337
537
  /**
338
538
  * @return string
339
539
  */
340
- declare type PasswordInput = BaseInput & {
540
+ declare type PasswordInput_2 = BaseInput_2 & {
341
541
  type: 'password';
342
542
  default: string;
343
543
  placeholder?: string;
344
544
  };
345
545
 
346
- declare type PayCallback = (order: PluginOrder, price: PluginPrice) => Promise<PaymentMethodResponse | undefined>;
546
+ declare type PayCallback = (order: PluginOrder, price: PluginPrice, ui: Ui) => Promise<PaymentMethodResponse | undefined>;
547
+
548
+ /**
549
+ * @publicApi
550
+ */
551
+ export declare interface Payment {
552
+ on: (event: 'cancel' | 'paid', callback: PaymentCallback) => void;
553
+ cancel: (order: {
554
+ id: string;
555
+ }, payment: {
556
+ id: string;
557
+ }) => Promise<void>;
558
+ add: (order: {
559
+ id: string;
560
+ }, paymentDto: PluginPaymentDto) => Promise<PluginPaymentOf<'CARD'> | PluginPaymentOf<'CASH'> | PluginPaymentOf<'EXTERNAL'>>;
561
+ }
562
+
563
+ declare type PaymentCallback = (payment: PluginPayment, order: PluginOrder) => void;
347
564
 
348
565
  /**
349
566
  * @publicApi
@@ -359,7 +576,10 @@ export declare type PaymentMethodResponse = {
359
576
  paymentKey: string;
360
577
  };
361
578
 
362
- declare type PaymentMethodType = {
579
+ /**
580
+ * @publicApi
581
+ */
582
+ export declare type PaymentMethodType = {
363
583
  add: (payload: {
364
584
  data: {
365
585
  /**
@@ -379,19 +599,7 @@ declare type PaymentMethodType = {
379
599
  }) => void;
380
600
  };
381
601
 
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 & {
602
+ declare type PickupOrder = Order_2 & {
395
603
  type: 'PICKUP';
396
604
  memo: {
397
605
  store?: string;
@@ -400,10 +608,65 @@ declare type PickupOrder = Order & {
400
608
  status: StoreStatus;
401
609
  };
402
610
 
403
- declare const plugin: {
404
- on: typeof on;
405
- getPluginInfo: typeof getPluginInfo;
406
- };
611
+ /**
612
+ * @publicApi
613
+ */
614
+ declare type Platform = 'macos' | 'windows' | 'android' | 'ios' | 'unknown';
615
+
616
+ /**
617
+ * @publicApi
618
+ */
619
+ export declare const plugin: PluginImpl;
620
+
621
+ /**
622
+ * @publicApi
623
+ */
624
+ declare interface Plugin_2 {
625
+ on(event: 'close', callback: () => Promise<void>): void;
626
+ getPluginInfo(): Promise<{
627
+ name: string;
628
+ version: string;
629
+ }>;
630
+ }
631
+ export { Plugin_2 as Plugin }
632
+
633
+ /**
634
+ * @publicApi
635
+ */
636
+ declare interface PluginAccountTransferPayment extends PluginPaymentBase {
637
+ sourceType: 'ACCOUNT_TRANSFER';
638
+ /** 계좌이체 정보 */
639
+ accountTransfer: {
640
+ /** 은행코드 */
641
+ bankCode: number;
642
+ /** 계좌번호 */
643
+ accountNumber: string;
644
+ };
645
+ }
646
+
647
+ /**
648
+ * @publicApi
649
+ */
650
+ declare interface PluginBarcodePayment extends PluginPaymentBase {
651
+ sourceType: 'BARCODE';
652
+ externalDetails: {
653
+ installmentMonth: PluginPaymentInstallment;
654
+ /**
655
+ * 발급사명
656
+ * @example 토스페이, 네이버체크, 카카오페이머니, ...
657
+ */
658
+ source: string;
659
+ /**
660
+ * 간편결제 구분자
661
+ * @example KKF, SG2, ZRP, ...
662
+ */
663
+ sourceId: string;
664
+ sourceType?: PluginPaymentExternalSourceType;
665
+ /** 매입사명 */
666
+ cardBrand?: string;
667
+ cardNo?: string;
668
+ };
669
+ }
407
670
 
408
671
  /**
409
672
  * @publicApi
@@ -503,6 +766,10 @@ export declare interface PluginCatalogItem {
503
766
  * @description 토스 포스에 등록된 메뉴의 고유 아이디
504
767
  */
505
768
  id: number;
769
+ /**
770
+ * 플러그인에서 생성하면 토스포스 서버에 저장되어 항상 같이 내려옴
771
+ */
772
+ code?: string;
506
773
  /**
507
774
  * @description 포스 내에서 보여주는 타이틀
508
775
  * @description 사장님께만 보입니다
@@ -530,7 +797,7 @@ export declare interface PluginCatalogItem {
530
797
  * @description 메뉴에 달린 벳지입니다
531
798
  */
532
799
  labels: PluginCatalogItemLabel[];
533
- imageUrl: string | null;
800
+ imageUrl?: string;
534
801
  /**
535
802
  * @description 상품의 가격정보
536
803
  */
@@ -539,6 +806,13 @@ export declare interface PluginCatalogItem {
539
806
  * @description 상품에서 사용가능한 옵션 리스트
540
807
  */
541
808
  options: PluginCatalogItemOption[];
809
+ /** POS에서 상품 표시시 색상 정보 */
810
+ color?: string;
811
+ /** 제조 및 유통 정보 */
812
+ provenance?: {
813
+ /** 제조사 */
814
+ displayProvenance: string;
815
+ };
542
816
  }
543
817
 
544
818
  /**
@@ -554,14 +828,20 @@ export declare interface PluginCatalogItemDto {
554
828
  description?: string;
555
829
  descriptionI18n?: PluginLanguagePack;
556
830
  categoryId: number;
557
- price: PluginCatalogItemPrice;
831
+ price: PluginCatalogItemPriceDto;
558
832
  labels: PluginCatalogItemLabel[];
559
- imageUrl: string | null;
833
+ imageUrl?: string;
560
834
  /**
561
835
  * @description 옵션을 먼저 만들고 id를 넣어달라
562
836
  */
563
837
  options: Pick<PluginCatalogItemOption, 'id'>[];
564
- kioskTitle?: string;
838
+ /** POS에서 상품 표시시 색상 정보 */
839
+ color?: string;
840
+ /** 제조 및 유통 정보 */
841
+ provenance?: {
842
+ /** 제조사 */
843
+ displayProvenance: string;
844
+ };
565
845
  }
566
846
 
567
847
  /**
@@ -626,9 +906,9 @@ export declare interface PluginCatalogItemPrice {
626
906
  * 재고 관리 코드
627
907
  * @see https://en.wikipedia.org/wiki/Stock_keeping_unit
628
908
  */
629
- sku: string | null;
909
+ sku?: string;
630
910
  /** 상품 가격의 바코드 정보 */
631
- barcode: string | null;
911
+ barcode?: string;
632
912
  /** 가격 유형 */
633
913
  priceType: PluginCatalogItemPriceType;
634
914
  /** 가격의 기본 개수 */
@@ -642,10 +922,30 @@ export declare interface PluginCatalogItemPrice {
642
922
  /** 재고 관리여부 */
643
923
  isStockable: boolean;
644
924
  /** 현재 남아있는 재고 수 */
645
- stockQuantity: {
925
+ stockQuantity?: {
646
926
  remainQuantity: number;
647
927
  lastChangeDateTime: string;
648
- } | null;
928
+ };
929
+ }
930
+
931
+ /**
932
+ * @publicApi
933
+ */
934
+ export declare interface PluginCatalogItemPriceDto {
935
+ /** 상품 가격명 */
936
+ title: string;
937
+ /** 상품 가격의 바코드 정보 */
938
+ barcode?: string;
939
+ /** 가격 유형 */
940
+ priceType: PluginCatalogItemPriceType;
941
+ /** 가격의 기본 개수 */
942
+ priceUnit: number;
943
+ /**
944
+ * 부가가치세(VAT)가 포함된 가격
945
+ */
946
+ priceValue: number;
947
+ /** 비과세 여부 */
948
+ isTaxFree: boolean;
649
949
  }
650
950
 
651
951
  /**
@@ -689,6 +989,105 @@ export declare interface PluginDiscount {
689
989
  titleI18n?: PluginLanguagePack;
690
990
  }
691
991
 
992
+ /**
993
+ * @publicApi
994
+ */
995
+ export declare interface PluginDraftOrder {
996
+ /**
997
+ * 주문ID
998
+ * 서버 주문을 클라이언트 주문으로 변경했을 때 값이 존재
999
+ */
1000
+ id?: string;
1001
+ /** 주문 항목 목록 */
1002
+ lineItems: Array<PluginDraftOrderItem>;
1003
+ /** 주문 요청사항 */
1004
+ memo?: string;
1005
+ /** 주문에 적용된 할인 목록 */
1006
+ discounts: PluginDiscount[];
1007
+ price: PluginDraftOrderPrice;
1008
+ /**
1009
+ * 이 주문에 대해 프린트 출력을 무시할지 여부
1010
+ * 이 옵션이 켜져 있는 경우 다른 포스에서도 프린트 출력이 무시됩니다.
1011
+ * 기본값은 false입니다.
1012
+ */
1013
+ ignorePrint: boolean;
1014
+ }
1015
+
1016
+ /**
1017
+ * @publicApi
1018
+ */
1019
+ export declare interface PluginDraftOrderItem {
1020
+ /**
1021
+ * 넣지 않으면 자동으로 생성됨
1022
+ */
1023
+ key: string;
1024
+ /** 상품 정보 */
1025
+ item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'options' | 'code'> & {
1026
+ type: OrderItemType;
1027
+ };
1028
+ /** 상품 가격 정보 */
1029
+ itemPrice: Pick<PluginCatalogItemPrice, 'id' | 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
1030
+ /** 적용된 할인 목록 */
1031
+ discount: PluginDiscount[];
1032
+ /** 요청사항 */
1033
+ memo: string;
1034
+ /** 선택된 옵션 정보 */
1035
+ optionChoices: PluginCatalogItemOptionChoice[];
1036
+ /** 수량 */
1037
+ quantity: number;
1038
+ /** 식사 유형 */
1039
+ diningOption: PluginOrderDiningOption;
1040
+ /**
1041
+ * 서버에서 생성된 lineItemId
1042
+ */
1043
+ lineItemId?: string;
1044
+ metadata?: {
1045
+ /**
1046
+ * true : 유저가 메모 수정 불가
1047
+ */
1048
+ disableMemoEdit?: boolean;
1049
+ /**
1050
+ * true : 유저가 옵션 수정 불가
1051
+ */
1052
+ disableOptionEdit?: boolean;
1053
+ /**
1054
+ * true : 유저가 수량 변경 불가
1055
+ */
1056
+ disableQuantityEdit?: boolean;
1057
+ };
1058
+ }
1059
+
1060
+ /**
1061
+ * @publicApi
1062
+ * @desription key는 넣으면 할당되고 없으면 포스에서 자동생성
1063
+ */
1064
+ declare type PluginDraftOrderItemDto = PluginDraftOrderItem & {
1065
+ key?: string;
1066
+ itemPrice: Pick<PluginCatalogItemPrice, 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
1067
+ };
1068
+
1069
+ declare interface PluginDraftOrderPrice {
1070
+ /** (-)할인 금액 */
1071
+ orderDiscountValue: number;
1072
+ /**
1073
+ * 원주문 금액
1074
+ * Σ OrderItem.orderPrice.orderListPriceValue
1075
+ */
1076
+ orderListPriceValue: number;
1077
+ /**
1078
+ * 주문 금액 = 원주문금액 + 할인 금액 + 보증금 + 봉사료
1079
+ *
1080
+ * @see 보증금: DraftOrder.bookingFee
1081
+ */
1082
+ orderPriceValue: number;
1083
+ /** 봉사료 */
1084
+ orderTipValue: number;
1085
+ }
1086
+
1087
+ /**
1088
+ * 밴을 통하지 않으면 바코드결제라고 해도 externalPayment로 처리해주세요
1089
+ * 취소를 플러그인에서 따로 처리해야하면 externalPayment로 처리해주세요
1090
+ */
692
1091
  declare interface PluginExternalDto extends PluginPaymentDtoBase {
693
1092
  sourceType: 'EXTERNAL';
694
1093
  }
@@ -734,18 +1133,32 @@ export declare type PluginHttpResponse = {
734
1133
  code: number;
735
1134
  };
736
1135
 
1136
+ declare class PluginImpl implements Plugin_2 {
1137
+ private readonly webview;
1138
+ private pluginCallbacks;
1139
+ constructor(webview: WebView);
1140
+ private initializePlugin;
1141
+ on(event: 'close', callback: () => Promise<void>): void;
1142
+ getPluginInfo(): Promise<{
1143
+ name: string;
1144
+ version: string;
1145
+ }>;
1146
+ }
1147
+
737
1148
  /**
738
1149
  * @publicApi
739
1150
  * @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
740
1151
  */
741
- export declare type PluginInputs<T extends PluginInputType = any> = Extract<TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput, {
742
- type: T;
743
- }>;
1152
+ export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
744
1153
 
745
1154
  /**
746
1155
  * @publicApi
1156
+ * @deprecated
1157
+ * @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
747
1158
  */
748
- declare type PluginInputType = PluginInputs['type'];
1159
+ declare type PluginInputsLegacy<T extends LegacyPluginInputType = any> = Extract<TextInput_2 | PasswordInput_2 | RadioInput_2 | CheckBoxInput_2 | ToggleInput_2 | SliderInput_2, {
1160
+ type: T;
1161
+ }>;
749
1162
 
750
1163
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
751
1164
 
@@ -757,6 +1170,26 @@ export declare interface PluginLanguagePack {
757
1170
  languages: Partial<Languages>;
758
1171
  }
759
1172
 
1173
+ /**
1174
+ * @publicApi
1175
+ */
1176
+ export declare interface PluginMessenger {
1177
+ broadcast<T = any>(message: T): void;
1178
+ on<T = any>(event: 'message', callback: (message: T) => void): void;
1179
+ }
1180
+
1181
+ /**
1182
+ * @publicApi
1183
+ */
1184
+ export declare const pluginMessenger: PluginMessengerImpl;
1185
+
1186
+ declare class PluginMessengerImpl implements PluginMessenger {
1187
+ private readonly webview;
1188
+ constructor(webview: WebView);
1189
+ broadcast<T = any>(message: T): void;
1190
+ on<T = any>(event: 'message', callback: (message: T) => void): void;
1191
+ }
1192
+
760
1193
  /**
761
1194
  * @publicApi
762
1195
  * @description pluginOrder orderDto를 서버에 저장 후 가공해서 내려 준 값
@@ -784,9 +1217,13 @@ export declare interface PluginOrder {
784
1217
  source: string;
785
1218
  memo?: string;
786
1219
  /**
1220
+ * @description 주문시각
787
1221
  * 해당값이 있다면 createdAt 대신 사용해주세요.
788
1222
  */
789
1223
  openedAt?: string;
1224
+ /**
1225
+ * @description 생성시각
1226
+ */
790
1227
  createdAt: string;
791
1228
  updatedAt?: string;
792
1229
  cancelledAt?: string;
@@ -840,14 +1277,14 @@ export declare interface PluginOrderItem {
840
1277
  id: string;
841
1278
  orderId: string;
842
1279
  diningOption: PluginOrderDiningOption;
843
- item: Pick<PluginCatalogItem, 'id' | 'title' | 'category'> & {
1280
+ item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'code'> & {
844
1281
  type: OrderItemType;
845
1282
  };
846
1283
  quantity: {
847
1284
  value: number;
848
1285
  };
849
1286
  /**
850
- * @description 실제 고객이 결제하는 금액에 대한 정보입니다.
1287
+ * @description 실제 고객이 결제하는 금액에 대한 정보입니다. (할인 적용 금액)
851
1288
  */
852
1289
  chargePrice: {
853
1290
  value: number;
@@ -911,7 +1348,7 @@ export declare type PluginOrderState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'C
911
1348
  /**
912
1349
  * @publicApi
913
1350
  */
914
- export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment) & {
1351
+ export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment | PluginAccountTransferPayment | PluginBarcodePayment) & {
915
1352
  paymentKey: string;
916
1353
  };
917
1354
 
@@ -976,6 +1413,11 @@ declare type PluginPaymentDtoBase = Pick<PluginPayment,
976
1413
  */
977
1414
  'orderId' | 'sourceType' | 'amountMoney' | 'taxMoney' | 'approvedNo' | 'approvedAt' | 'paymentKey' | 'supplyMoney' | 'tipMoney' | 'taxExemptMoney'>;
978
1415
 
1416
+ /**
1417
+ * @publicApi
1418
+ */
1419
+ declare type PluginPaymentExternalSourceType = 'CARD' | 'BANK_TRANSFER' | 'OTHER_GIFT_CARD' | 'POINT' | 'COUPON' | 'OTHER';
1420
+
979
1421
  /**
980
1422
  * @publicApi
981
1423
  * 할부개월 수
@@ -998,7 +1440,7 @@ export declare type PluginPaymentOf<S extends PluginPaymentSourceType> = Extract
998
1440
  * BARCODE: 바코드/QR을 사용하는 간편결제
999
1441
  * EXTERNAL: 기타결제(쿠폰, 외상 등)
1000
1442
  */
1001
- export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL';
1443
+ export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL' | 'BARCODE' | 'ACCOUNT_TRANSFER';
1002
1444
 
1003
1445
  /**
1004
1446
  * @publicApi
@@ -1044,22 +1486,26 @@ export declare interface PluginTableGroup {
1044
1486
  tableIds: number[];
1045
1487
  }
1046
1488
 
1047
- declare type PluginTypes = typeof plugin;
1048
-
1049
1489
  /**
1050
1490
  * @publicApi
1051
1491
  */
1052
- export declare type PopupActionResponse<T extends AllPopupType> = Extract<AllPopupResponse, {
1492
+ export declare type PopupActionResponse<T extends PopupType> = Extract<Response_2, {
1053
1493
  type: T;
1054
- }>;
1494
+ complete: true;
1495
+ }>['data'];
1055
1496
 
1056
1497
  /**
1057
1498
  * @publicApi
1058
1499
  */
1059
- export declare type PopupElements<T extends AllPopupType> = Extract<AllPopupElements, {
1500
+ export declare type PopupElement<T extends PopupType> = Extract<Element_2, {
1060
1501
  type: T;
1061
1502
  }>;
1062
1503
 
1504
+ /**
1505
+ * @publicApi
1506
+ */
1507
+ declare type PopupType = Element_2['type'];
1508
+
1063
1509
  /**
1064
1510
  * @publicApi
1065
1511
  */
@@ -1070,17 +1516,20 @@ export declare type PosPluginSdk = {
1070
1516
  option: MenuOption;
1071
1517
  storage: StorageTypes;
1072
1518
  cashReceipt: CashReceiptTypes;
1073
- order: OrderTypes;
1074
- payment: PaymentTypes;
1519
+ order: Order;
1520
+ payment: Payment;
1075
1521
  http: HttpTypes;
1076
1522
  toast: ToastTypes;
1077
- merchant: MerchantTypes;
1078
- ui: UiType;
1523
+ device: Device;
1524
+ merchant: Merchant;
1079
1525
  paymentMethod: PaymentMethodType;
1080
1526
  websocket: WebsocketTypes;
1081
1527
  ffi: FFITypes;
1082
- plugin: PluginTypes;
1528
+ plugin: Plugin_2;
1529
+ pluginMessenger: PluginMessenger;
1083
1530
  setting: SettingTypes;
1531
+ draftOrder: DraftOrder;
1532
+ navigation: Navigation;
1084
1533
  };
1085
1534
 
1086
1535
  /**
@@ -1108,14 +1557,31 @@ declare type RadioInput = Omit<BaseInput, 'placeholder'> & {
1108
1557
  values: InputValue[];
1109
1558
  };
1110
1559
 
1111
- declare function setInputs(inputs: Array<PluginInputs>): void;
1560
+ /**
1561
+ * @return string values.id
1562
+ */
1563
+ declare type RadioInput_2 = Omit<BaseInput_2, 'placeholder'> & {
1564
+ type: 'radio';
1565
+ /**
1566
+ * @desciption 선택된 value의 id
1567
+ */
1568
+ default: string;
1569
+ values: InputValue_2[];
1570
+ };
1571
+
1572
+ declare type Response_2 = BarcodeResponse | InputResponse;
1573
+
1574
+ declare function setInputs(inputs: Array<PluginInputsLegacy>): void;
1112
1575
 
1113
1576
  declare const setting: {
1114
1577
  setInputs: typeof setInputs;
1115
1578
  getValues: typeof getValues;
1116
1579
  };
1117
1580
 
1118
- declare type SettingTypes = typeof setting;
1581
+ /**
1582
+ * @publicApi
1583
+ */
1584
+ export declare type SettingTypes = typeof setting;
1119
1585
 
1120
1586
  /**
1121
1587
  * @return number 0 25 50 75 100
@@ -1128,6 +1594,17 @@ declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
1128
1594
  step: number;
1129
1595
  };
1130
1596
 
1597
+ /**
1598
+ * @return number 0 25 50 75 100
1599
+ */
1600
+ declare type SliderInput_2 = Omit<BaseInput_2, 'placeholder'> & {
1601
+ type: 'slider';
1602
+ default: number;
1603
+ min: number;
1604
+ max: number;
1605
+ step: number;
1606
+ };
1607
+
1131
1608
  /**
1132
1609
  * @publicApi
1133
1610
  */
@@ -1146,7 +1623,10 @@ declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLE
1146
1623
  */
1147
1624
  | 'DONE';
1148
1625
 
1149
- declare interface Table {
1626
+ /**
1627
+ * @publicApi
1628
+ */
1629
+ export declare interface Table {
1150
1630
  getTables: () => Promise<{
1151
1631
  table: PluginTable;
1152
1632
  order?: PluginOrder;
@@ -1167,9 +1647,30 @@ declare type TextInput = BaseInput & {
1167
1647
  type: 'text';
1168
1648
  default: string;
1169
1649
  placeholder?: string;
1650
+ suffix?: string;
1651
+ /**
1652
+ * @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
1653
+ * @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
1654
+ */
1655
+ candidates?: {
1656
+ text: string;
1657
+ value: string;
1658
+ }[];
1659
+ };
1660
+
1661
+ /**
1662
+ * @return string
1663
+ */
1664
+ declare type TextInput_2 = BaseInput_2 & {
1665
+ type: 'text';
1666
+ default: string;
1667
+ placeholder?: string;
1170
1668
  };
1171
1669
 
1172
- declare type ToastTypes = {
1670
+ /**
1671
+ * @publicApi
1672
+ */
1673
+ export declare type ToastTypes = {
1173
1674
  open(message: string): void;
1174
1675
  };
1175
1676
 
@@ -1181,6 +1682,14 @@ declare type ToggleInput = Omit<BaseInput, 'placeholder'> & {
1181
1682
  default: boolean;
1182
1683
  };
1183
1684
 
1685
+ /**
1686
+ * @return boolean
1687
+ */
1688
+ declare type ToggleInput_2 = Omit<BaseInput_2, 'placeholder'> & {
1689
+ type: 'toggle';
1690
+ default: boolean;
1691
+ };
1692
+
1184
1693
  /**
1185
1694
  * @publicApi
1186
1695
  * @description 추후에 필요한 정보 더 추가될 예정
@@ -1189,6 +1698,10 @@ export declare type TossMerchant = {
1189
1698
  name: string;
1190
1699
  id: number;
1191
1700
  businessNumber: string;
1701
+ /**
1702
+ * @deprecated
1703
+ * @see DeviceInfo.serialNumber
1704
+ */
1192
1705
  serialNumber: string;
1193
1706
  franchise?: {
1194
1707
  id: string;
@@ -1196,8 +1709,12 @@ export declare type TossMerchant = {
1196
1709
  };
1197
1710
  };
1198
1711
 
1199
- declare type UiType = {
1200
- openPopup<T extends AllPopupType>(message: PopupElements<T>): Promise<PopupActionResponse<T>>;
1712
+ /**
1713
+ * @publicApi
1714
+ */
1715
+ export declare type Ui = {
1716
+ openBarcode(message: Omit<PopupElement<'barcode'>, 'type'>): Promise<PopupActionResponse<'barcode'>>;
1717
+ openInputModal(message: Omit<PopupElement<'input'>, 'type'>): Promise<PopupActionResponse<'input'>>;
1201
1718
  };
1202
1719
 
1203
1720
  declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
@@ -1234,7 +1751,10 @@ declare class Websocket {
1234
1751
  onOpen(callback: () => void): void;
1235
1752
  }
1236
1753
 
1237
- declare type WebsocketTypes = {
1754
+ /**
1755
+ * @publicApi
1756
+ */
1757
+ export declare type WebsocketTypes = {
1238
1758
  create: (url: string, headers: Record<string, string>, options?: {
1239
1759
  rejectUnauthorized?: boolean;
1240
1760
  followRedirects?: boolean;