@tossplace/pos-plugin-sdk 0.0.24 → 0.0.26

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: {
@@ -430,6 +439,28 @@ declare type MovePayload = {
430
439
  };
431
440
  };
432
441
 
442
+ /**
443
+ * @publicApi
444
+ */
445
+ export declare interface Navigation {
446
+ navigate(page: 'plugin-tab', packageName?: string): void;
447
+ navigate(page: 'business-type-setting'): void;
448
+ /**
449
+ * 포스에서 페이지를 이동합니다.
450
+ * @param page business-type-setting 업종유형 변경, plugin-tab 플러그인 탭 이동
451
+ * @param packageName 이동할 탭의 이름, 없는 경우 첫번째 플러그인 탭으로 이동합니다
452
+ */
453
+ navigate(page: 'business-type-setting' | 'plugin-tab', packageName?: string): void;
454
+ }
455
+
456
+ /**
457
+ * @publicApi
458
+ */
459
+ export declare class NavigationImpl implements Navigation {
460
+ navigate(page: 'plugin-tab', packageName?: string): void;
461
+ navigate(page: 'business-type-setting'): void;
462
+ }
463
+
433
464
  /**
434
465
  * @publicApi
435
466
  * @return number
@@ -553,7 +584,8 @@ declare type PayCallback = (order: PluginOrder, price: PluginPrice, ui: Ui) => P
553
584
  * @publicApi
554
585
  */
555
586
  export declare interface Payment {
556
- on: (event: 'cancel' | 'paid', callback: PaymentCallback) => void;
587
+ on(event: 'cancel' | 'paid', callback: PaymentCallback): void;
588
+ on(event: 'before-cancel', callback: PaymentBeforeCancelCallback): void;
557
589
  cancel: (order: {
558
590
  id: string;
559
591
  }, payment: {
@@ -565,6 +597,14 @@ export declare interface Payment {
565
597
  getPayment: (paymentId: PluginPayment['id']) => Promise<PluginPayment>;
566
598
  }
567
599
 
600
+ /**
601
+ * @publicApi
602
+ */
603
+ export declare type PaymentBeforeCancelCallback = (payload: {
604
+ order: PluginOrder;
605
+ payment: PluginPayment;
606
+ }) => Promise<void>;
607
+
568
608
  declare type PaymentCallback = (paymentId: PluginPayment['id'], orderId: PluginOrder['id']) => void;
569
609
 
570
610
  /**
@@ -1154,6 +1194,9 @@ export declare interface PluginExternalPayment extends PluginPaymentBase {
1154
1194
  };
1155
1195
  }
1156
1196
 
1197
+ /**
1198
+ * @publicApi
1199
+ */
1157
1200
  declare interface PluginGetKdsOrderItemsPayload {
1158
1201
  states?: PluginKdsOrderItemState[];
1159
1202
  page: number;
@@ -1163,6 +1206,9 @@ declare interface PluginGetKdsOrderItemsPayload {
1163
1206
  itemIds?: number[];
1164
1207
  }
1165
1208
 
1209
+ /**
1210
+ * @publicApi
1211
+ */
1166
1212
  declare interface PluginGetKdsOrderItemsResult {
1167
1213
  contents: PluginKdsOrderItem[];
1168
1214
  last: boolean;
@@ -1212,6 +1258,9 @@ declare class PluginImpl implements Plugin_2 {
1212
1258
  */
1213
1259
  export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
1214
1260
 
1261
+ /**
1262
+ * @publicApi
1263
+ */
1215
1264
  declare interface PluginKdsLineItem {
1216
1265
  title: string;
1217
1266
  diningOption: PluginOrderDiningOption;
@@ -1245,6 +1294,9 @@ declare interface PluginKdsLineItemOrderPrice {
1245
1294
  declare interface PluginKdsOrder extends Omit<PluginOrder, 'lineItems'> {
1246
1295
  }
1247
1296
 
1297
+ /**
1298
+ * @publicApi
1299
+ */
1248
1300
  declare interface PluginKdsOrderItem {
1249
1301
  id: string;
1250
1302
  state: PluginKdsOrderItemState;
@@ -1259,8 +1311,14 @@ declare interface PluginKdsOrderItem {
1259
1311
  updatedAt: string;
1260
1312
  }
1261
1313
 
1314
+ /**
1315
+ * @publicApi
1316
+ */
1262
1317
  declare type PluginKdsOrderItemState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'CANCELLED';
1263
1318
 
1319
+ /**
1320
+ * @publicApi
1321
+ */
1264
1322
  declare type PluginKdsOrderRequestType = 'ADDED' | 'NEW' | 'CHANGED' | 'CANCELLED' | 'MERGED';
1265
1323
 
1266
1324
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
@@ -1354,6 +1412,7 @@ export declare type PluginOrderDiningOption = 'HERE' | 'TOGO' | 'DELIVERY' | 'PI
1354
1412
  * @description order를 만들기 위한 dto
1355
1413
  */
1356
1414
  export declare type PluginOrderDto = {
1415
+ orderKey?: string;
1357
1416
  memo?: string;
1358
1417
  numGuests?: number;
1359
1418
  discounts: PluginDiscount[];
@@ -1684,6 +1743,7 @@ declare type PopupType = Element_2['type'];
1684
1743
  * @publicApi
1685
1744
  */
1686
1745
  export declare type PosPluginSdk = {
1746
+ alert: AlertTypes;
1687
1747
  table: Table;
1688
1748
  category: CategoryTypes;
1689
1749
  catalog: Catalog;
@@ -1708,6 +1768,7 @@ export declare type PosPluginSdk = {
1708
1768
  sound: SoundTypes;
1709
1769
  kdsOrder: KdsOrder;
1710
1770
  pluginUnicast: PluginUnicastTypes;
1771
+ navigation: Navigation;
1711
1772
  };
1712
1773
 
1713
1774
  /**
@@ -1863,7 +1924,34 @@ declare type TextInput = BaseInput & {
1863
1924
  * @publicApi
1864
1925
  */
1865
1926
  export declare type ToastTypes = {
1927
+ /**
1928
+ * @deprecated toast.error(), toast.warn(), toast.success() 를 사용하세요
1929
+ */
1866
1930
  open(message: string): void;
1931
+ error(params: {
1932
+ message: string;
1933
+ button?: {
1934
+ text: string;
1935
+ onClick: () => void;
1936
+ };
1937
+ }): void;
1938
+ warn(params: {
1939
+ message: string;
1940
+ button?: {
1941
+ text: string;
1942
+ onClick: () => void;
1943
+ };
1944
+ }): void;
1945
+ success(params: {
1946
+ message: string;
1947
+ button?: {
1948
+ text: string;
1949
+ onClick: () => void;
1950
+ };
1951
+ }): void;
1952
+ /**
1953
+ * @deprecated toast.warn(), toast.error(), toast.success() 의 button.onClick 을 사용하세요
1954
+ */
1867
1955
  on(event: 'click', callback: () => void): () => void;
1868
1956
  };
1869
1957
 
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.26",
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: {
@@ -430,6 +439,28 @@ declare type MovePayload = {
430
439
  };
431
440
  };
432
441
 
442
+ /**
443
+ * @publicApi
444
+ */
445
+ export declare interface Navigation {
446
+ navigate(page: 'plugin-tab', packageName?: string): void;
447
+ navigate(page: 'business-type-setting'): void;
448
+ /**
449
+ * 포스에서 페이지를 이동합니다.
450
+ * @param page business-type-setting 업종유형 변경, plugin-tab 플러그인 탭 이동
451
+ * @param packageName 이동할 탭의 이름, 없는 경우 첫번째 플러그인 탭으로 이동합니다
452
+ */
453
+ navigate(page: 'business-type-setting' | 'plugin-tab', packageName?: string): void;
454
+ }
455
+
456
+ /**
457
+ * @publicApi
458
+ */
459
+ export declare class NavigationImpl implements Navigation {
460
+ navigate(page: 'plugin-tab', packageName?: string): void;
461
+ navigate(page: 'business-type-setting'): void;
462
+ }
463
+
433
464
  /**
434
465
  * @publicApi
435
466
  * @return number
@@ -553,7 +584,8 @@ declare type PayCallback = (order: PluginOrder, price: PluginPrice, ui: Ui) => P
553
584
  * @publicApi
554
585
  */
555
586
  export declare interface Payment {
556
- on: (event: 'cancel' | 'paid', callback: PaymentCallback) => void;
587
+ on(event: 'cancel' | 'paid', callback: PaymentCallback): void;
588
+ on(event: 'before-cancel', callback: PaymentBeforeCancelCallback): void;
557
589
  cancel: (order: {
558
590
  id: string;
559
591
  }, payment: {
@@ -565,6 +597,14 @@ export declare interface Payment {
565
597
  getPayment: (paymentId: PluginPayment['id']) => Promise<PluginPayment>;
566
598
  }
567
599
 
600
+ /**
601
+ * @publicApi
602
+ */
603
+ export declare type PaymentBeforeCancelCallback = (payload: {
604
+ order: PluginOrder;
605
+ payment: PluginPayment;
606
+ }) => Promise<void>;
607
+
568
608
  declare type PaymentCallback = (paymentId: PluginPayment['id'], orderId: PluginOrder['id']) => void;
569
609
 
570
610
  /**
@@ -1154,6 +1194,9 @@ export declare interface PluginExternalPayment extends PluginPaymentBase {
1154
1194
  };
1155
1195
  }
1156
1196
 
1197
+ /**
1198
+ * @publicApi
1199
+ */
1157
1200
  declare interface PluginGetKdsOrderItemsPayload {
1158
1201
  states?: PluginKdsOrderItemState[];
1159
1202
  page: number;
@@ -1163,6 +1206,9 @@ declare interface PluginGetKdsOrderItemsPayload {
1163
1206
  itemIds?: number[];
1164
1207
  }
1165
1208
 
1209
+ /**
1210
+ * @publicApi
1211
+ */
1166
1212
  declare interface PluginGetKdsOrderItemsResult {
1167
1213
  contents: PluginKdsOrderItem[];
1168
1214
  last: boolean;
@@ -1212,6 +1258,9 @@ declare class PluginImpl implements Plugin_2 {
1212
1258
  */
1213
1259
  export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
1214
1260
 
1261
+ /**
1262
+ * @publicApi
1263
+ */
1215
1264
  declare interface PluginKdsLineItem {
1216
1265
  title: string;
1217
1266
  diningOption: PluginOrderDiningOption;
@@ -1245,6 +1294,9 @@ declare interface PluginKdsLineItemOrderPrice {
1245
1294
  declare interface PluginKdsOrder extends Omit<PluginOrder, 'lineItems'> {
1246
1295
  }
1247
1296
 
1297
+ /**
1298
+ * @publicApi
1299
+ */
1248
1300
  declare interface PluginKdsOrderItem {
1249
1301
  id: string;
1250
1302
  state: PluginKdsOrderItemState;
@@ -1259,8 +1311,14 @@ declare interface PluginKdsOrderItem {
1259
1311
  updatedAt: string;
1260
1312
  }
1261
1313
 
1314
+ /**
1315
+ * @publicApi
1316
+ */
1262
1317
  declare type PluginKdsOrderItemState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'CANCELLED';
1263
1318
 
1319
+ /**
1320
+ * @publicApi
1321
+ */
1264
1322
  declare type PluginKdsOrderRequestType = 'ADDED' | 'NEW' | 'CHANGED' | 'CANCELLED' | 'MERGED';
1265
1323
 
1266
1324
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
@@ -1354,6 +1412,7 @@ export declare type PluginOrderDiningOption = 'HERE' | 'TOGO' | 'DELIVERY' | 'PI
1354
1412
  * @description order를 만들기 위한 dto
1355
1413
  */
1356
1414
  export declare type PluginOrderDto = {
1415
+ orderKey?: string;
1357
1416
  memo?: string;
1358
1417
  numGuests?: number;
1359
1418
  discounts: PluginDiscount[];
@@ -1677,6 +1736,7 @@ declare type PopupType = Element_2['type'];
1677
1736
  * @publicApi
1678
1737
  */
1679
1738
  export declare type PosPluginSdk = {
1739
+ alert: AlertTypes;
1680
1740
  table: Table;
1681
1741
  category: CategoryTypes;
1682
1742
  catalog: Catalog;
@@ -1701,6 +1761,7 @@ export declare type PosPluginSdk = {
1701
1761
  sound: SoundTypes;
1702
1762
  kdsOrder: KdsOrder;
1703
1763
  pluginUnicast: PluginUnicastTypes;
1764
+ navigation: Navigation;
1704
1765
  };
1705
1766
 
1706
1767
  /**
@@ -1856,7 +1917,34 @@ declare type TextInput = BaseInput & {
1856
1917
  * @publicApi
1857
1918
  */
1858
1919
  export declare type ToastTypes = {
1920
+ /**
1921
+ * @deprecated toast.error(), toast.warn(), toast.success() 를 사용하세요
1922
+ */
1859
1923
  open(message: string): void;
1924
+ error(params: {
1925
+ message: string;
1926
+ button?: {
1927
+ text: string;
1928
+ onClick: () => void;
1929
+ };
1930
+ }): void;
1931
+ warn(params: {
1932
+ message: string;
1933
+ button?: {
1934
+ text: string;
1935
+ onClick: () => void;
1936
+ };
1937
+ }): void;
1938
+ success(params: {
1939
+ message: string;
1940
+ button?: {
1941
+ text: string;
1942
+ onClick: () => void;
1943
+ };
1944
+ }): void;
1945
+ /**
1946
+ * @deprecated toast.warn(), toast.error(), toast.success() 의 button.onClick 을 사용하세요
1947
+ */
1860
1948
  on(event: 'click', callback: () => void): () => void;
1861
1949
  };
1862
1950