@posx/core 5.5.71 → 5.5.74

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 Francisco Hodge
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Francisco Hodge
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,85 +1,85 @@
1
- # 第一阶段
2
- - 1. 创建,更新,删除都是通过 -> Http API
3
- - 2. 读取是通过本地数据库 -> 本地, (例外:订单从云端读取)
4
-
5
- # 第二阶段 (单机版)
6
- 1. 创建,更新,删除,读取都通过本地数据库,然后进行数据和云端同步(Web Worker)
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
- <div align="center">
19
- <img align="center" width="230" src="https://i.imgur.com/iHgtvmg.png" />
20
- <h2>Typescript Library Boilerplate Basic</h2>
21
- <blockquote>Minimal Library Starter Kit for your Typescript projects</blockquote>
22
-
23
- <a href="https://www.npmjs.com/package/@hodgef/ts-library-boilerplate-basic"><img src="https://badgen.net/npm/v/@hodgef/ts-library-boilerplate-basic?color=blue" alt="npm version"></a> <a href="https://github.com/hodgef/ts-library-boilerplate"><img src="https://img.shields.io/github/last-commit/hodgef/ts-library-boilerplate" alt="latest commit"></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"><img alt="Build Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Build/badge.svg?color=green" /></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"> <img alt="Publish Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Publish/badge.svg?color=green" /></a>
24
-
25
- <strong>For a plain Javascript alternative, check out [js-library-boilerplate-basic](https://github.com/hodgef/js-library-boilerplate-basic).</strong>
26
-
27
- </div>
28
-
29
- ## ⭐️ Features
30
-
31
- - Webpack 5
32
- - Babel 7
33
- - Hot reloading (`npm start`)
34
- - Automatic Types file generation (index.d.ts)
35
- - UMD exports, so your library works everywhere.
36
- - Jest unit testing
37
- - Customizable file headers for your build [(Example 1)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/index.js) [(Example2)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/css/index.css)
38
- - Daily [dependabot](https://dependabot.com) dependency updates
39
-
40
- ## 📦 Getting Started
41
-
42
- ```
43
- git clone https://github.com/hodgef/ts-library-boilerplate-basic.git myLibrary
44
- npm install
45
- ```
46
-
47
- ## 💎 Customization
48
-
49
- > Before shipping, make sure to:
50
-
51
- 1. Edit `LICENSE` file
52
- 2. Edit `package.json` information (These will be used to generate the headers for your built files)
53
- 3. Edit `library: "MyLibrary"` with your library's export name in `./webpack.config.js`
54
-
55
- ## 🚀 Deployment
56
-
57
- 1. `npm publish`
58
- 2. Your users can include your library as usual
59
-
60
- ### npm
61
-
62
- ```
63
- import MyLibrary from 'my-library';
64
- const libraryInstance = new MyLibrary();
65
- ...
66
- ```
67
-
68
- ### self-host/cdn
69
-
70
- ```
71
- <script src="build/index.js"></script>
72
-
73
- const MyLibrary = window.MyLibrary.default;
74
- const libraryInstance = new MyLibrary();
75
- ...
76
- ```
77
-
78
- ## ✅ Libraries built with this boilerplate
79
-
80
- > Made a library using this starter kit? Share it here by [submitting a pull request](https://github.com/hodgef/ts-library-boilerplate-basic/pulls)!
81
-
82
- - [simple-keyboard](https://github.com/hodgef/simple-keyboard) - Javascript Virtual Keyboard
83
- - [react-simple-keyboard](https://github.com/hodgef/react-simple-keyboard) - React Virtual Keyboard
84
- - [simple-keyboard-layouts](https://github.com/hodgef/simple-keyboard-layouts) - Keyboard layouts for simple-keyboard
85
- - [atlas-monaco](https://github.com/datdao/atlas-monaco) - AtlasHCL for monaco editor
1
+ # 第一阶段
2
+ - 1. 创建,更新,删除都是通过 -> Http API
3
+ - 2. 读取是通过本地数据库 -> 本地, (例外:订单从云端读取)
4
+
5
+ # 第二阶段 (单机版)
6
+ 1. 创建,更新,删除,读取都通过本地数据库,然后进行数据和云端同步(Web Worker)
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+ <div align="center">
19
+ <img align="center" width="230" src="https://i.imgur.com/iHgtvmg.png" />
20
+ <h2>Typescript Library Boilerplate Basic</h2>
21
+ <blockquote>Minimal Library Starter Kit for your Typescript projects</blockquote>
22
+
23
+ <a href="https://www.npmjs.com/package/@hodgef/ts-library-boilerplate-basic"><img src="https://badgen.net/npm/v/@hodgef/ts-library-boilerplate-basic?color=blue" alt="npm version"></a> <a href="https://github.com/hodgef/ts-library-boilerplate"><img src="https://img.shields.io/github/last-commit/hodgef/ts-library-boilerplate" alt="latest commit"></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"><img alt="Build Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Build/badge.svg?color=green" /></a> <a href="https://github.com/hodgef/ts-library-boilerplate-basic/actions"> <img alt="Publish Status" src="https://github.com/hodgef/ts-library-boilerplate-basic/workflows/Publish/badge.svg?color=green" /></a>
24
+
25
+ <strong>For a plain Javascript alternative, check out [js-library-boilerplate-basic](https://github.com/hodgef/js-library-boilerplate-basic).</strong>
26
+
27
+ </div>
28
+
29
+ ## ⭐️ Features
30
+
31
+ - Webpack 5
32
+ - Babel 7
33
+ - Hot reloading (`npm start`)
34
+ - Automatic Types file generation (index.d.ts)
35
+ - UMD exports, so your library works everywhere.
36
+ - Jest unit testing
37
+ - Customizable file headers for your build [(Example 1)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/index.js) [(Example2)](https://github.com/hodgef/ts-library-boilerplate-basic/blob/master/build/css/index.css)
38
+ - Daily [dependabot](https://dependabot.com) dependency updates
39
+
40
+ ## 📦 Getting Started
41
+
42
+ ```
43
+ git clone https://github.com/hodgef/ts-library-boilerplate-basic.git myLibrary
44
+ npm install
45
+ ```
46
+
47
+ ## 💎 Customization
48
+
49
+ > Before shipping, make sure to:
50
+
51
+ 1. Edit `LICENSE` file
52
+ 2. Edit `package.json` information (These will be used to generate the headers for your built files)
53
+ 3. Edit `library: "MyLibrary"` with your library's export name in `./webpack.config.js`
54
+
55
+ ## 🚀 Deployment
56
+
57
+ 1. `npm publish`
58
+ 2. Your users can include your library as usual
59
+
60
+ ### npm
61
+
62
+ ```
63
+ import MyLibrary from 'my-library';
64
+ const libraryInstance = new MyLibrary();
65
+ ...
66
+ ```
67
+
68
+ ### self-host/cdn
69
+
70
+ ```
71
+ <script src="build/index.js"></script>
72
+
73
+ const MyLibrary = window.MyLibrary.default;
74
+ const libraryInstance = new MyLibrary();
75
+ ...
76
+ ```
77
+
78
+ ## ✅ Libraries built with this boilerplate
79
+
80
+ > Made a library using this starter kit? Share it here by [submitting a pull request](https://github.com/hodgef/ts-library-boilerplate-basic/pulls)!
81
+
82
+ - [simple-keyboard](https://github.com/hodgef/simple-keyboard) - Javascript Virtual Keyboard
83
+ - [react-simple-keyboard](https://github.com/hodgef/react-simple-keyboard) - React Virtual Keyboard
84
+ - [simple-keyboard-layouts](https://github.com/hodgef/simple-keyboard-layouts) - Keyboard layouts for simple-keyboard
85
+ - [atlas-monaco](https://github.com/datdao/atlas-monaco) - AtlasHCL for monaco editor
package/build/index.d.ts CHANGED
@@ -32,6 +32,17 @@ declare module '@posx/core/index' {
32
32
  export * from '@posx/core/types/condition.type';
33
33
  export * from '@posx/core/types/merchant.type';
34
34
 
35
+ }
36
+ declare module '@posx/core/libs/FindOptions' {
37
+ export const Include: (query?: string) => (val: any) => any;
38
+ export const In: (query?: never[]) => (val: never) => boolean;
39
+ export const Between: (begin: number, end: number) => (val: number) => boolean;
40
+ export const Not: (query?: any) => (val: any, values: any) => boolean;
41
+ export const Raw: (fn: any) => any;
42
+ export const filterByParams: (params: {
43
+ [key: string]: any;
44
+ }) => (values: any) => boolean;
45
+
35
46
  }
36
47
  declare module '@posx/core/libs/electron.socket' {
37
48
  export class ElectronSocket {
@@ -247,17 +258,6 @@ declare module '@posx/core/libs/escpos.printer' {
247
258
  items: IPrintCommandLine[];
248
259
  }
249
260
 
250
- }
251
- declare module '@posx/core/libs/FindOptions' {
252
- export const Include: (query?: string) => (val: any) => any;
253
- export const In: (query?: never[]) => (val: never) => boolean;
254
- export const Between: (begin: number, end: number) => (val: number) => boolean;
255
- export const Not: (query?: any) => (val: any, values: any) => boolean;
256
- export const Raw: (fn: any) => any;
257
- export const filterByParams: (params: {
258
- [key: string]: any;
259
- }) => (values: any) => boolean;
260
-
261
261
  }
262
262
  declare module '@posx/core/service.factory' {
263
263
  import { IServiceOptions } from '@posx/core/types/misc.type';
@@ -428,7 +428,7 @@ declare module '@posx/core/services/app.service' {
428
428
  import { AppRemoteService, IAppRemoteService, IAppModelSequence } from '@posx/core/services/abstract.service';
429
429
  import { IAppConfig, IConfig, UpdateGeneralConfigOptions, ICache } from '@posx/core/types/config.type';
430
430
  import { IPrintJob, IPrintTemplate, IPrinter, IRenderPrintTemplateOptions, RenderPrintTemplateOptions } from '@posx/core/types/printer.type';
431
- import { IPayment, IPaymentMethod, IPaymentSyncData } from '@posx/core/types/payment.type';
431
+ import { IPayment, IPaymentMethod } from '@posx/core/types/payment.type';
432
432
  import { INote, INoteGroup } from '@posx/core/types/note.type';
433
433
  import { ISection, ISectionItem } from '@posx/core/types/section.type';
434
434
  import { Category, ICategory, ICoreItem, IItem, ISubcategory } from '@posx/core/types/product.type';
@@ -835,49 +835,16 @@ declare module '@posx/core/services/app.service' {
835
835
  * @returns A promise that resolves to the updated invoice.
836
836
  */
837
837
  removePayment(invoice: IInvoice, payment_uid: string): Promise<IInvoice>;
838
- /**
839
- * Sync payment status callback function type
840
- */
841
- onPaymentSync?: (data: IPaymentSyncData) => Promise<void>;
842
- /**
843
- * Sync payment status to external systems
844
- * @param data - Payment sync data
845
- */
846
- syncPaymentStatus(data: IPaymentSyncData): Promise<void>;
847
838
  }
848
- /**
849
- * Payment Service implementation
850
- *
851
- * Usage example for CDS payment status sync:
852
- * ```typescript
853
- * // Setup payment sync callback
854
- * paymentService.onPaymentSync = async (data: IPaymentSyncData) => {
855
- * // Send to CDS or other external systems
856
- * console.log('Payment status:', data.status, 'for payment:', data.payment_uid);
857
- * };
858
- *
859
- * // Manual payment status sync (for external payment flows)
860
- * await paymentService.syncPaymentStatus({
861
- * payment_uid: 'payment_123',
862
- * invoice_uid: 'invoice_456',
863
- * status: PaymentStatus.STARTED,
864
- * payment_method: paymentMethod,
865
- * amount: 100.00,
866
- * timestamp: new Date()
867
- * });
868
- * ```
869
- */
870
839
  export class PaymentService extends AppRemoteService<IPayment> implements IPaymentService {
871
840
  readonly http: AxiosInstance;
872
841
  readonly db: Dexie;
873
842
  readonly options: IServiceOptions;
874
843
  readonly moduleName: string;
875
844
  readonly methodName: string;
876
- onPaymentSync?: (data: IPaymentSyncData) => Promise<void>;
877
845
  constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
878
846
  addPayment(invoice: IInvoice, amount: number, paymentMethod: IPaymentMethod): Promise<IInvoice>;
879
847
  removePayment(invoice: IInvoice, payment_uid: string): Promise<IInvoice>;
880
- syncPaymentStatus(data: IPaymentSyncData): Promise<void>;
881
848
  }
882
849
  /**
883
850
  * Represents the interface for the AppMiscService.
@@ -1019,6 +986,7 @@ declare module '@posx/core/services/invoice.service' {
1019
986
  import { IPrinter, PrinterType } from '@posx/core/types/printer.type';
1020
987
  import { IEmployee } from '@posx/core/types/employee.type';
1021
988
  import { QueryBuilder, QueryEtcParams } from '@posx/core/utils/autoquery.utils';
989
+ import { ICoupon } from '@posx/core/types/wyo.coupon.type';
1022
990
  export interface IInvoiceBaseService extends IAppRemoteService<IInvoice> {
1023
991
  calculate(invoice: IInvoice, appConfig: IAppConfig, disableRounding?: boolean): IInvoice;
1024
992
  calculateLines(invoice: IInvoice): void;
@@ -1395,6 +1363,14 @@ declare module '@posx/core/services/invoice.service' {
1395
1363
  * @returns The updated invoice with the added discount
1396
1364
  */
1397
1365
  addInvoiceDiscount(invoice: IInvoice, discountType: CalcType, amountOrPercent: number, calcFlow?: CalcFlow): IInvoice;
1366
+ /**
1367
+ * Adds a coupon to an invoice
1368
+ * @param invoice - The invoice to add the coupon to
1369
+ * @param coupon - The coupon to add to the invoice
1370
+ * @param calcFlow - The calculation flow to use for the coupon
1371
+ * @returns The updated invoice with the added coupon
1372
+ */
1373
+ addCouponToInvoice(invoice: IInvoice, coupon: ICoupon, calcFlow?: CalcFlow): IInvoice;
1398
1374
  /**
1399
1375
  * Removes a discount from an invoice
1400
1376
  * @param invoice - The invoice to remove the discount from
@@ -1512,6 +1488,7 @@ declare module '@posx/core/services/invoice.service' {
1512
1488
  duplicateInvoice(invoice: IInvoice, employee?: IEmployee): Promise<IInvoice>;
1513
1489
  reprintReceipt(invoice: IInvoice): Promise<boolean>;
1514
1490
  addInvoiceDiscount(invoice: IInvoice, discountType: CalcType, amountOrPercent: number, calcFlow?: CalcFlow): IInvoice;
1491
+ addCouponToInvoice(invoice: IInvoice, coupon: ICoupon, calcFlow?: CalcFlow): IInvoice;
1515
1492
  removeInvoiceDiscount(invoice: IInvoice, discountUid: string): IInvoice;
1516
1493
  overwriteNoteToInvoice(invoice: IInvoice, note: string): IInvoice;
1517
1494
  addSalesPersonToInvoice(invoice: IInvoice, salesUserUid: string): IInvoice;
@@ -2490,11 +2467,6 @@ declare module '@posx/core/types/hub.message.type' {
2490
2467
  SmoochPaymentEvent = "smooch_payment_event",
2491
2468
  SyncInvoice = "sync_invoice"
2492
2469
  }
2493
- export enum PaymentStatus {
2494
- STARTED = "payment_started",
2495
- COMPLETED = "payment_completed",
2496
- FAILED = "payment_failed"
2497
- }
2498
2470
  export type HubMessage<T> = {
2499
2471
  type: HubMessageType | string;
2500
2472
  data: T;
@@ -3370,41 +3342,9 @@ declare module '@posx/core/types/payment.type' {
3370
3342
  */
3371
3343
  export enum PaymentStatus {
3372
3344
  STARTED = "payment_started",
3373
- PROCESSING = "payment_processing",
3374
3345
  COMPLETED = "payment_completed",
3375
3346
  FAILED = "payment_failed"
3376
3347
  }
3377
- /**
3378
- * Payment sync data interface
3379
- */
3380
- export interface IPaymentSyncData {
3381
- /** Payment unique identifier */
3382
- payment_uid: string;
3383
- /** Associated invoice ID */
3384
- invoice_uid: string;
3385
- /** Table ID */
3386
- table_uid?: string;
3387
- /** Payment status */
3388
- status: PaymentStatus;
3389
- /** Payment method */
3390
- payment_method: IPaymentMethod;
3391
- /** Payment amount */
3392
- amount: number;
3393
- /** Actual tender amount */
3394
- tender_amount?: number;
3395
- /** Change amount */
3396
- change_amount?: number;
3397
- /** Payment result */
3398
- result?: 'success' | 'failed';
3399
- /** Error message */
3400
- error_message?: string;
3401
- /** Timestamp */
3402
- timestamp: Date;
3403
- /** Employee UID */
3404
- employee_uid?: string;
3405
- /** Terminal ID */
3406
- terminal_id?: string;
3407
- }
3408
3348
 
3409
3349
  }
3410
3350
  declare module '@posx/core/types/printer.type' {