@tossplace/pos-plugin-sdk 0.0.18 → 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[]
@@ -1570,6 +1572,7 @@ export declare type PosPluginSdk = {
1570
1572
  draftOrder: DraftOrder;
1571
1573
  error: ErrorImpl;
1572
1574
  powerSaver: PowerSaverTypes;
1575
+ sound: SoundTypes;
1573
1576
  };
1574
1577
 
1575
1578
  /**
@@ -1593,6 +1596,8 @@ export declare class PosPluginSdkRateLimitError extends PosPluginSdkError {
1593
1596
  static isPosPluginSdkRateLimitError(error: unknown): error is PosPluginSdkRateLimitError;
1594
1597
  }
1595
1598
 
1599
+ export declare const PosRateLimiter: () => MethodDecorator;
1600
+
1596
1601
  /**
1597
1602
  * @publicApi
1598
1603
  */
@@ -1641,6 +1646,7 @@ export declare interface SecureStore {
1641
1646
  export declare type SettingTypes = {
1642
1647
  setInputs: (inputs: Array<PluginInputs>) => Promise<void>;
1643
1648
  getValues: <T extends Record<string, number | string | string[] | boolean | undefined>>() => Promise<T>;
1649
+ on: (event: 'change', callback: ChangeCallback) => void;
1644
1650
  };
1645
1651
 
1646
1652
  /**
@@ -1655,6 +1661,18 @@ declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
1655
1661
  step: number;
1656
1662
  };
1657
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
+
1658
1676
  /**
1659
1677
  * @publicApi
1660
1678
  */
@@ -1677,6 +1695,7 @@ export declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_C
1677
1695
  * @publicApi
1678
1696
  */
1679
1697
  export declare interface Table {
1698
+ getHalls: () => Promise<PluginHall[]>;
1680
1699
  getTables: () => Promise<(PluginTable & {
1681
1700
  order?: PluginOrder;
1682
1701
  })[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tossplace/pos-plugin-sdk",
3
- "version": "0.0.18",
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[]
@@ -1563,6 +1565,7 @@ export declare type PosPluginSdk = {
1563
1565
  draftOrder: DraftOrder;
1564
1566
  error: ErrorImpl;
1565
1567
  powerSaver: PowerSaverTypes;
1568
+ sound: SoundTypes;
1566
1569
  };
1567
1570
 
1568
1571
  /**
@@ -1586,6 +1589,8 @@ export declare class PosPluginSdkRateLimitError extends PosPluginSdkError {
1586
1589
  static isPosPluginSdkRateLimitError(error: unknown): error is PosPluginSdkRateLimitError;
1587
1590
  }
1588
1591
 
1592
+ export declare const PosRateLimiter: () => MethodDecorator;
1593
+
1589
1594
  /**
1590
1595
  * @publicApi
1591
1596
  */
@@ -1634,6 +1639,7 @@ export declare interface SecureStore {
1634
1639
  export declare type SettingTypes = {
1635
1640
  setInputs: (inputs: Array<PluginInputs>) => Promise<void>;
1636
1641
  getValues: <T extends Record<string, number | string | string[] | boolean | undefined>>() => Promise<T>;
1642
+ on: (event: 'change', callback: ChangeCallback) => void;
1637
1643
  };
1638
1644
 
1639
1645
  /**
@@ -1648,6 +1654,18 @@ declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
1648
1654
  step: number;
1649
1655
  };
1650
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
+
1651
1669
  /**
1652
1670
  * @publicApi
1653
1671
  */
@@ -1670,6 +1688,7 @@ export declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_C
1670
1688
  * @publicApi
1671
1689
  */
1672
1690
  export declare interface Table {
1691
+ getHalls: () => Promise<PluginHall[]>;
1673
1692
  getTables: () => Promise<(PluginTable & {
1674
1693
  order?: PluginOrder;
1675
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;