@tossplace/pos-plugin-sdk 0.0.24 → 0.0.25

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,3 +1,12 @@
1
+ /**
2
+ * @publicApi
3
+ */
4
+ export declare type AlertTypes = {
5
+ open(params: {
6
+ message: string;
7
+ }): void;
8
+ };
9
+
1
10
  declare type AllPaymentCreateDto = PluginCardDto | PluginCashDto | PluginExternalDto;
2
11
 
3
12
  declare const AvailableLanguageCodes: {
@@ -553,7 +562,8 @@ declare type PayCallback = (order: PluginOrder, price: PluginPrice, ui: Ui) => P
553
562
  * @publicApi
554
563
  */
555
564
  export declare interface Payment {
556
- on: (event: 'cancel' | 'paid', callback: PaymentCallback) => void;
565
+ on(event: 'cancel' | 'paid', callback: PaymentCallback): void;
566
+ on(event: 'before-cancel', callback: PaymentBeforeCancelCallback): void;
557
567
  cancel: (order: {
558
568
  id: string;
559
569
  }, payment: {
@@ -565,6 +575,11 @@ export declare interface Payment {
565
575
  getPayment: (paymentId: PluginPayment['id']) => Promise<PluginPayment>;
566
576
  }
567
577
 
578
+ declare type PaymentBeforeCancelCallback = (payload: {
579
+ order: PluginOrder;
580
+ payment: PluginPayment;
581
+ }) => Promise<void>;
582
+
568
583
  declare type PaymentCallback = (paymentId: PluginPayment['id'], orderId: PluginOrder['id']) => void;
569
584
 
570
585
  /**
@@ -1154,6 +1169,9 @@ export declare interface PluginExternalPayment extends PluginPaymentBase {
1154
1169
  };
1155
1170
  }
1156
1171
 
1172
+ /**
1173
+ * @publicApi
1174
+ */
1157
1175
  declare interface PluginGetKdsOrderItemsPayload {
1158
1176
  states?: PluginKdsOrderItemState[];
1159
1177
  page: number;
@@ -1163,6 +1181,9 @@ declare interface PluginGetKdsOrderItemsPayload {
1163
1181
  itemIds?: number[];
1164
1182
  }
1165
1183
 
1184
+ /**
1185
+ * @publicApi
1186
+ */
1166
1187
  declare interface PluginGetKdsOrderItemsResult {
1167
1188
  contents: PluginKdsOrderItem[];
1168
1189
  last: boolean;
@@ -1212,6 +1233,9 @@ declare class PluginImpl implements Plugin_2 {
1212
1233
  */
1213
1234
  export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
1214
1235
 
1236
+ /**
1237
+ * @publicApi
1238
+ */
1215
1239
  declare interface PluginKdsLineItem {
1216
1240
  title: string;
1217
1241
  diningOption: PluginOrderDiningOption;
@@ -1245,6 +1269,9 @@ declare interface PluginKdsLineItemOrderPrice {
1245
1269
  declare interface PluginKdsOrder extends Omit<PluginOrder, 'lineItems'> {
1246
1270
  }
1247
1271
 
1272
+ /**
1273
+ * @publicApi
1274
+ */
1248
1275
  declare interface PluginKdsOrderItem {
1249
1276
  id: string;
1250
1277
  state: PluginKdsOrderItemState;
@@ -1259,8 +1286,14 @@ declare interface PluginKdsOrderItem {
1259
1286
  updatedAt: string;
1260
1287
  }
1261
1288
 
1289
+ /**
1290
+ * @publicApi
1291
+ */
1262
1292
  declare type PluginKdsOrderItemState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'CANCELLED';
1263
1293
 
1294
+ /**
1295
+ * @publicApi
1296
+ */
1264
1297
  declare type PluginKdsOrderRequestType = 'ADDED' | 'NEW' | 'CHANGED' | 'CANCELLED' | 'MERGED';
1265
1298
 
1266
1299
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
@@ -1354,6 +1387,7 @@ export declare type PluginOrderDiningOption = 'HERE' | 'TOGO' | 'DELIVERY' | 'PI
1354
1387
  * @description order를 만들기 위한 dto
1355
1388
  */
1356
1389
  export declare type PluginOrderDto = {
1390
+ orderKey?: string;
1357
1391
  memo?: string;
1358
1392
  numGuests?: number;
1359
1393
  discounts: PluginDiscount[];
@@ -1684,6 +1718,7 @@ declare type PopupType = Element_2['type'];
1684
1718
  * @publicApi
1685
1719
  */
1686
1720
  export declare type PosPluginSdk = {
1721
+ alert: AlertTypes;
1687
1722
  table: Table;
1688
1723
  category: CategoryTypes;
1689
1724
  catalog: Catalog;
@@ -1863,7 +1898,34 @@ declare type TextInput = BaseInput & {
1863
1898
  * @publicApi
1864
1899
  */
1865
1900
  export declare type ToastTypes = {
1901
+ /**
1902
+ * @deprecated toast.error(), toast.warn(), toast.success() 를 사용하세요
1903
+ */
1866
1904
  open(message: string): void;
1905
+ error(params: {
1906
+ message: string;
1907
+ button?: {
1908
+ text: string;
1909
+ onClick: () => void;
1910
+ };
1911
+ }): void;
1912
+ warn(params: {
1913
+ message: string;
1914
+ button?: {
1915
+ text: string;
1916
+ onClick: () => void;
1917
+ };
1918
+ }): void;
1919
+ success(params: {
1920
+ message: string;
1921
+ button?: {
1922
+ text: string;
1923
+ onClick: () => void;
1924
+ };
1925
+ }): void;
1926
+ /**
1927
+ * @deprecated toast.warn(), toast.error(), toast.success() 의 button.onClick 을 사용하세요
1928
+ */
1867
1929
  on(event: 'click', callback: () => void): () => void;
1868
1930
  };
1869
1931
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tossplace/pos-plugin-sdk",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "포스 플러그인 sdk",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/types/index.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ /**
2
+ * @publicApi
3
+ */
4
+ export declare type AlertTypes = {
5
+ open(params: {
6
+ message: string;
7
+ }): void;
8
+ };
9
+
1
10
  declare type AllPaymentCreateDto = PluginCardDto | PluginCashDto | PluginExternalDto;
2
11
 
3
12
  declare const AvailableLanguageCodes: {
@@ -553,7 +562,8 @@ declare type PayCallback = (order: PluginOrder, price: PluginPrice, ui: Ui) => P
553
562
  * @publicApi
554
563
  */
555
564
  export declare interface Payment {
556
- on: (event: 'cancel' | 'paid', callback: PaymentCallback) => void;
565
+ on(event: 'cancel' | 'paid', callback: PaymentCallback): void;
566
+ on(event: 'before-cancel', callback: PaymentBeforeCancelCallback): void;
557
567
  cancel: (order: {
558
568
  id: string;
559
569
  }, payment: {
@@ -565,6 +575,11 @@ export declare interface Payment {
565
575
  getPayment: (paymentId: PluginPayment['id']) => Promise<PluginPayment>;
566
576
  }
567
577
 
578
+ declare type PaymentBeforeCancelCallback = (payload: {
579
+ order: PluginOrder;
580
+ payment: PluginPayment;
581
+ }) => Promise<void>;
582
+
568
583
  declare type PaymentCallback = (paymentId: PluginPayment['id'], orderId: PluginOrder['id']) => void;
569
584
 
570
585
  /**
@@ -1154,6 +1169,9 @@ export declare interface PluginExternalPayment extends PluginPaymentBase {
1154
1169
  };
1155
1170
  }
1156
1171
 
1172
+ /**
1173
+ * @publicApi
1174
+ */
1157
1175
  declare interface PluginGetKdsOrderItemsPayload {
1158
1176
  states?: PluginKdsOrderItemState[];
1159
1177
  page: number;
@@ -1163,6 +1181,9 @@ declare interface PluginGetKdsOrderItemsPayload {
1163
1181
  itemIds?: number[];
1164
1182
  }
1165
1183
 
1184
+ /**
1185
+ * @publicApi
1186
+ */
1166
1187
  declare interface PluginGetKdsOrderItemsResult {
1167
1188
  contents: PluginKdsOrderItem[];
1168
1189
  last: boolean;
@@ -1212,6 +1233,9 @@ declare class PluginImpl implements Plugin_2 {
1212
1233
  */
1213
1234
  export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
1214
1235
 
1236
+ /**
1237
+ * @publicApi
1238
+ */
1215
1239
  declare interface PluginKdsLineItem {
1216
1240
  title: string;
1217
1241
  diningOption: PluginOrderDiningOption;
@@ -1245,6 +1269,9 @@ declare interface PluginKdsLineItemOrderPrice {
1245
1269
  declare interface PluginKdsOrder extends Omit<PluginOrder, 'lineItems'> {
1246
1270
  }
1247
1271
 
1272
+ /**
1273
+ * @publicApi
1274
+ */
1248
1275
  declare interface PluginKdsOrderItem {
1249
1276
  id: string;
1250
1277
  state: PluginKdsOrderItemState;
@@ -1259,8 +1286,14 @@ declare interface PluginKdsOrderItem {
1259
1286
  updatedAt: string;
1260
1287
  }
1261
1288
 
1289
+ /**
1290
+ * @publicApi
1291
+ */
1262
1292
  declare type PluginKdsOrderItemState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'CANCELLED';
1263
1293
 
1294
+ /**
1295
+ * @publicApi
1296
+ */
1264
1297
  declare type PluginKdsOrderRequestType = 'ADDED' | 'NEW' | 'CHANGED' | 'CANCELLED' | 'MERGED';
1265
1298
 
1266
1299
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
@@ -1354,6 +1387,7 @@ export declare type PluginOrderDiningOption = 'HERE' | 'TOGO' | 'DELIVERY' | 'PI
1354
1387
  * @description order를 만들기 위한 dto
1355
1388
  */
1356
1389
  export declare type PluginOrderDto = {
1390
+ orderKey?: string;
1357
1391
  memo?: string;
1358
1392
  numGuests?: number;
1359
1393
  discounts: PluginDiscount[];
@@ -1677,6 +1711,7 @@ declare type PopupType = Element_2['type'];
1677
1711
  * @publicApi
1678
1712
  */
1679
1713
  export declare type PosPluginSdk = {
1714
+ alert: AlertTypes;
1680
1715
  table: Table;
1681
1716
  category: CategoryTypes;
1682
1717
  catalog: Catalog;
@@ -1856,7 +1891,34 @@ declare type TextInput = BaseInput & {
1856
1891
  * @publicApi
1857
1892
  */
1858
1893
  export declare type ToastTypes = {
1894
+ /**
1895
+ * @deprecated toast.error(), toast.warn(), toast.success() 를 사용하세요
1896
+ */
1859
1897
  open(message: string): void;
1898
+ error(params: {
1899
+ message: string;
1900
+ button?: {
1901
+ text: string;
1902
+ onClick: () => void;
1903
+ };
1904
+ }): void;
1905
+ warn(params: {
1906
+ message: string;
1907
+ button?: {
1908
+ text: string;
1909
+ onClick: () => void;
1910
+ };
1911
+ }): void;
1912
+ success(params: {
1913
+ message: string;
1914
+ button?: {
1915
+ text: string;
1916
+ onClick: () => void;
1917
+ };
1918
+ }): void;
1919
+ /**
1920
+ * @deprecated toast.warn(), toast.error(), toast.success() 의 button.onClick 을 사용하세요
1921
+ */
1860
1922
  on(event: 'click', callback: () => void): () => void;
1861
1923
  };
1862
1924