@tossplace/pos-plugin-sdk 0.0.23 → 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;
@@ -1198,11 +1219,12 @@ export declare type PluginHttpResponse = {
1198
1219
 
1199
1220
  declare class PluginImpl implements Plugin_2 {
1200
1221
  constructor();
1201
- private initializePlugin;
1202
- getPluginInfo(): Promise<{
1222
+ getPluginInfo: () => Promise<{
1203
1223
  name: string;
1204
1224
  version: string;
1205
1225
  }>;
1226
+ private initializePlugin;
1227
+ private fetchPluginInfo;
1206
1228
  }
1207
1229
 
1208
1230
  /**
@@ -1211,6 +1233,9 @@ declare class PluginImpl implements Plugin_2 {
1211
1233
  */
1212
1234
  export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
1213
1235
 
1236
+ /**
1237
+ * @publicApi
1238
+ */
1214
1239
  declare interface PluginKdsLineItem {
1215
1240
  title: string;
1216
1241
  diningOption: PluginOrderDiningOption;
@@ -1244,6 +1269,9 @@ declare interface PluginKdsLineItemOrderPrice {
1244
1269
  declare interface PluginKdsOrder extends Omit<PluginOrder, 'lineItems'> {
1245
1270
  }
1246
1271
 
1272
+ /**
1273
+ * @publicApi
1274
+ */
1247
1275
  declare interface PluginKdsOrderItem {
1248
1276
  id: string;
1249
1277
  state: PluginKdsOrderItemState;
@@ -1258,8 +1286,14 @@ declare interface PluginKdsOrderItem {
1258
1286
  updatedAt: string;
1259
1287
  }
1260
1288
 
1289
+ /**
1290
+ * @publicApi
1291
+ */
1261
1292
  declare type PluginKdsOrderItemState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'CANCELLED';
1262
1293
 
1294
+ /**
1295
+ * @publicApi
1296
+ */
1263
1297
  declare type PluginKdsOrderRequestType = 'ADDED' | 'NEW' | 'CHANGED' | 'CANCELLED' | 'MERGED';
1264
1298
 
1265
1299
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
@@ -1353,6 +1387,7 @@ export declare type PluginOrderDiningOption = 'HERE' | 'TOGO' | 'DELIVERY' | 'PI
1353
1387
  * @description order를 만들기 위한 dto
1354
1388
  */
1355
1389
  export declare type PluginOrderDto = {
1390
+ orderKey?: string;
1356
1391
  memo?: string;
1357
1392
  numGuests?: number;
1358
1393
  discounts: PluginDiscount[];
@@ -1683,6 +1718,7 @@ declare type PopupType = Element_2['type'];
1683
1718
  * @publicApi
1684
1719
  */
1685
1720
  export declare type PosPluginSdk = {
1721
+ alert: AlertTypes;
1686
1722
  table: Table;
1687
1723
  category: CategoryTypes;
1688
1724
  catalog: Catalog;
@@ -1862,7 +1898,34 @@ declare type TextInput = BaseInput & {
1862
1898
  * @publicApi
1863
1899
  */
1864
1900
  export declare type ToastTypes = {
1901
+ /**
1902
+ * @deprecated toast.error(), toast.warn(), toast.success() 를 사용하세요
1903
+ */
1865
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
+ */
1866
1929
  on(event: 'click', callback: () => void): () => void;
1867
1930
  };
1868
1931
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tossplace/pos-plugin-sdk",
3
- "version": "0.0.23",
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;
@@ -1198,11 +1219,12 @@ export declare type PluginHttpResponse = {
1198
1219
 
1199
1220
  declare class PluginImpl implements Plugin_2 {
1200
1221
  constructor();
1201
- private initializePlugin;
1202
- getPluginInfo(): Promise<{
1222
+ getPluginInfo: () => Promise<{
1203
1223
  name: string;
1204
1224
  version: string;
1205
1225
  }>;
1226
+ private initializePlugin;
1227
+ private fetchPluginInfo;
1206
1228
  }
1207
1229
 
1208
1230
  /**
@@ -1211,6 +1233,9 @@ declare class PluginImpl implements Plugin_2 {
1211
1233
  */
1212
1234
  export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
1213
1235
 
1236
+ /**
1237
+ * @publicApi
1238
+ */
1214
1239
  declare interface PluginKdsLineItem {
1215
1240
  title: string;
1216
1241
  diningOption: PluginOrderDiningOption;
@@ -1244,6 +1269,9 @@ declare interface PluginKdsLineItemOrderPrice {
1244
1269
  declare interface PluginKdsOrder extends Omit<PluginOrder, 'lineItems'> {
1245
1270
  }
1246
1271
 
1272
+ /**
1273
+ * @publicApi
1274
+ */
1247
1275
  declare interface PluginKdsOrderItem {
1248
1276
  id: string;
1249
1277
  state: PluginKdsOrderItemState;
@@ -1258,8 +1286,14 @@ declare interface PluginKdsOrderItem {
1258
1286
  updatedAt: string;
1259
1287
  }
1260
1288
 
1289
+ /**
1290
+ * @publicApi
1291
+ */
1261
1292
  declare type PluginKdsOrderItemState = 'REQUESTED' | 'OPENED' | 'COMPLETED' | 'CANCELLED';
1262
1293
 
1294
+ /**
1295
+ * @publicApi
1296
+ */
1263
1297
  declare type PluginKdsOrderRequestType = 'ADDED' | 'NEW' | 'CHANGED' | 'CANCELLED' | 'MERGED';
1264
1298
 
1265
1299
  declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
@@ -1353,6 +1387,7 @@ export declare type PluginOrderDiningOption = 'HERE' | 'TOGO' | 'DELIVERY' | 'PI
1353
1387
  * @description order를 만들기 위한 dto
1354
1388
  */
1355
1389
  export declare type PluginOrderDto = {
1390
+ orderKey?: string;
1356
1391
  memo?: string;
1357
1392
  numGuests?: number;
1358
1393
  discounts: PluginDiscount[];
@@ -1676,6 +1711,7 @@ declare type PopupType = Element_2['type'];
1676
1711
  * @publicApi
1677
1712
  */
1678
1713
  export declare type PosPluginSdk = {
1714
+ alert: AlertTypes;
1679
1715
  table: Table;
1680
1716
  category: CategoryTypes;
1681
1717
  catalog: Catalog;
@@ -1855,7 +1891,34 @@ declare type TextInput = BaseInput & {
1855
1891
  * @publicApi
1856
1892
  */
1857
1893
  export declare type ToastTypes = {
1894
+ /**
1895
+ * @deprecated toast.error(), toast.warn(), toast.success() 를 사용하세요
1896
+ */
1858
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
+ */
1859
1922
  on(event: 'click', callback: () => void): () => void;
1860
1923
  };
1861
1924