@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/types/index.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
  */
@@ -179,7 +288,10 @@ declare type FFIFunctionParam = {
179
288
  */
180
289
  declare type FFIFunctionReturn = 'void' | 'str' | 'int' | 'bool' | 'wchar *' | 'void *';
181
290
 
182
- declare interface FFITypes {
291
+ /**
292
+ * @publicApi
293
+ */
294
+ export declare interface FFITypes {
183
295
  download: (downloadInfo: FFIDownloadInfo) => Promise<{
184
296
  platform: keyof FFIDownloadInfo;
185
297
  }>;
@@ -193,14 +305,9 @@ declare interface FFITypes {
193
305
  addCallbackErrorHandler: (filePath: string, handler: (error: Error) => void) => void;
194
306
  }
195
307
 
196
- declare function getPluginInfo(): Promise<{
197
- name: string;
198
- version: string;
199
- }>;
200
-
201
308
  declare function getValues<T extends Record<string, number | string | string[] | boolean | undefined>>(): Promise<T>;
202
309
 
203
- declare type HereOrder = Order & {
310
+ declare type HereOrder = Order_2 & {
204
311
  type: 'HERE';
205
312
  memo: {
206
313
  store?: string;
@@ -233,15 +340,52 @@ export declare interface HttpTypes {
233
340
  patch: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
234
341
  }
235
342
 
343
+ declare type InputElements = {
344
+ type: 'input';
345
+ inputs: PluginInputs[];
346
+ title: string;
347
+ description?: string;
348
+ cta: {
349
+ cancel?: CtaInput;
350
+ submit: CtaInput;
351
+ };
352
+ };
353
+
354
+ declare type InputResponse = {
355
+ type: 'input';
356
+ complete: true;
357
+ data: {
358
+ inputs: Record<string, string | number | boolean | string[]>;
359
+ result: 'SUCCESS';
360
+ } | {
361
+ result: 'CANCELLED';
362
+ };
363
+ } | {
364
+ type: 'input';
365
+ complete: false;
366
+ errorMessage: string;
367
+ };
368
+
236
369
  declare type InputValue = {
237
370
  id: string;
238
371
  label: string;
239
372
  };
240
373
 
374
+ declare type InputValue_2 = {
375
+ id: string;
376
+ label: string;
377
+ };
378
+
241
379
  declare type Join<T extends string, U extends string> = `${T}${U}` | '0';
242
380
 
243
381
  declare type Languages = Record<PluginLanguageCode, string>;
244
382
 
383
+ /**
384
+ * @publicApi
385
+ * @deprecated
386
+ */
387
+ declare type LegacyPluginInputType = PluginInputsLegacy['type'];
388
+
245
389
  /**
246
390
  * @publicApi
247
391
  */
@@ -253,13 +397,78 @@ export declare interface MenuOption {
253
397
  /**
254
398
  * @publicApi
255
399
  */
256
- export declare interface MerchantTypes {
400
+ export declare interface Merchant {
257
401
  getMerchant: () => Promise<TossMerchant>;
258
402
  }
259
403
 
260
- declare function on(event: 'close', callback: () => Promise<void>): void;
404
+ /**
405
+ * @publicApi
406
+ */
407
+ export declare interface Navigation {
408
+ navigate(page: 'plugin-tab', packageName?: string): void;
409
+ navigate(page: 'business-type-setting'): void;
410
+ /**
411
+ * 포스에서 페이지를 이동합니다.
412
+ * @param page business-type-setting 업종유형 변경, plugin-tab 플러그인 탭 이동
413
+ * @param packageName 이동할 탭의 이름, 없는 경우 첫번째 플러그인 탭으로 이동합니다
414
+ */
415
+ navigate(page: 'business-type-setting' | 'plugin-tab', packageName?: string): void;
416
+ }
417
+
418
+ /**
419
+ * @publicApi
420
+ */
421
+ export declare class NavigationImpl implements Navigation {
422
+ navigate(page: 'plugin-tab', packageName?: string): void;
423
+ navigate(page: 'business-type-setting'): void;
424
+ }
425
+
426
+ /**
427
+ * @return number
428
+ */
429
+ declare type NumberInput = BaseInput & {
430
+ type: 'number';
431
+ default: number;
432
+ placeholder?: string;
433
+ suffix?: string;
434
+ /**
435
+ * @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
436
+ * @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
437
+ */
438
+ candidates?: {
439
+ text: string;
440
+ value: number;
441
+ }[];
442
+ };
261
443
 
262
- declare type Order = {
444
+ /**
445
+ * @publicApi
446
+ */
447
+ export declare interface Order {
448
+ getOrder: (id: string) => Promise<PluginOrder>;
449
+ /**
450
+ * @param start yyyyMMdd
451
+ * @param end yyyyMMdd
452
+ * @description createdAt 기준으로 주문을 조회합니다
453
+ */
454
+ getOrders: (range: {
455
+ start: string;
456
+ end: string;
457
+ }) => Promise<PluginOrder[]>;
458
+ /**
459
+ * 토스 포스에서 카드결제를 취소하면 무조건 카드리딩해야함 그래서 on cancel은 늘 환불까지 된 상태임
460
+ */
461
+ on: (event: 'cancel', callback: (order: PluginOrder) => void) => void;
462
+ cancel: (id: string) => Promise<void>;
463
+ add: (order: PluginOrderDto) => Promise<PluginOrder>;
464
+ /**
465
+ * 새로 추가 된 메뉴만 order에 넣으세요
466
+ */
467
+ addMenu: (orderId: string, order: PluginOrderDto) => Promise<PluginOrder>;
468
+ complete: (id: string) => Promise<PluginOrder>;
469
+ }
470
+
471
+ declare type Order_2 = {
263
472
  /**
264
473
  * 포스(사장님)에게 보여줄 주문유형
265
474
  * @example 가게배달, 장보기/쇼핑, 픽업, 배민1 등등
@@ -304,33 +513,41 @@ declare type Order = {
304
513
  declare type OrderItemType = 'ITEM' | 'DELIVERY_FEE' | 'PREPAID_CARD' | 'MULTI_USE_TICKET';
305
514
 
306
515
  /**
307
- * @publicApi
516
+ * @return string
308
517
  */
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
- }
518
+ declare type PasswordInput = BaseInput & {
519
+ type: 'password';
520
+ default: string;
521
+ placeholder?: string;
522
+ };
323
523
 
324
524
  /**
325
525
  * @return string
326
526
  */
327
- declare type PasswordInput = BaseInput & {
527
+ declare type PasswordInput_2 = BaseInput_2 & {
328
528
  type: 'password';
329
529
  default: string;
330
530
  placeholder?: string;
331
531
  };
332
532
 
333
- 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
+ }
549
+
550
+ declare type PaymentCallback = (payment: PluginPayment, order: PluginOrder) => void;
334
551
 
335
552
  /**
336
553
  * @publicApi
@@ -346,7 +563,10 @@ export declare type PaymentMethodResponse = {
346
563
  paymentKey: string;
347
564
  };
348
565
 
349
- declare type PaymentMethodType = {
566
+ /**
567
+ * @publicApi
568
+ */
569
+ export declare type PaymentMethodType = {
350
570
  add: (payload: {
351
571
  data: {
352
572
  /**
@@ -366,19 +586,7 @@ declare type PaymentMethodType = {
366
586
  }) => void;
367
587
  };
368
588
 
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 & {
589
+ declare type PickupOrder = Order_2 & {
382
590
  type: 'PICKUP';
383
591
  memo: {
384
592
  store?: string;
@@ -387,10 +595,65 @@ declare type PickupOrder = Order & {
387
595
  status: StoreStatus;
388
596
  };
389
597
 
390
- declare const plugin: {
391
- on: typeof on;
392
- getPluginInfo: typeof getPluginInfo;
393
- };
598
+ /**
599
+ * @publicApi
600
+ */
601
+ declare type Platform = 'macos' | 'windows' | 'android' | 'ios' | 'unknown';
602
+
603
+ /**
604
+ * @publicApi
605
+ */
606
+ export declare const plugin: PluginImpl;
607
+
608
+ /**
609
+ * @publicApi
610
+ */
611
+ declare interface Plugin_2 {
612
+ on(event: 'close', callback: () => Promise<void>): void;
613
+ getPluginInfo(): Promise<{
614
+ name: string;
615
+ version: string;
616
+ }>;
617
+ }
618
+ export { Plugin_2 as Plugin }
619
+
620
+ /**
621
+ * @publicApi
622
+ */
623
+ declare interface PluginAccountTransferPayment extends PluginPaymentBase {
624
+ sourceType: 'ACCOUNT_TRANSFER';
625
+ /** 계좌이체 정보 */
626
+ accountTransfer: {
627
+ /** 은행코드 */
628
+ bankCode: number;
629
+ /** 계좌번호 */
630
+ accountNumber: string;
631
+ };
632
+ }
633
+
634
+ /**
635
+ * @publicApi
636
+ */
637
+ declare interface PluginBarcodePayment extends PluginPaymentBase {
638
+ sourceType: 'BARCODE';
639
+ externalDetails: {
640
+ installmentMonth: PluginPaymentInstallment;
641
+ /**
642
+ * 발급사명
643
+ * @example 토스페이, 네이버체크, 카카오페이머니, ...
644
+ */
645
+ source: string;
646
+ /**
647
+ * 간편결제 구분자
648
+ * @example KKF, SG2, ZRP, ...
649
+ */
650
+ sourceId: string;
651
+ sourceType?: PluginPaymentExternalSourceType;
652
+ /** 매입사명 */
653
+ cardBrand?: string;
654
+ cardNo?: string;
655
+ };
656
+ }
394
657
 
395
658
  /**
396
659
  * @publicApi
@@ -490,6 +753,10 @@ export declare interface PluginCatalogItem {
490
753
  * @description 토스 포스에 등록된 메뉴의 고유 아이디
491
754
  */
492
755
  id: number;
756
+ /**
757
+ * 플러그인에서 생성하면 토스포스 서버에 저장되어 항상 같이 내려옴
758
+ */
759
+ code?: string;
493
760
  /**
494
761
  * @description 포스 내에서 보여주는 타이틀
495
762
  * @description 사장님께만 보입니다
@@ -517,7 +784,7 @@ export declare interface PluginCatalogItem {
517
784
  * @description 메뉴에 달린 벳지입니다
518
785
  */
519
786
  labels: PluginCatalogItemLabel[];
520
- imageUrl: string | null;
787
+ imageUrl?: string;
521
788
  /**
522
789
  * @description 상품의 가격정보
523
790
  */
@@ -526,6 +793,13 @@ export declare interface PluginCatalogItem {
526
793
  * @description 상품에서 사용가능한 옵션 리스트
527
794
  */
528
795
  options: PluginCatalogItemOption[];
796
+ /** POS에서 상품 표시시 색상 정보 */
797
+ color?: string;
798
+ /** 제조 및 유통 정보 */
799
+ provenance?: {
800
+ /** 제조사 */
801
+ displayProvenance: string;
802
+ };
529
803
  }
530
804
 
531
805
  /**
@@ -541,14 +815,20 @@ export declare interface PluginCatalogItemDto {
541
815
  description?: string;
542
816
  descriptionI18n?: PluginLanguagePack;
543
817
  categoryId: number;
544
- price: PluginCatalogItemPrice;
818
+ price: PluginCatalogItemPriceDto;
545
819
  labels: PluginCatalogItemLabel[];
546
- imageUrl: string | null;
820
+ imageUrl?: string;
547
821
  /**
548
822
  * @description 옵션을 먼저 만들고 id를 넣어달라
549
823
  */
550
824
  options: Pick<PluginCatalogItemOption, 'id'>[];
551
- kioskTitle?: string;
825
+ /** POS에서 상품 표시시 색상 정보 */
826
+ color?: string;
827
+ /** 제조 및 유통 정보 */
828
+ provenance?: {
829
+ /** 제조사 */
830
+ displayProvenance: string;
831
+ };
552
832
  }
553
833
 
554
834
  /**
@@ -613,9 +893,9 @@ export declare interface PluginCatalogItemPrice {
613
893
  * 재고 관리 코드
614
894
  * @see https://en.wikipedia.org/wiki/Stock_keeping_unit
615
895
  */
616
- sku: string | null;
896
+ sku?: string;
617
897
  /** 상품 가격의 바코드 정보 */
618
- barcode: string | null;
898
+ barcode?: string;
619
899
  /** 가격 유형 */
620
900
  priceType: PluginCatalogItemPriceType;
621
901
  /** 가격의 기본 개수 */
@@ -629,10 +909,30 @@ export declare interface PluginCatalogItemPrice {
629
909
  /** 재고 관리여부 */
630
910
  isStockable: boolean;
631
911
  /** 현재 남아있는 재고 수 */
632
- stockQuantity: {
912
+ stockQuantity?: {
633
913
  remainQuantity: number;
634
914
  lastChangeDateTime: string;
635
- } | 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;
636
936
  }
637
937
 
638
938
  /**
@@ -676,6 +976,105 @@ export declare interface PluginDiscount {
676
976
  titleI18n?: PluginLanguagePack;
677
977
  }
678
978
 
979
+ /**
980
+ * @publicApi
981
+ */
982
+ export declare interface PluginDraftOrder {
983
+ /**
984
+ * 주문ID
985
+ * 서버 주문을 클라이언트 주문으로 변경했을 때 값이 존재
986
+ */
987
+ id?: string;
988
+ /** 주문 항목 목록 */
989
+ lineItems: Array<PluginDraftOrderItem>;
990
+ /** 주문 요청사항 */
991
+ memo?: string;
992
+ /** 주문에 적용된 할인 목록 */
993
+ discounts: PluginDiscount[];
994
+ price: PluginDraftOrderPrice;
995
+ /**
996
+ * 이 주문에 대해 프린트 출력을 무시할지 여부
997
+ * 이 옵션이 켜져 있는 경우 다른 포스에서도 프린트 출력이 무시됩니다.
998
+ * 기본값은 false입니다.
999
+ */
1000
+ ignorePrint: boolean;
1001
+ }
1002
+
1003
+ /**
1004
+ * @publicApi
1005
+ */
1006
+ export declare interface PluginDraftOrderItem {
1007
+ /**
1008
+ * 넣지 않으면 자동으로 생성됨
1009
+ */
1010
+ key: string;
1011
+ /** 상품 정보 */
1012
+ item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'options' | 'code'> & {
1013
+ type: OrderItemType;
1014
+ };
1015
+ /** 상품 가격 정보 */
1016
+ itemPrice: Pick<PluginCatalogItemPrice, 'id' | 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
1017
+ /** 적용된 할인 목록 */
1018
+ discount: PluginDiscount[];
1019
+ /** 요청사항 */
1020
+ memo: string;
1021
+ /** 선택된 옵션 정보 */
1022
+ optionChoices: PluginCatalogItemOptionChoice[];
1023
+ /** 수량 */
1024
+ quantity: number;
1025
+ /** 식사 유형 */
1026
+ diningOption: PluginOrderDiningOption;
1027
+ /**
1028
+ * 서버에서 생성된 lineItemId
1029
+ */
1030
+ lineItemId?: string;
1031
+ metadata?: {
1032
+ /**
1033
+ * true : 유저가 메모 수정 불가
1034
+ */
1035
+ disableMemoEdit?: boolean;
1036
+ /**
1037
+ * true : 유저가 옵션 수정 불가
1038
+ */
1039
+ disableOptionEdit?: boolean;
1040
+ /**
1041
+ * true : 유저가 수량 변경 불가
1042
+ */
1043
+ disableQuantityEdit?: boolean;
1044
+ };
1045
+ }
1046
+
1047
+ /**
1048
+ * @publicApi
1049
+ * @desription key는 넣으면 할당되고 없으면 포스에서 자동생성
1050
+ */
1051
+ declare type PluginDraftOrderItemDto = PluginDraftOrderItem & {
1052
+ key?: string;
1053
+ itemPrice: Pick<PluginCatalogItemPrice, 'isTaxFree' | 'priceType' | 'priceUnit' | 'priceValue' | 'sku' | 'title'>;
1054
+ };
1055
+
1056
+ declare interface PluginDraftOrderPrice {
1057
+ /** (-)할인 금액 */
1058
+ orderDiscountValue: number;
1059
+ /**
1060
+ * 원주문 금액
1061
+ * Σ OrderItem.orderPrice.orderListPriceValue
1062
+ */
1063
+ orderListPriceValue: number;
1064
+ /**
1065
+ * 주문 금액 = 원주문금액 + 할인 금액 + 보증금 + 봉사료
1066
+ *
1067
+ * @see 보증금: DraftOrder.bookingFee
1068
+ */
1069
+ orderPriceValue: number;
1070
+ /** 봉사료 */
1071
+ orderTipValue: number;
1072
+ }
1073
+
1074
+ /**
1075
+ * 밴을 통하지 않으면 바코드결제라고 해도 externalPayment로 처리해주세요
1076
+ * 취소를 플러그인에서 따로 처리해야하면 externalPayment로 처리해주세요
1077
+ */
679
1078
  declare interface PluginExternalDto extends PluginPaymentDtoBase {
680
1079
  sourceType: 'EXTERNAL';
681
1080
  }
@@ -721,18 +1120,32 @@ export declare type PluginHttpResponse = {
721
1120
  code: number;
722
1121
  };
723
1122
 
1123
+ declare class PluginImpl implements Plugin_2 {
1124
+ private readonly webview;
1125
+ private pluginCallbacks;
1126
+ constructor(webview: WebView);
1127
+ private initializePlugin;
1128
+ on(event: 'close', callback: () => Promise<void>): void;
1129
+ getPluginInfo(): Promise<{
1130
+ name: string;
1131
+ version: string;
1132
+ }>;
1133
+ }
1134
+
724
1135
  /**
725
1136
  * @publicApi
726
1137
  * @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
727
1138
  */
728
- export declare type PluginInputs<T extends PluginInputType = any> = Extract<TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput, {
729
- type: T;
730
- }>;
1139
+ export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
731
1140
 
732
1141
  /**
733
1142
  * @publicApi
1143
+ * @deprecated
1144
+ * @see https://deus.toss.im/projects/1057/pages/8gKjmG0l@1
734
1145
  */
735
- declare type PluginInputType = PluginInputs['type'];
1146
+ declare type PluginInputsLegacy<T extends LegacyPluginInputType = any> = Extract<TextInput_2 | PasswordInput_2 | RadioInput_2 | CheckBoxInput_2 | ToggleInput_2 | SliderInput_2, {
1147
+ type: T;
1148
+ }>;
736
1149
 
737
1150
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
738
1151
 
@@ -744,6 +1157,26 @@ export declare interface PluginLanguagePack {
744
1157
  languages: Partial<Languages>;
745
1158
  }
746
1159
 
1160
+ /**
1161
+ * @publicApi
1162
+ */
1163
+ export declare interface PluginMessenger {
1164
+ broadcast<T = any>(message: T): void;
1165
+ on<T = any>(event: 'message', callback: (message: T) => void): void;
1166
+ }
1167
+
1168
+ /**
1169
+ * @publicApi
1170
+ */
1171
+ export declare const pluginMessenger: PluginMessengerImpl;
1172
+
1173
+ declare class PluginMessengerImpl implements PluginMessenger {
1174
+ private readonly webview;
1175
+ constructor(webview: WebView);
1176
+ broadcast<T = any>(message: T): void;
1177
+ on<T = any>(event: 'message', callback: (message: T) => void): void;
1178
+ }
1179
+
747
1180
  /**
748
1181
  * @publicApi
749
1182
  * @description pluginOrder orderDto를 서버에 저장 후 가공해서 내려 준 값
@@ -771,9 +1204,13 @@ export declare interface PluginOrder {
771
1204
  source: string;
772
1205
  memo?: string;
773
1206
  /**
1207
+ * @description 주문시각
774
1208
  * 해당값이 있다면 createdAt 대신 사용해주세요.
775
1209
  */
776
1210
  openedAt?: string;
1211
+ /**
1212
+ * @description 생성시각
1213
+ */
777
1214
  createdAt: string;
778
1215
  updatedAt?: string;
779
1216
  cancelledAt?: string;
@@ -827,14 +1264,14 @@ export declare interface PluginOrderItem {
827
1264
  id: string;
828
1265
  orderId: string;
829
1266
  diningOption: PluginOrderDiningOption;
830
- item: Pick<PluginCatalogItem, 'id' | 'title' | 'category'> & {
1267
+ item: Pick<PluginCatalogItem, 'id' | 'title' | 'category' | 'code'> & {
831
1268
  type: OrderItemType;
832
1269
  };
833
1270
  quantity: {
834
1271
  value: number;
835
1272
  };
836
1273
  /**
837
- * @description 실제 고객이 결제하는 금액에 대한 정보입니다.
1274
+ * @description 실제 고객이 결제하는 금액에 대한 정보입니다. (할인 적용 금액)
838
1275
  */
839
1276
  chargePrice: {
840
1277
  value: number;
@@ -898,7 +1335,7 @@ export declare type PluginOrderState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'C
898
1335
  /**
899
1336
  * @publicApi
900
1337
  */
901
- export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment) & {
1338
+ export declare type PluginPayment = (PluginCardPayment | PluginCashPayment | PluginExternalPayment | PluginAccountTransferPayment | PluginBarcodePayment) & {
902
1339
  paymentKey: string;
903
1340
  };
904
1341
 
@@ -963,6 +1400,11 @@ declare type PluginPaymentDtoBase = Pick<PluginPayment,
963
1400
  */
964
1401
  'orderId' | 'sourceType' | 'amountMoney' | 'taxMoney' | 'approvedNo' | 'approvedAt' | 'paymentKey' | 'supplyMoney' | 'tipMoney' | 'taxExemptMoney'>;
965
1402
 
1403
+ /**
1404
+ * @publicApi
1405
+ */
1406
+ declare type PluginPaymentExternalSourceType = 'CARD' | 'BANK_TRANSFER' | 'OTHER_GIFT_CARD' | 'POINT' | 'COUPON' | 'OTHER';
1407
+
966
1408
  /**
967
1409
  * @publicApi
968
1410
  * 할부개월 수
@@ -985,7 +1427,7 @@ export declare type PluginPaymentOf<S extends PluginPaymentSourceType> = Extract
985
1427
  * BARCODE: 바코드/QR을 사용하는 간편결제
986
1428
  * EXTERNAL: 기타결제(쿠폰, 외상 등)
987
1429
  */
988
- export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL';
1430
+ export declare type PluginPaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL' | 'BARCODE' | 'ACCOUNT_TRANSFER';
989
1431
 
990
1432
  /**
991
1433
  * @publicApi
@@ -1031,22 +1473,26 @@ export declare interface PluginTableGroup {
1031
1473
  tableIds: number[];
1032
1474
  }
1033
1475
 
1034
- declare type PluginTypes = typeof plugin;
1035
-
1036
1476
  /**
1037
1477
  * @publicApi
1038
1478
  */
1039
- export declare type PopupActionResponse<T extends AllPopupType> = Extract<AllPopupResponse, {
1479
+ export declare type PopupActionResponse<T extends PopupType> = Extract<Response_2, {
1040
1480
  type: T;
1041
- }>;
1481
+ complete: true;
1482
+ }>['data'];
1042
1483
 
1043
1484
  /**
1044
1485
  * @publicApi
1045
1486
  */
1046
- export declare type PopupElements<T extends AllPopupType> = Extract<AllPopupElements, {
1487
+ export declare type PopupElement<T extends PopupType> = Extract<Element_2, {
1047
1488
  type: T;
1048
1489
  }>;
1049
1490
 
1491
+ /**
1492
+ * @publicApi
1493
+ */
1494
+ declare type PopupType = Element_2['type'];
1495
+
1050
1496
  /**
1051
1497
  * @publicApi
1052
1498
  */
@@ -1057,17 +1503,20 @@ export declare type PosPluginSdk = {
1057
1503
  option: MenuOption;
1058
1504
  storage: StorageTypes;
1059
1505
  cashReceipt: CashReceiptTypes;
1060
- order: OrderTypes;
1061
- payment: PaymentTypes;
1506
+ order: Order;
1507
+ payment: Payment;
1062
1508
  http: HttpTypes;
1063
1509
  toast: ToastTypes;
1064
- merchant: MerchantTypes;
1065
- ui: UiType;
1510
+ device: Device;
1511
+ merchant: Merchant;
1066
1512
  paymentMethod: PaymentMethodType;
1067
1513
  websocket: WebsocketTypes;
1068
1514
  ffi: FFITypes;
1069
- plugin: PluginTypes;
1515
+ plugin: Plugin_2;
1516
+ pluginMessenger: PluginMessenger;
1070
1517
  setting: SettingTypes;
1518
+ draftOrder: DraftOrder;
1519
+ navigation: Navigation;
1071
1520
  };
1072
1521
 
1073
1522
  /**
@@ -1095,14 +1544,31 @@ declare type RadioInput = Omit<BaseInput, 'placeholder'> & {
1095
1544
  values: InputValue[];
1096
1545
  };
1097
1546
 
1098
- declare function setInputs(inputs: Array<PluginInputs>): void;
1547
+ /**
1548
+ * @return string values.id
1549
+ */
1550
+ declare type RadioInput_2 = Omit<BaseInput_2, 'placeholder'> & {
1551
+ type: 'radio';
1552
+ /**
1553
+ * @desciption 선택된 value의 id
1554
+ */
1555
+ default: string;
1556
+ values: InputValue_2[];
1557
+ };
1558
+
1559
+ declare type Response_2 = BarcodeResponse | InputResponse;
1560
+
1561
+ declare function setInputs(inputs: Array<PluginInputsLegacy>): void;
1099
1562
 
1100
1563
  declare const setting: {
1101
1564
  setInputs: typeof setInputs;
1102
1565
  getValues: typeof getValues;
1103
1566
  };
1104
1567
 
1105
- declare type SettingTypes = typeof setting;
1568
+ /**
1569
+ * @publicApi
1570
+ */
1571
+ export declare type SettingTypes = typeof setting;
1106
1572
 
1107
1573
  /**
1108
1574
  * @return number 0 25 50 75 100
@@ -1115,6 +1581,17 @@ declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
1115
1581
  step: number;
1116
1582
  };
1117
1583
 
1584
+ /**
1585
+ * @return number 0 25 50 75 100
1586
+ */
1587
+ declare type SliderInput_2 = Omit<BaseInput_2, 'placeholder'> & {
1588
+ type: 'slider';
1589
+ default: number;
1590
+ min: number;
1591
+ max: number;
1592
+ step: number;
1593
+ };
1594
+
1118
1595
  /**
1119
1596
  * @publicApi
1120
1597
  */
@@ -1133,7 +1610,10 @@ declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_CANCELLE
1133
1610
  */
1134
1611
  | 'DONE';
1135
1612
 
1136
- declare interface Table {
1613
+ /**
1614
+ * @publicApi
1615
+ */
1616
+ export declare interface Table {
1137
1617
  getTables: () => Promise<{
1138
1618
  table: PluginTable;
1139
1619
  order?: PluginOrder;
@@ -1154,9 +1634,30 @@ declare type TextInput = BaseInput & {
1154
1634
  type: 'text';
1155
1635
  default: string;
1156
1636
  placeholder?: string;
1637
+ suffix?: string;
1638
+ /**
1639
+ * @see https://deus.toss.im/projects/1057/pages/o58sjnCS@1?node=jIulZjBg%401
1640
+ * @description candidates는 선택지를 제공하는 기능으로, candidates중 유저가 하나를 선택하면 textField가 자동으로 value로 채워짐
1641
+ */
1642
+ candidates?: {
1643
+ text: string;
1644
+ value: string;
1645
+ }[];
1646
+ };
1647
+
1648
+ /**
1649
+ * @return string
1650
+ */
1651
+ declare type TextInput_2 = BaseInput_2 & {
1652
+ type: 'text';
1653
+ default: string;
1654
+ placeholder?: string;
1157
1655
  };
1158
1656
 
1159
- declare type ToastTypes = {
1657
+ /**
1658
+ * @publicApi
1659
+ */
1660
+ export declare type ToastTypes = {
1160
1661
  open(message: string): void;
1161
1662
  };
1162
1663
 
@@ -1168,6 +1669,14 @@ declare type ToggleInput = Omit<BaseInput, 'placeholder'> & {
1168
1669
  default: boolean;
1169
1670
  };
1170
1671
 
1672
+ /**
1673
+ * @return boolean
1674
+ */
1675
+ declare type ToggleInput_2 = Omit<BaseInput_2, 'placeholder'> & {
1676
+ type: 'toggle';
1677
+ default: boolean;
1678
+ };
1679
+
1171
1680
  /**
1172
1681
  * @publicApi
1173
1682
  * @description 추후에 필요한 정보 더 추가될 예정
@@ -1176,6 +1685,10 @@ export declare type TossMerchant = {
1176
1685
  name: string;
1177
1686
  id: number;
1178
1687
  businessNumber: string;
1688
+ /**
1689
+ * @deprecated
1690
+ * @see DeviceInfo.serialNumber
1691
+ */
1179
1692
  serialNumber: string;
1180
1693
  franchise?: {
1181
1694
  id: string;
@@ -1183,8 +1696,12 @@ export declare type TossMerchant = {
1183
1696
  };
1184
1697
  };
1185
1698
 
1186
- declare type UiType = {
1187
- openPopup<T extends AllPopupType>(message: PopupElements<T>): Promise<PopupActionResponse<T>>;
1699
+ /**
1700
+ * @publicApi
1701
+ */
1702
+ export declare type Ui = {
1703
+ openBarcode(message: Omit<PopupElement<'barcode'>, 'type'>): Promise<PopupActionResponse<'barcode'>>;
1704
+ openInputModal(message: Omit<PopupElement<'input'>, 'type'>): Promise<PopupActionResponse<'input'>>;
1188
1705
  };
1189
1706
 
1190
1707
  declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
@@ -1221,7 +1738,10 @@ declare class Websocket {
1221
1738
  onOpen(callback: () => void): void;
1222
1739
  }
1223
1740
 
1224
- declare type WebsocketTypes = {
1741
+ /**
1742
+ * @publicApi
1743
+ */
1744
+ export declare type WebsocketTypes = {
1225
1745
  create: (url: string, headers: Record<string, string>, options?: {
1226
1746
  rejectUnauthorized?: boolean;
1227
1747
  followRedirects?: boolean;