@tossplace/pos-plugin-sdk 0.0.19 → 0.0.21

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
@@ -361,6 +361,14 @@ declare type InputValue = {
361
361
 
362
362
  declare type Join<T extends string, U extends string> = `${T}${U}` | '0';
363
363
 
364
+ /**
365
+ * @publicApi
366
+ */
367
+ declare interface KdsOrder {
368
+ on(event: 'open' | 'complete' | 'cancel', callback: (id: PluginKdsOrderItem['id']) => void): void;
369
+ getKdsOrderItems(payload: PluginGetKdsOrderItemsPayload): Promise<PluginGetKdsOrderItemsResult>;
370
+ }
371
+
364
372
  declare type Languages = Record<PluginLanguageCode, string>;
365
373
 
366
374
  /**
@@ -1111,6 +1119,21 @@ export declare interface PluginExternalPayment extends PluginPaymentBase {
1111
1119
  };
1112
1120
  }
1113
1121
 
1122
+ declare interface PluginGetKdsOrderItemsPayload {
1123
+ states?: PluginKdsOrderItemState[];
1124
+ page: number;
1125
+ size: number;
1126
+ orderIds?: string[];
1127
+ categoryIds?: number[];
1128
+ itemIds?: number[];
1129
+ }
1130
+
1131
+ declare interface PluginGetKdsOrderItemsResult {
1132
+ contents: PluginKdsOrderItem[];
1133
+ last: boolean;
1134
+ totalElements: number;
1135
+ }
1136
+
1114
1137
  /**
1115
1138
  * @publicApi
1116
1139
  * 테이블이 놓여진 공간
@@ -1153,6 +1176,57 @@ declare class PluginImpl implements Plugin_2 {
1153
1176
  */
1154
1177
  export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
1155
1178
 
1179
+ declare interface PluginKdsLineItem {
1180
+ title: string;
1181
+ diningOption: PluginOrderDiningOption;
1182
+ id: string;
1183
+ itemId: PluginOrderItem['id'];
1184
+ memo: string;
1185
+ optionChoices: PluginOrderItem['optionChoices'];
1186
+ orderPrice: PluginKdsLineItemOrderPrice;
1187
+ quantity: {
1188
+ previous: number;
1189
+ current: number;
1190
+ };
1191
+ appliedDiscounts: PluginDiscount[];
1192
+ item: {
1193
+ id: number;
1194
+ category: {
1195
+ id: number;
1196
+ order: number;
1197
+ };
1198
+ };
1199
+ createdAt: string;
1200
+ updatedAt: string;
1201
+ }
1202
+
1203
+ declare interface PluginKdsLineItemOrderPrice {
1204
+ orderDiscountValue: number;
1205
+ orderListPriceValue: number;
1206
+ orderPriceValue: number;
1207
+ }
1208
+
1209
+ declare interface PluginKdsOrder extends Omit<PluginOrder, 'lineItems'> {
1210
+ }
1211
+
1212
+ declare interface PluginKdsOrderItem {
1213
+ id: string;
1214
+ state: PluginKdsOrderItemState;
1215
+ order: PluginKdsOrder;
1216
+ lineItems: PluginKdsLineItem[];
1217
+ diningOption: PluginOrderDiningOption;
1218
+ totalQuantity: number;
1219
+ orderRequestType: PluginKdsOrderRequestType;
1220
+ cancelledAt: string;
1221
+ completedAt: string;
1222
+ createdAt: string;
1223
+ updatedAt: string;
1224
+ }
1225
+
1226
+ declare type PluginKdsOrderItemState = 'OPENED' | 'COMPLETED' | 'CANCELLED';
1227
+
1228
+ declare type PluginKdsOrderRequestType = 'ADDED' | 'NEW' | 'CHANGED' | 'CANCELLED' | 'MERGED';
1229
+
1156
1230
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
1157
1231
 
1158
1232
  /**
@@ -1527,6 +1601,29 @@ export declare interface PluginTableGroup {
1527
1601
  tableIds: number[];
1528
1602
  }
1529
1603
 
1604
+ declare class PluginUnicast implements PluginUnicastTypes {
1605
+ private pluginName;
1606
+ private readonly sendBuffer;
1607
+ private readonly sendEventBuffer;
1608
+ private readonly listenHandlers;
1609
+ constructor();
1610
+ send: <T = any>(message: T, to: string) => void;
1611
+ listen: <T = any>(event: UnicastEvent, callback: (message: T, from: string) => void) => (() => void);
1612
+ private sendToWebview;
1613
+ private flushSendBuffer;
1614
+ private flushSendEventBuffer;
1615
+ }
1616
+
1617
+ export declare const pluginUnicast: PluginUnicast;
1618
+
1619
+ /**
1620
+ * @publicApi
1621
+ */
1622
+ export declare type PluginUnicastTypes = {
1623
+ send<T = any>(message: T, to: string): void;
1624
+ listen<T = any>(event: 'message', callback: (message: T, from: string) => void): () => void;
1625
+ };
1626
+
1530
1627
  /**
1531
1628
  * @publicApi
1532
1629
  */
@@ -1573,6 +1670,8 @@ export declare type PosPluginSdk = {
1573
1670
  error: ErrorImpl;
1574
1671
  powerSaver: PowerSaverTypes;
1575
1672
  sound: SoundTypes;
1673
+ kdsOrder: KdsOrder;
1674
+ pluginUnicast: PluginUnicastTypes;
1576
1675
  };
1577
1676
 
1578
1677
  /**
@@ -1732,6 +1831,7 @@ declare type TextInput = BaseInput & {
1732
1831
  */
1733
1832
  export declare type ToastTypes = {
1734
1833
  open(message: string): void;
1834
+ on(event: 'click', callback: () => void): () => void;
1735
1835
  };
1736
1836
 
1737
1837
  /**
@@ -1777,6 +1877,8 @@ declare class UiImpl implements Ui {
1777
1877
  openInputModal(data: Omit<PopupElement<'input'>, 'type'>): Promise<PopupActionResponse<'input'>>;
1778
1878
  }
1779
1879
 
1880
+ declare type UnicastEvent = 'message';
1881
+
1780
1882
  declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
1781
1883
 
1782
1884
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tossplace/pos-plugin-sdk",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "포스 플러그인 sdk",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/types/index.d.ts CHANGED
@@ -361,6 +361,14 @@ declare type InputValue = {
361
361
 
362
362
  declare type Join<T extends string, U extends string> = `${T}${U}` | '0';
363
363
 
364
+ /**
365
+ * @publicApi
366
+ */
367
+ declare interface KdsOrder {
368
+ on(event: 'open' | 'complete' | 'cancel', callback: (id: PluginKdsOrderItem['id']) => void): void;
369
+ getKdsOrderItems(payload: PluginGetKdsOrderItemsPayload): Promise<PluginGetKdsOrderItemsResult>;
370
+ }
371
+
364
372
  declare type Languages = Record<PluginLanguageCode, string>;
365
373
 
366
374
  /**
@@ -1111,6 +1119,21 @@ export declare interface PluginExternalPayment extends PluginPaymentBase {
1111
1119
  };
1112
1120
  }
1113
1121
 
1122
+ declare interface PluginGetKdsOrderItemsPayload {
1123
+ states?: PluginKdsOrderItemState[];
1124
+ page: number;
1125
+ size: number;
1126
+ orderIds?: string[];
1127
+ categoryIds?: number[];
1128
+ itemIds?: number[];
1129
+ }
1130
+
1131
+ declare interface PluginGetKdsOrderItemsResult {
1132
+ contents: PluginKdsOrderItem[];
1133
+ last: boolean;
1134
+ totalElements: number;
1135
+ }
1136
+
1114
1137
  /**
1115
1138
  * @publicApi
1116
1139
  * 테이블이 놓여진 공간
@@ -1153,6 +1176,57 @@ declare class PluginImpl implements Plugin_2 {
1153
1176
  */
1154
1177
  export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
1155
1178
 
1179
+ declare interface PluginKdsLineItem {
1180
+ title: string;
1181
+ diningOption: PluginOrderDiningOption;
1182
+ id: string;
1183
+ itemId: PluginOrderItem['id'];
1184
+ memo: string;
1185
+ optionChoices: PluginOrderItem['optionChoices'];
1186
+ orderPrice: PluginKdsLineItemOrderPrice;
1187
+ quantity: {
1188
+ previous: number;
1189
+ current: number;
1190
+ };
1191
+ appliedDiscounts: PluginDiscount[];
1192
+ item: {
1193
+ id: number;
1194
+ category: {
1195
+ id: number;
1196
+ order: number;
1197
+ };
1198
+ };
1199
+ createdAt: string;
1200
+ updatedAt: string;
1201
+ }
1202
+
1203
+ declare interface PluginKdsLineItemOrderPrice {
1204
+ orderDiscountValue: number;
1205
+ orderListPriceValue: number;
1206
+ orderPriceValue: number;
1207
+ }
1208
+
1209
+ declare interface PluginKdsOrder extends Omit<PluginOrder, 'lineItems'> {
1210
+ }
1211
+
1212
+ declare interface PluginKdsOrderItem {
1213
+ id: string;
1214
+ state: PluginKdsOrderItemState;
1215
+ order: PluginKdsOrder;
1216
+ lineItems: PluginKdsLineItem[];
1217
+ diningOption: PluginOrderDiningOption;
1218
+ totalQuantity: number;
1219
+ orderRequestType: PluginKdsOrderRequestType;
1220
+ cancelledAt: string;
1221
+ completedAt: string;
1222
+ createdAt: string;
1223
+ updatedAt: string;
1224
+ }
1225
+
1226
+ declare type PluginKdsOrderItemState = 'OPENED' | 'COMPLETED' | 'CANCELLED';
1227
+
1228
+ declare type PluginKdsOrderRequestType = 'ADDED' | 'NEW' | 'CHANGED' | 'CANCELLED' | 'MERGED';
1229
+
1156
1230
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
1157
1231
 
1158
1232
  /**
@@ -1520,6 +1594,29 @@ export declare interface PluginTableGroup {
1520
1594
  tableIds: number[];
1521
1595
  }
1522
1596
 
1597
+ declare class PluginUnicast implements PluginUnicastTypes {
1598
+ private pluginName;
1599
+ private readonly sendBuffer;
1600
+ private readonly sendEventBuffer;
1601
+ private readonly listenHandlers;
1602
+ constructor();
1603
+ send: <T = any>(message: T, to: string) => void;
1604
+ listen: <T = any>(event: UnicastEvent, callback: (message: T, from: string) => void) => (() => void);
1605
+ private sendToWebview;
1606
+ private flushSendBuffer;
1607
+ private flushSendEventBuffer;
1608
+ }
1609
+
1610
+ export declare const pluginUnicast: PluginUnicast;
1611
+
1612
+ /**
1613
+ * @publicApi
1614
+ */
1615
+ export declare type PluginUnicastTypes = {
1616
+ send<T = any>(message: T, to: string): void;
1617
+ listen<T = any>(event: 'message', callback: (message: T, from: string) => void): () => void;
1618
+ };
1619
+
1523
1620
  /**
1524
1621
  * @publicApi
1525
1622
  */
@@ -1566,6 +1663,8 @@ export declare type PosPluginSdk = {
1566
1663
  error: ErrorImpl;
1567
1664
  powerSaver: PowerSaverTypes;
1568
1665
  sound: SoundTypes;
1666
+ kdsOrder: KdsOrder;
1667
+ pluginUnicast: PluginUnicastTypes;
1569
1668
  };
1570
1669
 
1571
1670
  /**
@@ -1725,6 +1824,7 @@ declare type TextInput = BaseInput & {
1725
1824
  */
1726
1825
  export declare type ToastTypes = {
1727
1826
  open(message: string): void;
1827
+ on(event: 'click', callback: () => void): () => void;
1728
1828
  };
1729
1829
 
1730
1830
  /**
@@ -1770,6 +1870,8 @@ declare class UiImpl implements Ui {
1770
1870
  openInputModal(data: Omit<PopupElement<'input'>, 'type'>): Promise<PopupActionResponse<'input'>>;
1771
1871
  }
1772
1872
 
1873
+ declare type UnicastEvent = 'message';
1874
+
1773
1875
  declare type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
1774
1876
 
1775
1877
  /**