@tossplace/pos-plugin-sdk 0.0.17 → 0.0.19

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
@@ -91,6 +91,8 @@ export declare interface CategoryTypes {
91
91
  on: (event: 'update' | 'add' | 'delete', callback: (category: PluginCatalogCategory['id']) => void) => void;
92
92
  }
93
93
 
94
+ declare type ChangeCallback = () => void;
95
+
94
96
  /**
95
97
  * @publicApi
96
98
  * @return 선택된 values id의 배열 string[]
@@ -150,7 +152,7 @@ export declare interface DeliveryCatalogOption {
150
152
  /**
151
153
  * @publicApi
152
154
  */
153
- export declare type DeliveryConnectionStatusErrorCode = 'NOT_RUNNING' | 'NOT_LOGGED_IN' | 'UNKNOWN' | 'BAEMIN_NOT_SELECTED_PROGRAM' | string;
155
+ export declare type DeliveryConnectionStatusErrorCode = 'BMPC_NOT_RUNNING' | 'NOT_RUNNING' | 'BMPC_NOT_LOGGED_IN' | 'NOT_LOGGED_IN' | 'BMPC_UNKNOWN' | 'UNKNOWN' | 'BAEMIN_NOT_SELECTED_PROGRAM' | string;
154
156
 
155
157
  /**
156
158
  * @publicApi
@@ -408,7 +410,22 @@ declare type NumberInput = BaseInput & {
408
410
  * @publicApi
409
411
  */
410
412
  export declare interface Order {
411
- getOrder: (id: string) => Promise<PluginOrder>;
413
+ getOrder(id: string): Promise<PluginOrder>;
414
+ /**
415
+ * @description tableId와 orderState로 주문을 조회합니다 search는 다른 도메인의 인자로 검색이 가능합니다
416
+ * @param tableId 테이블 id
417
+ * @param orderState 주문 상태
418
+ * @param start start 날짜의 00시부터 부터 주문을 검색합니다 (ISO 8601 포맷)
419
+ * @param end end 날짜 저녁 12시까지 주문을 검색합니다 (ISO 8601 포맷)
420
+ */
421
+ search(params: {
422
+ start: string;
423
+ end: string;
424
+ page?: number;
425
+ size?: number;
426
+ tableId?: PluginTable['id'];
427
+ orderState?: PluginOrderState[];
428
+ }): Promise<PluginOrder[]>;
412
429
  /**
413
430
  * @param start ISO 8601 포맷
414
431
  * @param end ISO 8601 포맷
@@ -416,21 +433,21 @@ export declare interface Order {
416
433
  * @param size default 20
417
434
  * @description createdAt 기준으로 주문을 조회합니다
418
435
  */
419
- getOrders: (params: {
436
+ getOrders(params: {
420
437
  start: string;
421
438
  end: string;
422
439
  page?: number;
423
440
  size?: number;
424
441
  orderStates?: PluginOrderState[];
425
- }) => Promise<PluginOrder[]>;
442
+ }): Promise<PluginOrder[]>;
426
443
  on(event: 'add' | 'accept' | 'decline' | 'expire' | 'complete' | 'update', callback: (order: PluginOrder['id']) => void): void;
427
- cancel: (id: string) => Promise<void>;
428
- add: (order: PluginOrderDto) => Promise<PluginOrder>;
444
+ cancel(id: string): Promise<void>;
445
+ add(order: PluginOrderDto): Promise<PluginOrder>;
429
446
  /**
430
447
  * 새로 추가 된 메뉴만 order에 넣으세요
431
448
  */
432
- addMenu: (orderId: string, order: PluginOrderDto) => Promise<PluginOrder>;
433
- complete: (id: string) => Promise<PluginOrder>;
449
+ addMenu(orderId: string, order: PluginOrderDto): Promise<PluginOrder>;
450
+ complete(id: string): Promise<PluginOrder>;
434
451
  }
435
452
 
436
453
  declare type Order_2 = {
@@ -1555,6 +1572,7 @@ export declare type PosPluginSdk = {
1555
1572
  draftOrder: DraftOrder;
1556
1573
  error: ErrorImpl;
1557
1574
  powerSaver: PowerSaverTypes;
1575
+ sound: SoundTypes;
1558
1576
  };
1559
1577
 
1560
1578
  /**
@@ -1578,6 +1596,8 @@ export declare class PosPluginSdkRateLimitError extends PosPluginSdkError {
1578
1596
  static isPosPluginSdkRateLimitError(error: unknown): error is PosPluginSdkRateLimitError;
1579
1597
  }
1580
1598
 
1599
+ export declare const PosRateLimiter: () => MethodDecorator;
1600
+
1581
1601
  /**
1582
1602
  * @publicApi
1583
1603
  */
@@ -1626,6 +1646,7 @@ export declare interface SecureStore {
1626
1646
  export declare type SettingTypes = {
1627
1647
  setInputs: (inputs: Array<PluginInputs>) => Promise<void>;
1628
1648
  getValues: <T extends Record<string, number | string | string[] | boolean | undefined>>() => Promise<T>;
1649
+ on: (event: 'change', callback: ChangeCallback) => void;
1629
1650
  };
1630
1651
 
1631
1652
  /**
@@ -1640,6 +1661,18 @@ declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
1640
1661
  step: number;
1641
1662
  };
1642
1663
 
1664
+ /**
1665
+ * @publicApi
1666
+ */
1667
+ export declare type SoundTypes = {
1668
+ play: (args: {
1669
+ url: string;
1670
+ volume: number;
1671
+ repeat?: number;
1672
+ durationMs?: number;
1673
+ }) => void;
1674
+ };
1675
+
1643
1676
  /**
1644
1677
  * @publicApi
1645
1678
  */
@@ -1662,6 +1695,7 @@ export declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_C
1662
1695
  * @publicApi
1663
1696
  */
1664
1697
  export declare interface Table {
1698
+ getHalls: () => Promise<PluginHall[]>;
1665
1699
  getTables: () => Promise<(PluginTable & {
1666
1700
  order?: PluginOrder;
1667
1701
  })[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tossplace/pos-plugin-sdk",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "포스 플러그인 sdk",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/types/index.d.ts CHANGED
@@ -91,6 +91,8 @@ export declare interface CategoryTypes {
91
91
  on: (event: 'update' | 'add' | 'delete', callback: (category: PluginCatalogCategory['id']) => void) => void;
92
92
  }
93
93
 
94
+ declare type ChangeCallback = () => void;
95
+
94
96
  /**
95
97
  * @publicApi
96
98
  * @return 선택된 values id의 배열 string[]
@@ -150,7 +152,7 @@ export declare interface DeliveryCatalogOption {
150
152
  /**
151
153
  * @publicApi
152
154
  */
153
- export declare type DeliveryConnectionStatusErrorCode = 'NOT_RUNNING' | 'NOT_LOGGED_IN' | 'UNKNOWN' | 'BAEMIN_NOT_SELECTED_PROGRAM' | string;
155
+ export declare type DeliveryConnectionStatusErrorCode = 'BMPC_NOT_RUNNING' | 'NOT_RUNNING' | 'BMPC_NOT_LOGGED_IN' | 'NOT_LOGGED_IN' | 'BMPC_UNKNOWN' | 'UNKNOWN' | 'BAEMIN_NOT_SELECTED_PROGRAM' | string;
154
156
 
155
157
  /**
156
158
  * @publicApi
@@ -408,7 +410,22 @@ declare type NumberInput = BaseInput & {
408
410
  * @publicApi
409
411
  */
410
412
  export declare interface Order {
411
- getOrder: (id: string) => Promise<PluginOrder>;
413
+ getOrder(id: string): Promise<PluginOrder>;
414
+ /**
415
+ * @description tableId와 orderState로 주문을 조회합니다 search는 다른 도메인의 인자로 검색이 가능합니다
416
+ * @param tableId 테이블 id
417
+ * @param orderState 주문 상태
418
+ * @param start start 날짜의 00시부터 부터 주문을 검색합니다 (ISO 8601 포맷)
419
+ * @param end end 날짜 저녁 12시까지 주문을 검색합니다 (ISO 8601 포맷)
420
+ */
421
+ search(params: {
422
+ start: string;
423
+ end: string;
424
+ page?: number;
425
+ size?: number;
426
+ tableId?: PluginTable['id'];
427
+ orderState?: PluginOrderState[];
428
+ }): Promise<PluginOrder[]>;
412
429
  /**
413
430
  * @param start ISO 8601 포맷
414
431
  * @param end ISO 8601 포맷
@@ -416,21 +433,21 @@ export declare interface Order {
416
433
  * @param size default 20
417
434
  * @description createdAt 기준으로 주문을 조회합니다
418
435
  */
419
- getOrders: (params: {
436
+ getOrders(params: {
420
437
  start: string;
421
438
  end: string;
422
439
  page?: number;
423
440
  size?: number;
424
441
  orderStates?: PluginOrderState[];
425
- }) => Promise<PluginOrder[]>;
442
+ }): Promise<PluginOrder[]>;
426
443
  on(event: 'add' | 'accept' | 'decline' | 'expire' | 'complete' | 'update', callback: (order: PluginOrder['id']) => void): void;
427
- cancel: (id: string) => Promise<void>;
428
- add: (order: PluginOrderDto) => Promise<PluginOrder>;
444
+ cancel(id: string): Promise<void>;
445
+ add(order: PluginOrderDto): Promise<PluginOrder>;
429
446
  /**
430
447
  * 새로 추가 된 메뉴만 order에 넣으세요
431
448
  */
432
- addMenu: (orderId: string, order: PluginOrderDto) => Promise<PluginOrder>;
433
- complete: (id: string) => Promise<PluginOrder>;
449
+ addMenu(orderId: string, order: PluginOrderDto): Promise<PluginOrder>;
450
+ complete(id: string): Promise<PluginOrder>;
434
451
  }
435
452
 
436
453
  declare type Order_2 = {
@@ -1548,6 +1565,7 @@ export declare type PosPluginSdk = {
1548
1565
  draftOrder: DraftOrder;
1549
1566
  error: ErrorImpl;
1550
1567
  powerSaver: PowerSaverTypes;
1568
+ sound: SoundTypes;
1551
1569
  };
1552
1570
 
1553
1571
  /**
@@ -1571,6 +1589,8 @@ export declare class PosPluginSdkRateLimitError extends PosPluginSdkError {
1571
1589
  static isPosPluginSdkRateLimitError(error: unknown): error is PosPluginSdkRateLimitError;
1572
1590
  }
1573
1591
 
1592
+ export declare const PosRateLimiter: () => MethodDecorator;
1593
+
1574
1594
  /**
1575
1595
  * @publicApi
1576
1596
  */
@@ -1619,6 +1639,7 @@ export declare interface SecureStore {
1619
1639
  export declare type SettingTypes = {
1620
1640
  setInputs: (inputs: Array<PluginInputs>) => Promise<void>;
1621
1641
  getValues: <T extends Record<string, number | string | string[] | boolean | undefined>>() => Promise<T>;
1642
+ on: (event: 'change', callback: ChangeCallback) => void;
1622
1643
  };
1623
1644
 
1624
1645
  /**
@@ -1633,6 +1654,18 @@ declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
1633
1654
  step: number;
1634
1655
  };
1635
1656
 
1657
+ /**
1658
+ * @publicApi
1659
+ */
1660
+ export declare type SoundTypes = {
1661
+ play: (args: {
1662
+ url: string;
1663
+ volume: number;
1664
+ repeat?: number;
1665
+ durationMs?: number;
1666
+ }) => void;
1667
+ };
1668
+
1636
1669
  /**
1637
1670
  * @publicApi
1638
1671
  */
@@ -1655,6 +1688,7 @@ export declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_C
1655
1688
  * @publicApi
1656
1689
  */
1657
1690
  export declare interface Table {
1691
+ getHalls: () => Promise<PluginHall[]>;
1658
1692
  getTables: () => Promise<(PluginTable & {
1659
1693
  order?: PluginOrder;
1660
1694
  })[]>;
@@ -1 +0,0 @@
1
- export declare function createCallbackId(length?: number): string;
@@ -1,5 +0,0 @@
1
- import { CashReceipt } from '@tossplace-nexus/plugin-types';
2
- export interface CashReceiptTypes {
3
- add: (receipt: CashReceipt) => Promise<void>;
4
- }
5
- export declare const cashReceipt: CashReceiptTypes;
@@ -1,9 +0,0 @@
1
- import { PluginCatalogItem } from '@tossplace-nexus/plugin-types';
2
- /**
3
- * @publicApi
4
- */
5
- export interface CatalogTypes {
6
- getCatalogs: () => Promise<PluginCatalogItem[]>;
7
- on: (event: 'sold-out' | 'on-sale', callback: (menu: PluginCatalogItem) => void) => void;
8
- }
9
- export declare const catalog: CatalogTypes;
@@ -1,8 +0,0 @@
1
- import { PluginCatalogCategory } from '@tossplace-nexus/plugin-types';
2
- /**
3
- * @publicApi
4
- */
5
- export interface CategoryTypes {
6
- getCategories: () => Promise<PluginCatalogCategory[]>;
7
- }
8
- export declare const category: CategoryTypes;
@@ -1,7 +0,0 @@
1
- /**
2
- * @publicApi
3
- */
4
- export declare class PosPluginSdkError extends Error {
5
- constructor(message: string);
6
- static isPosPluginSdkError(error: unknown): error is PosPluginSdkError;
7
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
1
- import { PluginHttpResponse } from '@tossplace-nexus/plugin-types';
2
- /**
3
- * @publicApi
4
- */
5
- export interface HttpTypes {
6
- get: (url: string, headers?: [string, string][]) => Promise<PluginHttpResponse>;
7
- post: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
8
- delete: (url: string, headers?: [string, string][]) => Promise<PluginHttpResponse>;
9
- head: (url: string, headers?: [string, string][]) => Promise<PluginHttpResponse>;
10
- options: (url: string, headers?: [string, string][]) => Promise<PluginHttpResponse>;
11
- put: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
12
- patch: (url: string, payload: any, headers?: [string, string][]) => Promise<PluginHttpResponse>;
13
- }
14
- export declare const http: HttpTypes;
@@ -1,4 +0,0 @@
1
- export declare type LogTypes = {
2
- send(log: string): void;
3
- };
4
- export declare const log: LogTypes;
@@ -1,9 +0,0 @@
1
- import { TossMerchant } from '@tossplace-nexus/plugin-types';
2
- export declare function getMerchant(): Promise<TossMerchant>;
3
- /**
4
- * @publicApi
5
- */
6
- export interface MerchantTypes {
7
- getMerchant: () => Promise<TossMerchant>;
8
- }
9
- export declare const merchant: MerchantTypes;
@@ -1,9 +0,0 @@
1
- import { PluginCatalogItemOption } from '@tossplace-nexus/plugin-types';
2
- /**
3
- * @publicApi
4
- */
5
- export interface MenuOptionTypes {
6
- getOptions: () => Promise<PluginCatalogItemOption[]>;
7
- on: (event: 'sold-out' | 'on-sale', callback: (option: PluginCatalogItemOption) => void) => void;
8
- }
9
- export declare const option: MenuOptionTypes;
@@ -1,19 +0,0 @@
1
- import { PluginOrder, PluginOrderDto } from '@tossplace-nexus/plugin-types';
2
- /**
3
- * @publicApi
4
- */
5
- export interface OrderTypes {
6
- getOrder: (id: string) => Promise<PluginOrder>;
7
- /**
8
- * 토스포스에서 카드결제를 취소하면 무조건 카드리딩해야함 그래서 on cancel은 늘 환불까지 된 상태임
9
- */
10
- on: (event: 'cancel', callback: (order: PluginOrder) => void) => void;
11
- cancel: (id: string) => Promise<void>;
12
- add: (order: PluginOrderDto) => Promise<PluginOrder>;
13
- /**
14
- * 새로 추가 된 메뉴만 order에 넣으세요
15
- */
16
- addMenu: (orderId: string, order: PluginOrderDto) => Promise<PluginOrder>;
17
- complete: (id: string) => Promise<PluginOrder>;
18
- }
19
- export declare const order: OrderTypes;
@@ -1,2 +0,0 @@
1
- import { PluginPaymentDto } from '@tossplace-nexus/plugin-types';
2
- export declare function assertPayment(paymentDto: PluginPaymentDto): void;
@@ -1,13 +0,0 @@
1
- import { PluginPaymentDto, PluginPaymentOf } from '@tossplace-nexus/plugin-types';
2
- export interface PaymentTypes {
3
- on: (event: 'cancel' | 'paid', callback: (payload: PluginPaymentOf<'CASH'> | PluginPaymentOf<'CARD'> | PluginPaymentOf<'EXTERNAL'>) => void) => void;
4
- cancel: (order: {
5
- id: string;
6
- }, payment: {
7
- id: string;
8
- }) => Promise<void>;
9
- add: (order: {
10
- id: string;
11
- }, paymentDto: PluginPaymentDto) => Promise<PluginPaymentOf<'CARD'> | PluginPaymentOf<'CASH'> | PluginPaymentOf<'EXTERNAL'>>;
12
- }
13
- export declare const payment: PaymentTypes;
@@ -1,12 +0,0 @@
1
- import { PaymentMethodResponse, PluginCancelledPaymentDto, PluginMessage, PluginOrder, PluginPayment, PluginPrice } from '@tossplace-nexus/plugin-types';
2
- declare type PayCallback = (order: PluginOrder, price: PluginPrice) => Promise<PaymentMethodResponse | undefined>;
3
- declare type CancelCallback = (order: PluginOrder, payment: PluginPayment) => Promise<PluginCancelledPaymentDto | undefined>;
4
- export declare type PaymentMethodType = {
5
- add: (payload: {
6
- data: PluginMessage<'payment.method.add'>['data'];
7
- payCallback: PayCallback;
8
- cancelCallback: CancelCallback;
9
- }) => void;
10
- };
11
- export declare const paymentMethod: PaymentMethodType;
12
- export {};
@@ -1,37 +0,0 @@
1
- import { CashReceiptTypes } from '../cash-receipt/cash-receipt';
2
- import { StorageTypes } from '../storage/storage';
3
- import { TableTypes } from '../table/table';
4
- import { CategoryTypes } from '../category/category';
5
- import { CatalogTypes } from '../catalog/catalog';
6
- import { MenuOptionTypes } from '../option/option';
7
- import { OrderTypes } from '../order/order';
8
- import { HttpTypes } from '../http/http';
9
- import { PaymentTypes } from '../payment/payment';
10
- import { ToastTypes } from '../toast/toast';
11
- import { MerchantTypes } from '../merchant/merchant';
12
- import { UiType } from '../ui/ui';
13
- import { PaymentMethodType } from '../payment-method/payment-method';
14
- import { WebsocketTypes } from '../websocket/websocket';
15
- /**
16
- * @publicApi
17
- */
18
- export declare type Sdk = {
19
- table: TableTypes;
20
- category: CategoryTypes;
21
- catalog: CatalogTypes;
22
- option: MenuOptionTypes;
23
- storage: StorageTypes;
24
- cashReceipt: CashReceiptTypes;
25
- order: OrderTypes;
26
- payment: PaymentTypes;
27
- http: HttpTypes;
28
- toast: ToastTypes;
29
- merchant: MerchantTypes;
30
- ui: UiType;
31
- paymentMethod: PaymentMethodType;
32
- websocket: WebsocketTypes;
33
- };
34
- /**
35
- * @publicApi
36
- */
37
- export declare const pos: Sdk;
@@ -1,5 +0,0 @@
1
- import { PluginOrder, PluginTable } from '@tossplace-nexus/plugin-types';
2
- export interface PrinterTypes {
3
- print: (order: PluginOrder, previousOrder?: PluginOrder, table?: PluginTable) => Promise<void>;
4
- }
5
- export declare const printer: PrinterTypes;
@@ -1,17 +0,0 @@
1
- declare function get(key: string): Promise<string | undefined>;
2
- declare function set(key: string, value: any): Promise<void>;
3
- declare function del(key: string): Promise<void>;
4
- /**
5
- * @publicApi
6
- */
7
- export interface StorageTypes {
8
- get: (key: string) => Promise<string | undefined>;
9
- set: (key: string, value: string) => Promise<void>;
10
- del: (key: string) => Promise<void>;
11
- }
12
- export declare const storage: {
13
- get: typeof get;
14
- set: typeof set;
15
- del: typeof del;
16
- };
17
- export {};
@@ -1,14 +0,0 @@
1
- import { PluginOrder, PluginTable } from '@tossplace-nexus/plugin-types';
2
- export interface TableTypes {
3
- getTables: () => Promise<{
4
- table: PluginTable;
5
- order?: PluginOrder;
6
- }[]>;
7
- on(event: 'order-update' | 'add' | 'clear', callback: (table: PluginTable) => void): void;
8
- on(event: 'swap' | 'move' | 'merge', callback: (before: PluginTable, after: PluginTable) => void): void;
9
- clearTable: (payload: {
10
- table: PluginTable;
11
- order?: PluginOrder;
12
- }) => Promise<void>;
13
- }
14
- export declare const table: TableTypes;
@@ -1,8 +0,0 @@
1
- declare function open(message: string): void;
2
- export declare type ToastTypes = {
3
- open(message: string): void;
4
- };
5
- export declare const toast: {
6
- open: typeof open;
7
- };
8
- export {};
@@ -1,2 +0,0 @@
1
- import { AllPopupType, PopupActionResponse, PopupElements } from '@tossplace-nexus/plugin-types';
2
- export declare function openPopup<T extends AllPopupType>(data: PopupElements<T>): Promise<PopupActionResponse<T>>;
package/types/ui/ui.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { AllPopupType, PopupActionResponse, PopupElements } from '@tossplace-nexus/plugin-types/src/ui/popup';
2
- export declare type UiType = {
3
- openPopup<T extends AllPopupType>(message: PopupElements<T>): Promise<PopupActionResponse<T>>;
4
- };
5
- export declare const ui: UiType;
@@ -1,34 +0,0 @@
1
- export declare class Websocket {
2
- private readonly url;
3
- private readonly headers;
4
- private readonly options?;
5
- onMessageCallback: ((message: string) => void) | undefined;
6
- onErrorCallback: ((errorName?: string, errorMessage?: string) => void) | undefined;
7
- onCloseCallback: ((code: string) => void) | undefined;
8
- onOpenCallback: (() => void) | undefined;
9
- constructor(url: string, headers: Record<string, string>, options?: {
10
- rejectUnauthorized?: boolean | undefined;
11
- followRedirects?: boolean | undefined;
12
- timeout?: number | undefined;
13
- } | undefined);
14
- connect(): Promise<void>;
15
- disconnect(): Promise<void>;
16
- send(data: {
17
- data: string;
18
- option?: {
19
- mask?: boolean;
20
- };
21
- }): void;
22
- onMessage(callback: (message: string) => void): void;
23
- onError(callback: (errorName?: string, errorMessage?: string) => void): void;
24
- onClose(callback: (code: string) => void): void;
25
- onOpen(callback: () => void): void;
26
- }
27
- export declare type WebsocketTypes = {
28
- create: (url: string, headers: Record<string, string>, options?: {
29
- rejectUnauthorized?: boolean;
30
- followRedirects?: boolean;
31
- timeout?: number;
32
- }) => Promise<Websocket>;
33
- };
34
- export declare const websocket: WebsocketTypes;