@tossplace/pos-plugin-sdk 0.0.18 → 0.0.20
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/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/sdk.d.ts +95 -0
- package/package.json +1 -1
- package/types/index.d.ts +95 -0
- package/types/callback/createCallbackId.d.ts +0 -1
- package/types/cash-receipt/cash-receipt.d.ts +0 -5
- package/types/catalog/catalog.d.ts +0 -9
- package/types/category/category.d.ts +0 -8
- package/types/error/PosPluginSdkError.d.ts +0 -7
- package/types/error/__test__/PosPluginSdkError.test.d.ts +0 -1
- package/types/http/http.d.ts +0 -14
- package/types/log/log.d.ts +0 -4
- package/types/merchant/merchant.d.ts +0 -9
- package/types/option/option.d.ts +0 -9
- package/types/order/order.d.ts +0 -19
- package/types/payment/assertPayment.d.ts +0 -2
- package/types/payment/payment.d.ts +0 -13
- package/types/payment-method/payment-method.d.ts +0 -12
- package/types/pos/sdk.d.ts +0 -37
- package/types/printer/printer.d.ts +0 -5
- package/types/storage/storage.d.ts +0 -17
- package/types/table/table.d.ts +0 -14
- package/types/toast/toast.d.ts +0 -8
- package/types/ui/popup/popup.d.ts +0 -2
- package/types/ui/ui.d.ts +0 -5
- package/types/websocket/websocket.d.ts +0 -34
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[]
|
|
@@ -359,6 +361,14 @@ declare type InputValue = {
|
|
|
359
361
|
|
|
360
362
|
declare type Join<T extends string, U extends string> = `${T}${U}` | '0';
|
|
361
363
|
|
|
364
|
+
/**
|
|
365
|
+
* @publicApi
|
|
366
|
+
*/
|
|
367
|
+
declare interface KdsOrder {
|
|
368
|
+
on(event: 'open' | 'complete' | 'cancel', callback: (id: PluginKdsOrderItem['id']) => void): void;
|
|
369
|
+
getKdsOrderItems(payload: PluginGetKdsOrderItemsPayload): Promise<PluginGetKdsOrderItemsResult>;
|
|
370
|
+
}
|
|
371
|
+
|
|
362
372
|
declare type Languages = Record<PluginLanguageCode, string>;
|
|
363
373
|
|
|
364
374
|
/**
|
|
@@ -1109,6 +1119,21 @@ export declare interface PluginExternalPayment extends PluginPaymentBase {
|
|
|
1109
1119
|
};
|
|
1110
1120
|
}
|
|
1111
1121
|
|
|
1122
|
+
declare interface PluginGetKdsOrderItemsPayload {
|
|
1123
|
+
states?: PluginKdsOrderItemState[];
|
|
1124
|
+
page: number;
|
|
1125
|
+
size: number;
|
|
1126
|
+
orderIds?: string[];
|
|
1127
|
+
categoryIds?: number[];
|
|
1128
|
+
itemIds?: number[];
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
declare interface PluginGetKdsOrderItemsResult {
|
|
1132
|
+
contents: PluginKdsOrderItem[];
|
|
1133
|
+
last: boolean;
|
|
1134
|
+
totalElements: number;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1112
1137
|
/**
|
|
1113
1138
|
* @publicApi
|
|
1114
1139
|
* 테이블이 놓여진 공간
|
|
@@ -1151,6 +1176,57 @@ declare class PluginImpl implements Plugin_2 {
|
|
|
1151
1176
|
*/
|
|
1152
1177
|
export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
|
|
1153
1178
|
|
|
1179
|
+
declare interface PluginKdsLineItem {
|
|
1180
|
+
title: string;
|
|
1181
|
+
diningOption: PluginOrderDiningOption;
|
|
1182
|
+
id: string;
|
|
1183
|
+
itemId: PluginOrderItem['id'];
|
|
1184
|
+
memo: string;
|
|
1185
|
+
optionChoices: PluginOrderItem['optionChoices'];
|
|
1186
|
+
orderPrice: PluginKdsLineItemOrderPrice;
|
|
1187
|
+
quantity: {
|
|
1188
|
+
previous: number;
|
|
1189
|
+
current: number;
|
|
1190
|
+
};
|
|
1191
|
+
appliedDiscounts: PluginDiscount[];
|
|
1192
|
+
item: {
|
|
1193
|
+
id: number;
|
|
1194
|
+
category: {
|
|
1195
|
+
id: number;
|
|
1196
|
+
order: number;
|
|
1197
|
+
};
|
|
1198
|
+
};
|
|
1199
|
+
createdAt: string;
|
|
1200
|
+
updatedAt: string;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
declare interface PluginKdsLineItemOrderPrice {
|
|
1204
|
+
orderDiscountValue: number;
|
|
1205
|
+
orderListPriceValue: number;
|
|
1206
|
+
orderPriceValue: number;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
declare interface PluginKdsOrder extends Omit<PluginOrder, 'lineItems'> {
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
declare interface PluginKdsOrderItem {
|
|
1213
|
+
id: string;
|
|
1214
|
+
state: PluginKdsOrderItemState;
|
|
1215
|
+
order: PluginKdsOrder;
|
|
1216
|
+
lineItems: PluginKdsLineItem[];
|
|
1217
|
+
diningOption: PluginOrderDiningOption;
|
|
1218
|
+
totalQuantity: number;
|
|
1219
|
+
orderRequestType: PluginKdsOrderRequestType;
|
|
1220
|
+
cancelledAt: string;
|
|
1221
|
+
completedAt: string;
|
|
1222
|
+
createdAt: string;
|
|
1223
|
+
updatedAt: string;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
declare type PluginKdsOrderItemState = 'OPENED' | 'COMPLETED' | 'CANCELLED';
|
|
1227
|
+
|
|
1228
|
+
declare type PluginKdsOrderRequestType = 'ADDED' | 'NEW' | 'CHANGED' | 'CANCELLED' | 'MERGED';
|
|
1229
|
+
|
|
1154
1230
|
declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
|
|
1155
1231
|
|
|
1156
1232
|
/**
|
|
@@ -1570,6 +1646,8 @@ export declare type PosPluginSdk = {
|
|
|
1570
1646
|
draftOrder: DraftOrder;
|
|
1571
1647
|
error: ErrorImpl;
|
|
1572
1648
|
powerSaver: PowerSaverTypes;
|
|
1649
|
+
sound: SoundTypes;
|
|
1650
|
+
kdsOrder: KdsOrder;
|
|
1573
1651
|
};
|
|
1574
1652
|
|
|
1575
1653
|
/**
|
|
@@ -1593,6 +1671,8 @@ export declare class PosPluginSdkRateLimitError extends PosPluginSdkError {
|
|
|
1593
1671
|
static isPosPluginSdkRateLimitError(error: unknown): error is PosPluginSdkRateLimitError;
|
|
1594
1672
|
}
|
|
1595
1673
|
|
|
1674
|
+
export declare const PosRateLimiter: () => MethodDecorator;
|
|
1675
|
+
|
|
1596
1676
|
/**
|
|
1597
1677
|
* @publicApi
|
|
1598
1678
|
*/
|
|
@@ -1641,6 +1721,7 @@ export declare interface SecureStore {
|
|
|
1641
1721
|
export declare type SettingTypes = {
|
|
1642
1722
|
setInputs: (inputs: Array<PluginInputs>) => Promise<void>;
|
|
1643
1723
|
getValues: <T extends Record<string, number | string | string[] | boolean | undefined>>() => Promise<T>;
|
|
1724
|
+
on: (event: 'change', callback: ChangeCallback) => void;
|
|
1644
1725
|
};
|
|
1645
1726
|
|
|
1646
1727
|
/**
|
|
@@ -1655,6 +1736,18 @@ declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
|
|
|
1655
1736
|
step: number;
|
|
1656
1737
|
};
|
|
1657
1738
|
|
|
1739
|
+
/**
|
|
1740
|
+
* @publicApi
|
|
1741
|
+
*/
|
|
1742
|
+
export declare type SoundTypes = {
|
|
1743
|
+
play: (args: {
|
|
1744
|
+
url: string;
|
|
1745
|
+
volume: number;
|
|
1746
|
+
repeat?: number;
|
|
1747
|
+
durationMs?: number;
|
|
1748
|
+
}) => void;
|
|
1749
|
+
};
|
|
1750
|
+
|
|
1658
1751
|
/**
|
|
1659
1752
|
* @publicApi
|
|
1660
1753
|
*/
|
|
@@ -1677,6 +1770,7 @@ export declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_C
|
|
|
1677
1770
|
* @publicApi
|
|
1678
1771
|
*/
|
|
1679
1772
|
export declare interface Table {
|
|
1773
|
+
getHalls: () => Promise<PluginHall[]>;
|
|
1680
1774
|
getTables: () => Promise<(PluginTable & {
|
|
1681
1775
|
order?: PluginOrder;
|
|
1682
1776
|
})[]>;
|
|
@@ -1713,6 +1807,7 @@ declare type TextInput = BaseInput & {
|
|
|
1713
1807
|
*/
|
|
1714
1808
|
export declare type ToastTypes = {
|
|
1715
1809
|
open(message: string): void;
|
|
1810
|
+
on(event: 'click', callback: () => void): () => void;
|
|
1716
1811
|
};
|
|
1717
1812
|
|
|
1718
1813
|
/**
|
package/package.json
CHANGED
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[]
|
|
@@ -359,6 +361,14 @@ declare type InputValue = {
|
|
|
359
361
|
|
|
360
362
|
declare type Join<T extends string, U extends string> = `${T}${U}` | '0';
|
|
361
363
|
|
|
364
|
+
/**
|
|
365
|
+
* @publicApi
|
|
366
|
+
*/
|
|
367
|
+
declare interface KdsOrder {
|
|
368
|
+
on(event: 'open' | 'complete' | 'cancel', callback: (id: PluginKdsOrderItem['id']) => void): void;
|
|
369
|
+
getKdsOrderItems(payload: PluginGetKdsOrderItemsPayload): Promise<PluginGetKdsOrderItemsResult>;
|
|
370
|
+
}
|
|
371
|
+
|
|
362
372
|
declare type Languages = Record<PluginLanguageCode, string>;
|
|
363
373
|
|
|
364
374
|
/**
|
|
@@ -1109,6 +1119,21 @@ export declare interface PluginExternalPayment extends PluginPaymentBase {
|
|
|
1109
1119
|
};
|
|
1110
1120
|
}
|
|
1111
1121
|
|
|
1122
|
+
declare interface PluginGetKdsOrderItemsPayload {
|
|
1123
|
+
states?: PluginKdsOrderItemState[];
|
|
1124
|
+
page: number;
|
|
1125
|
+
size: number;
|
|
1126
|
+
orderIds?: string[];
|
|
1127
|
+
categoryIds?: number[];
|
|
1128
|
+
itemIds?: number[];
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
declare interface PluginGetKdsOrderItemsResult {
|
|
1132
|
+
contents: PluginKdsOrderItem[];
|
|
1133
|
+
last: boolean;
|
|
1134
|
+
totalElements: number;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1112
1137
|
/**
|
|
1113
1138
|
* @publicApi
|
|
1114
1139
|
* 테이블이 놓여진 공간
|
|
@@ -1151,6 +1176,57 @@ declare class PluginImpl implements Plugin_2 {
|
|
|
1151
1176
|
*/
|
|
1152
1177
|
export declare type PluginInputs = TextInput | PasswordInput | RadioInput | CheckBoxInput | ToggleInput | SliderInput | NumberInput;
|
|
1153
1178
|
|
|
1179
|
+
declare interface PluginKdsLineItem {
|
|
1180
|
+
title: string;
|
|
1181
|
+
diningOption: PluginOrderDiningOption;
|
|
1182
|
+
id: string;
|
|
1183
|
+
itemId: PluginOrderItem['id'];
|
|
1184
|
+
memo: string;
|
|
1185
|
+
optionChoices: PluginOrderItem['optionChoices'];
|
|
1186
|
+
orderPrice: PluginKdsLineItemOrderPrice;
|
|
1187
|
+
quantity: {
|
|
1188
|
+
previous: number;
|
|
1189
|
+
current: number;
|
|
1190
|
+
};
|
|
1191
|
+
appliedDiscounts: PluginDiscount[];
|
|
1192
|
+
item: {
|
|
1193
|
+
id: number;
|
|
1194
|
+
category: {
|
|
1195
|
+
id: number;
|
|
1196
|
+
order: number;
|
|
1197
|
+
};
|
|
1198
|
+
};
|
|
1199
|
+
createdAt: string;
|
|
1200
|
+
updatedAt: string;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
declare interface PluginKdsLineItemOrderPrice {
|
|
1204
|
+
orderDiscountValue: number;
|
|
1205
|
+
orderListPriceValue: number;
|
|
1206
|
+
orderPriceValue: number;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
declare interface PluginKdsOrder extends Omit<PluginOrder, 'lineItems'> {
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
declare interface PluginKdsOrderItem {
|
|
1213
|
+
id: string;
|
|
1214
|
+
state: PluginKdsOrderItemState;
|
|
1215
|
+
order: PluginKdsOrder;
|
|
1216
|
+
lineItems: PluginKdsLineItem[];
|
|
1217
|
+
diningOption: PluginOrderDiningOption;
|
|
1218
|
+
totalQuantity: number;
|
|
1219
|
+
orderRequestType: PluginKdsOrderRequestType;
|
|
1220
|
+
cancelledAt: string;
|
|
1221
|
+
completedAt: string;
|
|
1222
|
+
createdAt: string;
|
|
1223
|
+
updatedAt: string;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
declare type PluginKdsOrderItemState = 'OPENED' | 'COMPLETED' | 'CANCELLED';
|
|
1227
|
+
|
|
1228
|
+
declare type PluginKdsOrderRequestType = 'ADDED' | 'NEW' | 'CHANGED' | 'CANCELLED' | 'MERGED';
|
|
1229
|
+
|
|
1154
1230
|
declare type PluginLanguageCode = ValueOf<typeof AvailableLanguageCodes>;
|
|
1155
1231
|
|
|
1156
1232
|
/**
|
|
@@ -1563,6 +1639,8 @@ export declare type PosPluginSdk = {
|
|
|
1563
1639
|
draftOrder: DraftOrder;
|
|
1564
1640
|
error: ErrorImpl;
|
|
1565
1641
|
powerSaver: PowerSaverTypes;
|
|
1642
|
+
sound: SoundTypes;
|
|
1643
|
+
kdsOrder: KdsOrder;
|
|
1566
1644
|
};
|
|
1567
1645
|
|
|
1568
1646
|
/**
|
|
@@ -1586,6 +1664,8 @@ export declare class PosPluginSdkRateLimitError extends PosPluginSdkError {
|
|
|
1586
1664
|
static isPosPluginSdkRateLimitError(error: unknown): error is PosPluginSdkRateLimitError;
|
|
1587
1665
|
}
|
|
1588
1666
|
|
|
1667
|
+
export declare const PosRateLimiter: () => MethodDecorator;
|
|
1668
|
+
|
|
1589
1669
|
/**
|
|
1590
1670
|
* @publicApi
|
|
1591
1671
|
*/
|
|
@@ -1634,6 +1714,7 @@ export declare interface SecureStore {
|
|
|
1634
1714
|
export declare type SettingTypes = {
|
|
1635
1715
|
setInputs: (inputs: Array<PluginInputs>) => Promise<void>;
|
|
1636
1716
|
getValues: <T extends Record<string, number | string | string[] | boolean | undefined>>() => Promise<T>;
|
|
1717
|
+
on: (event: 'change', callback: ChangeCallback) => void;
|
|
1637
1718
|
};
|
|
1638
1719
|
|
|
1639
1720
|
/**
|
|
@@ -1648,6 +1729,18 @@ declare type SliderInput = Omit<BaseInput, 'placeholder'> & {
|
|
|
1648
1729
|
step: number;
|
|
1649
1730
|
};
|
|
1650
1731
|
|
|
1732
|
+
/**
|
|
1733
|
+
* @publicApi
|
|
1734
|
+
*/
|
|
1735
|
+
export declare type SoundTypes = {
|
|
1736
|
+
play: (args: {
|
|
1737
|
+
url: string;
|
|
1738
|
+
volume: number;
|
|
1739
|
+
repeat?: number;
|
|
1740
|
+
durationMs?: number;
|
|
1741
|
+
}) => void;
|
|
1742
|
+
};
|
|
1743
|
+
|
|
1651
1744
|
/**
|
|
1652
1745
|
* @publicApi
|
|
1653
1746
|
*/
|
|
@@ -1670,6 +1763,7 @@ export declare type StoreStatus = 'NEW' | 'ACCEPTED' | 'REJECTED' | 'PARTIALLY_C
|
|
|
1670
1763
|
* @publicApi
|
|
1671
1764
|
*/
|
|
1672
1765
|
export declare interface Table {
|
|
1766
|
+
getHalls: () => Promise<PluginHall[]>;
|
|
1673
1767
|
getTables: () => Promise<(PluginTable & {
|
|
1674
1768
|
order?: PluginOrder;
|
|
1675
1769
|
})[]>;
|
|
@@ -1706,6 +1800,7 @@ declare type TextInput = BaseInput & {
|
|
|
1706
1800
|
*/
|
|
1707
1801
|
export declare type ToastTypes = {
|
|
1708
1802
|
open(message: string): void;
|
|
1803
|
+
on(event: 'click', callback: () => void): () => void;
|
|
1709
1804
|
};
|
|
1710
1805
|
|
|
1711
1806
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createCallbackId(length?: number): string;
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
package/types/http/http.d.ts
DELETED
|
@@ -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;
|
package/types/log/log.d.ts
DELETED
|
@@ -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;
|
package/types/option/option.d.ts
DELETED
|
@@ -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;
|
package/types/order/order.d.ts
DELETED
|
@@ -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,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 {};
|
package/types/pos/sdk.d.ts
DELETED
|
@@ -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,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 {};
|
package/types/table/table.d.ts
DELETED
|
@@ -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;
|
package/types/toast/toast.d.ts
DELETED
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;
|