@shopfront/bridge 2.0.0 → 2.0.2

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.
Files changed (244) hide show
  1. package/.idea/codeStyles/Project.xml +10 -0
  2. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  3. package/.idea/git_toolbox_blame.xml +6 -0
  4. package/.idea/git_toolbox_prj.xml +15 -0
  5. package/.idea/inspectionProfiles/Project_Default.xml +5 -0
  6. package/.idea/jsLinters/eslint.xml +6 -0
  7. package/.idea/modules.xml +1 -1
  8. package/.idea/php.xml +15 -0
  9. package/lib/APIs/Database/BaseDatabase.d.ts +28 -0
  10. package/lib/APIs/Database/BaseDatabase.js +5 -0
  11. package/lib/APIs/Database/Database.d.ts +19 -7
  12. package/lib/APIs/Database/Database.js +22 -12
  13. package/lib/APIs/Database/types/BaseBarcodeTemplateRepository.d.ts +8 -0
  14. package/lib/APIs/Database/types/BaseBarcodeTemplateRepository.js +1 -0
  15. package/lib/APIs/Database/types/BaseClassificationRepository.d.ts +11 -0
  16. package/lib/APIs/Database/types/BaseClassificationRepository.js +1 -0
  17. package/lib/APIs/Database/types/BaseCustomerDisplayRepository.d.ts +10 -0
  18. package/lib/APIs/Database/types/BaseCustomerDisplayRepository.js +1 -0
  19. package/lib/APIs/Database/types/BaseCustomerGroupRepository.d.ts +24 -0
  20. package/lib/APIs/Database/types/BaseCustomerGroupRepository.js +1 -0
  21. package/lib/APIs/Database/types/BaseCustomerRepository.d.ts +76 -0
  22. package/lib/APIs/Database/types/BaseCustomerRepository.js +1 -0
  23. package/lib/APIs/Database/types/BaseEnterpriseRepository.d.ts +8 -0
  24. package/lib/APIs/Database/types/BaseEnterpriseRepository.js +1 -0
  25. package/lib/APIs/Database/types/BaseGiftCardRepository.d.ts +18 -0
  26. package/lib/APIs/Database/types/BaseGiftCardRepository.js +1 -0
  27. package/lib/APIs/Database/types/BaseKitchenOrderRepository.d.ts +41 -0
  28. package/lib/APIs/Database/types/BaseKitchenOrderRepository.js +1 -0
  29. package/lib/APIs/Database/types/BaseKitchenScreenRepository.d.ts +16 -0
  30. package/lib/APIs/Database/types/BaseKitchenScreenRepository.js +1 -0
  31. package/lib/APIs/Database/types/BaseLockedResourceRepository.d.ts +12 -0
  32. package/lib/APIs/Database/types/BaseLockedResourceRepository.js +1 -0
  33. package/lib/APIs/Database/types/BaseLoyaltyRepository.d.ts +16 -0
  34. package/lib/APIs/Database/types/BaseLoyaltyRepository.js +1 -0
  35. package/lib/APIs/Database/types/BaseMovementRepository.d.ts +16 -0
  36. package/lib/APIs/Database/types/BaseMovementRepository.js +1 -0
  37. package/lib/APIs/Database/types/BaseOutletRepository.d.ts +19 -0
  38. package/lib/APIs/Database/types/BaseOutletRepository.js +1 -0
  39. package/lib/APIs/Database/types/BasePaymentMethodRepository.d.ts +27 -0
  40. package/lib/APIs/Database/types/BasePaymentMethodRepository.js +1 -0
  41. package/lib/APIs/Database/types/BasePriceListRepository.d.ts +40 -0
  42. package/lib/APIs/Database/types/BasePriceListRepository.js +1 -0
  43. package/lib/APIs/Database/types/BasePriceSetRepository.d.ts +6 -0
  44. package/lib/APIs/Database/types/BasePriceSetRepository.js +1 -0
  45. package/lib/APIs/Database/types/BaseProductRepository.d.ts +160 -0
  46. package/lib/APIs/Database/types/BaseProductRepository.js +1 -0
  47. package/lib/APIs/Database/types/BasePromotionCategoryRepository.d.ts +10 -0
  48. package/lib/APIs/Database/types/BasePromotionCategoryRepository.js +1 -0
  49. package/lib/APIs/Database/types/BasePromotionRepository.d.ts +72 -0
  50. package/lib/APIs/Database/types/BasePromotionRepository.js +1 -0
  51. package/lib/APIs/Database/types/BaseReceiptRepository.d.ts +31 -0
  52. package/lib/APIs/Database/types/BaseReceiptRepository.js +1 -0
  53. package/lib/APIs/Database/types/BaseRegisterRepository.d.ts +56 -0
  54. package/lib/APIs/Database/types/BaseRegisterRepository.js +1 -0
  55. package/lib/APIs/Database/types/BaseRepository.d.ts +41 -0
  56. package/lib/APIs/Database/types/BaseRepository.js +1 -0
  57. package/lib/APIs/Database/types/BaseSalesKeyRepository.d.ts +37 -0
  58. package/lib/APIs/Database/types/BaseSalesKeyRepository.js +1 -0
  59. package/lib/APIs/Database/types/BaseSalesRepository.d.ts +123 -0
  60. package/lib/APIs/Database/types/BaseSalesRepository.js +1 -0
  61. package/lib/APIs/Database/types/BaseSearchableRepository.d.ts +8 -0
  62. package/lib/APIs/Database/types/BaseSearchableRepository.js +1 -0
  63. package/lib/APIs/Database/types/BaseStocktakeAccumulatedRepository.d.ts +16 -0
  64. package/lib/APIs/Database/types/BaseStocktakeAccumulatedRepository.js +1 -0
  65. package/lib/APIs/Database/types/BaseStocktakeRepository.d.ts +8 -0
  66. package/lib/APIs/Database/types/BaseStocktakeRepository.js +1 -0
  67. package/lib/APIs/Database/types/BaseStocktakeScannedRepository.d.ts +24 -0
  68. package/lib/APIs/Database/types/BaseStocktakeScannedRepository.js +1 -0
  69. package/lib/APIs/Database/types/BaseSupplierRepository.d.ts +35 -0
  70. package/lib/APIs/Database/types/BaseSupplierRepository.js +1 -0
  71. package/lib/APIs/Database/types/BaseTakingsRepository.d.ts +13 -0
  72. package/lib/APIs/Database/types/BaseTakingsRepository.js +1 -0
  73. package/lib/APIs/Database/types/BaseTaxRateRepository.d.ts +9 -0
  74. package/lib/APIs/Database/types/BaseTaxRateRepository.js +1 -0
  75. package/lib/APIs/Database/types/BaseTransfereeRepository.d.ts +12 -0
  76. package/lib/APIs/Database/types/BaseTransfereeRepository.js +1 -0
  77. package/lib/APIs/Database/types/BaseVendorConnectionRepository.d.ts +7 -0
  78. package/lib/APIs/Database/types/BaseVendorConnectionRepository.js +1 -0
  79. package/lib/APIs/Database/types/DataSourceTables.d.ts +61 -0
  80. package/lib/APIs/Database/types/DataSourceTables.js +1 -0
  81. package/lib/APIs/Fulfilment/FulfilmentTypes.d.ts +2 -2
  82. package/lib/APIs/Fulfilment/FulfilmentTypes.js +1 -2
  83. package/lib/APIs/InternalMessages/InternalMessageSource.d.ts +6 -3
  84. package/lib/APIs/InternalMessages/InternalMessageSource.js +6 -7
  85. package/lib/APIs/Sale/BaseCurrentSale.d.ts +83 -0
  86. package/lib/APIs/Sale/BaseCurrentSale.js +13 -0
  87. package/lib/APIs/Sale/BaseSale.d.ts +3 -38
  88. package/lib/APIs/Sale/BaseSale.js +1 -40
  89. package/lib/APIs/Sale/CurrentSale.d.ts +19 -84
  90. package/lib/APIs/Sale/CurrentSale.js +32 -102
  91. package/lib/APIs/Sale/Exceptions.d.ts +3 -0
  92. package/lib/APIs/Sale/Exceptions.js +7 -7
  93. package/lib/APIs/Sale/Sale.d.ts +39 -7
  94. package/lib/APIs/Sale/Sale.js +41 -13
  95. package/lib/APIs/Sale/SaleCustomer.d.ts +0 -2
  96. package/lib/APIs/Sale/SaleCustomer.js +1 -7
  97. package/lib/APIs/Sale/SalePayment.d.ts +3 -22
  98. package/lib/APIs/Sale/SalePayment.js +7 -33
  99. package/lib/APIs/Sale/SaleProduct.d.ts +6 -46
  100. package/lib/APIs/Sale/SaleProduct.js +6 -53
  101. package/lib/APIs/Sale/ShopfrontSaleState.d.ts +7 -9
  102. package/lib/APIs/Sale/ShopfrontSaleState.js +1 -2
  103. package/lib/APIs/Sale/index.d.ts +9 -9
  104. package/lib/APIs/Sale/index.js +7 -39
  105. package/lib/Actions/BaseAction.d.ts +21 -5
  106. package/lib/Actions/BaseAction.js +155 -97
  107. package/lib/Actions/Button.d.ts +2 -2
  108. package/lib/Actions/Button.js +3 -7
  109. package/lib/Actions/CustomerListOption.d.ts +2 -2
  110. package/lib/Actions/CustomerListOption.js +2 -6
  111. package/lib/Actions/Dialog.d.ts +4 -4
  112. package/lib/Actions/Dialog.js +2 -6
  113. package/lib/Actions/Redirect.d.ts +2 -2
  114. package/lib/Actions/Redirect.js +7 -9
  115. package/lib/Actions/SaleKey.d.ts +2 -2
  116. package/lib/Actions/SaleKey.js +3 -7
  117. package/lib/Actions/SaleUpdate.d.ts +3 -3
  118. package/lib/Actions/SaleUpdate.js +3 -7
  119. package/lib/Actions/Toast.d.ts +3 -3
  120. package/lib/Actions/Toast.js +2 -6
  121. package/lib/Application.d.ts +114 -78
  122. package/lib/Application.js +207 -160
  123. package/lib/ApplicationEvents.d.ts +66 -53
  124. package/lib/ApplicationEvents.js +10 -6
  125. package/lib/BaseApplication.d.ts +169 -0
  126. package/lib/BaseApplication.js +40 -0
  127. package/lib/BaseBridge.d.ts +33 -0
  128. package/lib/BaseBridge.js +16 -0
  129. package/lib/Bridge.d.ts +46 -9
  130. package/lib/Bridge.js +42 -54
  131. package/lib/Common/EventEmitter.d.ts +10 -1
  132. package/lib/Common/EventEmitter.js +10 -5
  133. package/lib/Common/Serializable.d.ts +8 -6
  134. package/lib/Common/Serializable.js +1 -2
  135. package/lib/EmitableEvents/BaseEmitableEvent.d.ts +7 -1
  136. package/lib/EmitableEvents/BaseEmitableEvent.js +7 -5
  137. package/lib/EmitableEvents/Fulfilment/Options.d.ts +1 -1
  138. package/lib/EmitableEvents/Fulfilment/Options.js +4 -8
  139. package/lib/EmitableEvents/Fulfilment/OrderCancel.d.ts +1 -1
  140. package/lib/EmitableEvents/Fulfilment/OrderCancel.js +4 -8
  141. package/lib/EmitableEvents/Fulfilment/OrderCreate.d.ts +2 -2
  142. package/lib/EmitableEvents/Fulfilment/OrderCreate.js +4 -8
  143. package/lib/EmitableEvents/Fulfilment/OrderUpdate.d.ts +2 -2
  144. package/lib/EmitableEvents/Fulfilment/OrderUpdate.js +4 -8
  145. package/lib/EmitableEvents/Fulfilment/OrdersSync.d.ts +2 -2
  146. package/lib/EmitableEvents/Fulfilment/OrdersSync.js +4 -8
  147. package/lib/EmitableEvents/Fulfilment/RegisterIntent.d.ts +2 -2
  148. package/lib/EmitableEvents/Fulfilment/RegisterIntent.js +4 -8
  149. package/lib/EmitableEvents/Fulfilment/index.d.ts +7 -7
  150. package/lib/EmitableEvents/Fulfilment/index.js +6 -15
  151. package/lib/EmitableEvents/InternalMessage.d.ts +2 -2
  152. package/lib/EmitableEvents/InternalMessage.js +4 -8
  153. package/lib/EmitableEvents/SellScreenOption.d.ts +2 -2
  154. package/lib/EmitableEvents/SellScreenOption.js +7 -11
  155. package/lib/EmitableEvents/SellScreenPromotionApplicable.d.ts +1 -1
  156. package/lib/EmitableEvents/SellScreenPromotionApplicable.js +4 -8
  157. package/lib/EmitableEvents/TableUpdate.d.ts +2 -2
  158. package/lib/EmitableEvents/TableUpdate.js +4 -8
  159. package/lib/Events/AudioPermissionChange.d.ts +5 -2
  160. package/lib/Events/AudioPermissionChange.js +6 -7
  161. package/lib/Events/AudioReady.d.ts +5 -2
  162. package/lib/Events/AudioReady.js +6 -7
  163. package/lib/Events/BaseEvent.d.ts +8 -3
  164. package/lib/Events/BaseEvent.js +1 -6
  165. package/lib/Events/Callback.d.ts +5 -2
  166. package/lib/Events/Callback.js +5 -6
  167. package/lib/Events/FormatIntegratedProduct.d.ts +27 -32
  168. package/lib/Events/FormatIntegratedProduct.js +12 -9
  169. package/lib/Events/FulfilmentCollectOrder.d.ts +5 -2
  170. package/lib/Events/FulfilmentCollectOrder.js +5 -6
  171. package/lib/Events/FulfilmentCompleteOrder.d.ts +5 -2
  172. package/lib/Events/FulfilmentCompleteOrder.js +5 -6
  173. package/lib/Events/FulfilmentGetOrder.d.ts +12 -6
  174. package/lib/Events/FulfilmentGetOrder.js +10 -8
  175. package/lib/Events/FulfilmentOrderApproval.d.ts +5 -2
  176. package/lib/Events/FulfilmentOrderApproval.js +5 -6
  177. package/lib/Events/FulfilmentProcessOrder.d.ts +12 -10
  178. package/lib/Events/FulfilmentProcessOrder.js +7 -8
  179. package/lib/Events/FulfilmentVoidOrder.d.ts +5 -2
  180. package/lib/Events/FulfilmentVoidOrder.js +5 -6
  181. package/lib/Events/GiftCardCodeCheck.d.ts +19 -0
  182. package/lib/Events/GiftCardCodeCheck.js +23 -0
  183. package/lib/Events/InternalPageMessage.d.ts +10 -4
  184. package/lib/Events/InternalPageMessage.js +12 -10
  185. package/lib/Events/PaymentMethodsEnabled.d.ts +16 -11
  186. package/lib/Events/PaymentMethodsEnabled.js +10 -8
  187. package/lib/Events/Ready.d.ts +12 -7
  188. package/lib/Events/Ready.js +5 -6
  189. package/lib/Events/RegisterChanged.d.ts +12 -6
  190. package/lib/Events/RegisterChanged.js +6 -7
  191. package/lib/Events/RequestButtons.d.ts +17 -12
  192. package/lib/Events/RequestButtons.js +13 -11
  193. package/lib/Events/RequestCustomerListOptions.d.ts +11 -5
  194. package/lib/Events/RequestCustomerListOptions.js +12 -11
  195. package/lib/Events/RequestSaleKeys.d.ts +12 -6
  196. package/lib/Events/RequestSaleKeys.js +13 -11
  197. package/lib/Events/RequestSellScreenOptions.d.ts +18 -5
  198. package/lib/Events/RequestSellScreenOptions.js +17 -9
  199. package/lib/Events/RequestSettings.d.ts +11 -5
  200. package/lib/Events/RequestSettings.js +12 -10
  201. package/lib/Events/RequestTableColumns.d.ts +16 -11
  202. package/lib/Events/RequestTableColumns.js +12 -9
  203. package/lib/Events/SaleComplete.d.ts +15 -18
  204. package/lib/Events/SaleComplete.js +6 -7
  205. package/lib/Events/UIPipeline.d.ts +17 -5
  206. package/lib/Events/UIPipeline.js +17 -10
  207. package/lib/Mocks/APIs/Sale/MockCurrentSale.d.ts +99 -0
  208. package/lib/Mocks/APIs/Sale/MockCurrentSale.js +326 -0
  209. package/lib/Mocks/Database/MockDatabase.d.ts +96 -0
  210. package/lib/Mocks/Database/MockDatabase.js +89 -0
  211. package/lib/Mocks/MockApplication.d.ts +154 -0
  212. package/lib/Mocks/MockApplication.js +481 -0
  213. package/lib/Mocks/MockBridge.d.ts +31 -0
  214. package/lib/Mocks/MockBridge.js +77 -0
  215. package/lib/Mocks/index.d.ts +7 -0
  216. package/lib/Mocks/index.js +15 -0
  217. package/lib/Utilities/ActionEventRegistrar.d.ts +19 -4
  218. package/lib/Utilities/ActionEventRegistrar.js +19 -3
  219. package/lib/Utilities/MiscTypes.d.ts +6 -4
  220. package/lib/Utilities/MiscTypes.js +1 -2
  221. package/lib/Utilities/SaleCreate.d.ts +6 -2
  222. package/lib/Utilities/SaleCreate.js +10 -6
  223. package/lib/Utilities/Static.d.ts +3 -0
  224. package/lib/Utilities/Static.js +5 -7
  225. package/lib/Utilities/UUID.d.ts +9 -3
  226. package/lib/Utilities/UUID.js +10 -7
  227. package/lib/index.d.ts +16 -14
  228. package/lib/index.js +14 -49
  229. package/package.json +3 -2
  230. package/lib/APIs/CurrentSale/Exceptions.d.ts +0 -6
  231. package/lib/APIs/CurrentSale/Exceptions.js +0 -15
  232. package/lib/APIs/CurrentSale/Sale.d.ts +0 -182
  233. package/lib/APIs/CurrentSale/Sale.js +0 -290
  234. package/lib/APIs/CurrentSale/SaleCustomer.d.ts +0 -10
  235. package/lib/APIs/CurrentSale/SaleCustomer.js +0 -17
  236. package/lib/APIs/CurrentSale/SalePayment.d.ts +0 -68
  237. package/lib/APIs/CurrentSale/SalePayment.js +0 -99
  238. package/lib/APIs/CurrentSale/SaleProduct.d.ts +0 -121
  239. package/lib/APIs/CurrentSale/SaleProduct.js +0 -167
  240. package/lib/APIs/CurrentSale/ShopfrontSaleState.d.ts +0 -53
  241. package/lib/APIs/CurrentSale/ShopfrontSaleState.js +0 -2
  242. package/lib/APIs/CurrentSale/index.d.ts +0 -6
  243. package/lib/APIs/CurrentSale/index.js +0 -37
  244. /package/.idea/{embedded-bridge.iml → shopfront-embedded-bridge.iml} +0 -0
@@ -0,0 +1,160 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ import { BaseSearchableRepository } from "./BaseSearchableRepository.js";
3
+ export interface LocalDatabaseComponent {
4
+ add_price: number;
5
+ quantity: number;
6
+ remove_price: number;
7
+ uuid: string;
8
+ }
9
+ export interface LocalDatabaseCost {
10
+ outlet_id: string;
11
+ average_cost: number;
12
+ last_cost: number;
13
+ }
14
+ export interface LocalDatabaseInventory {
15
+ outlet_id: string;
16
+ single_level: number;
17
+ case_level: number;
18
+ single_reorder_level: number;
19
+ case_reorder_level: number;
20
+ single_reorder_amount: number;
21
+ case_reorder_amount: number;
22
+ single_reorder_limit: number | null;
23
+ case_reorder_limit: number | null;
24
+ single_max_quantity: number | null;
25
+ case_max_quantity: number | null;
26
+ reorder_rounding: "none" | "ceiling" | "floor" | "natural";
27
+ }
28
+ export interface LocalDatabaseLoyalty {
29
+ classification_id: string;
30
+ classification_type: string;
31
+ loyalty_value: number;
32
+ outlet_id: string;
33
+ quantity: number;
34
+ redeem_value: null | number;
35
+ }
36
+ export interface LocalDatabasePrice {
37
+ price: number;
38
+ price_set_id: null | string;
39
+ quantity: number;
40
+ loyalty_value?: null | string;
41
+ redemption_value?: null | string;
42
+ }
43
+ export type ProductTypeUnion = "normal" | "basket" | "voucher" | "package" | "component";
44
+ export type ProductStatusUnion = "active" | "inactive" | "not-selling" | "not-purchasing";
45
+ export interface LocalDatabaseProduct {
46
+ additional: Record<string, string>;
47
+ average_cost: number;
48
+ alternate_names: Array<{
49
+ host: string;
50
+ quantity: number | null;
51
+ name: string;
52
+ }>;
53
+ barcodes: Array<{
54
+ code: string;
55
+ host_deleted_at: string | null;
56
+ quantity: string;
57
+ template: string | null;
58
+ }>;
59
+ brand_id: null | string;
60
+ case_quantity: number;
61
+ category_id: null | string;
62
+ code_index: Array<string>;
63
+ components: Array<LocalDatabaseComponent>;
64
+ core_supplier_id: null | string;
65
+ cost: string;
66
+ cost_percentage: boolean;
67
+ costs: Array<LocalDatabaseCost>;
68
+ cost_tax_rate: null | {
69
+ amount: number;
70
+ uuid: string;
71
+ };
72
+ description: string;
73
+ family_id: null | string;
74
+ image: null | string;
75
+ inventory: Array<LocalDatabaseInventory>;
76
+ last_cost: number;
77
+ last_supplier_id: null | string;
78
+ loyalty_rates: Array<LocalDatabaseLoyalty>;
79
+ mdb_id: null | number;
80
+ name: string;
81
+ name_index: Array<string>;
82
+ order_notes: string;
83
+ invoice_notes: string;
84
+ parents: Array<string>;
85
+ prices: Array<LocalDatabasePrice>;
86
+ request_price: boolean;
87
+ request_quantity: boolean;
88
+ status: ProductStatusUnion;
89
+ prevent_manual_discounts: boolean;
90
+ ignore_price_host_changes: boolean;
91
+ ignore_barcode_host_changes: boolean;
92
+ suppliers: Array<{
93
+ supplier_code: string;
94
+ uuid: string;
95
+ minimum_order_quantity: number;
96
+ }>;
97
+ supplier_ids: Array<string>;
98
+ supplier_codes: Array<string>;
99
+ tags: Array<string>;
100
+ tax_rate: null | {
101
+ amount: string;
102
+ uuid: string;
103
+ };
104
+ track_inventory: boolean;
105
+ type: ProductTypeUnion;
106
+ use_barcode_templates: boolean;
107
+ use_scales: boolean;
108
+ uuid: string;
109
+ }
110
+ export interface ProductRepositorySearchOptions {
111
+ name: boolean;
112
+ barcode: boolean | string;
113
+ quantityCheck: boolean;
114
+ quantityCount: number;
115
+ sort: boolean;
116
+ filter: (product: LocalDatabaseProduct) => boolean;
117
+ exact: boolean;
118
+ limit: number;
119
+ }
120
+ export interface ProductSearchDataType {
121
+ quantity?: number;
122
+ kind?: "product";
123
+ searchBarcode?: string;
124
+ }
125
+ export type ProductSearchResultType = LocalDatabaseProduct & ProductSearchDataType;
126
+ export type ProductClassificationUnion = "category" | "brand" | "family" | "tag" | "supplier" | "supplier_code";
127
+ export interface BaseProductRepository extends BaseRepository<LocalDatabaseProduct>, BaseSearchableRepository<ProductSearchResultType, ProductRepositorySearchOptions> {
128
+ /**
129
+ * Retrieve all products with the specified classification type and classification ID
130
+ */
131
+ getFromClassification(classificationType: ProductClassificationUnion, uuid: string): Promise<Array<LocalDatabaseProduct>>;
132
+ /**
133
+ * Retrieve all products with the specified status
134
+ */
135
+ getByStatus(status: ProductStatusUnion | Array<ProductStatusUnion>): Promise<Array<LocalDatabaseProduct>>;
136
+ /**
137
+ * Retrieve all products with the specified type
138
+ */
139
+ getByType(type: ProductTypeUnion | Array<ProductTypeUnion>): Promise<Array<LocalDatabaseProduct>>;
140
+ /**
141
+ * Retrieve all products with the specified IDs
142
+ */
143
+ getBulk(ids: Array<string>): Promise<Array<LocalDatabaseProduct>>;
144
+ /**
145
+ * Retrieve all products with the specified MDB ID
146
+ */
147
+ getByMDBId(mdbId: number): Promise<Array<LocalDatabaseProduct>>;
148
+ /**
149
+ * Retrieve all products with the specified supplier codes
150
+ */
151
+ getBySupplierCodes(supplierCodes: Array<string>): Promise<Array<LocalDatabaseProduct>>;
152
+ /**
153
+ * Update a product's data
154
+ */
155
+ update(id: string, changes: Partial<LocalDatabaseProduct>): Promise<void>;
156
+ /**
157
+ * Clear the local product data cache
158
+ */
159
+ clearCache(): void;
160
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ import { BaseSearchableRepository } from "./BaseSearchableRepository.js";
3
+ export interface LocalDatabasePromotionCategory {
4
+ source: null | string;
5
+ name: string;
6
+ uuid: string;
7
+ show_on_order: boolean;
8
+ include_in_integrations: boolean;
9
+ }
10
+ export type BasePromotionCategoryRepository = BaseRepository<LocalDatabasePromotionCategory> & BaseSearchableRepository<LocalDatabasePromotionCategory>;
@@ -0,0 +1,72 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ import { BaseSearchableRepository } from "./BaseSearchableRepository.js";
3
+ export type LocalDatabaseCriteriaTypeUnion = "sell-item" | "sell-total" | "discount-item-amount" | "discount-total-amount" | "discount-percentage" | "sell-rate" | "quantity-only";
4
+ interface LocalDatabaseCriteriaItem {
5
+ uuid: string;
6
+ rebate: string | number;
7
+ }
8
+ export interface LocalDatabasePromotionCriteria {
9
+ products: Array<LocalDatabaseCriteriaItem>;
10
+ brands: Array<LocalDatabaseCriteriaItem>;
11
+ categories: Array<LocalDatabaseCriteriaItem>;
12
+ families: Array<LocalDatabaseCriteriaItem>;
13
+ tags: Array<LocalDatabaseCriteriaItem>;
14
+ buy_amount: number;
15
+ buy_amount_max: number | null;
16
+ buy_amount_type: "quantity" | "amount";
17
+ discount_amount: number;
18
+ discount_everyday_promotions: boolean;
19
+ exclude_count_quantity: boolean;
20
+ exclude_price_points: boolean;
21
+ min_quantity: number | null;
22
+ mixed_only: boolean;
23
+ optional: boolean;
24
+ quantity_type: "exact" | "more";
25
+ type: LocalDatabaseCriteriaTypeUnion;
26
+ excludes: {
27
+ products: Array<string>;
28
+ categories: Array<string>;
29
+ brands: Array<string>;
30
+ families: Array<string>;
31
+ tags: Array<string>;
32
+ };
33
+ }
34
+ export interface LocalDatabasePromotion {
35
+ active: boolean;
36
+ available_to: null | Array<string>;
37
+ criteria: Array<LocalDatabasePromotionCriteria>;
38
+ end: string | null;
39
+ express: boolean;
40
+ mdb_id: number | null;
41
+ mix_criteria: boolean;
42
+ name: string;
43
+ outlets: Array<string>;
44
+ promotion_category_id: string | null;
45
+ start: string | null;
46
+ uuid: string;
47
+ has_schedule: boolean;
48
+ activated_by?: null | string;
49
+ }
50
+ export interface BasePromotionRepository extends BaseRepository<LocalDatabasePromotion>, BaseSearchableRepository<LocalDatabasePromotion> {
51
+ /**
52
+ * Update a promotion's data
53
+ */
54
+ update(id: string, update: Partial<LocalDatabasePromotion>): Promise<void>;
55
+ /**
56
+ * Retrieve all promotions that contain the specified product
57
+ */
58
+ getPromotionsForProduct(product: string): Promise<Array<string>>;
59
+ /**
60
+ * Retrieve all promotions with the specified category ID
61
+ */
62
+ getByCategory(id: string): Promise<Array<LocalDatabasePromotion>>;
63
+ /**
64
+ * Retrieve all promotions that pass the specified filter
65
+ */
66
+ filter(filter: (promotion: LocalDatabasePromotion) => boolean): Promise<Array<LocalDatabasePromotion>>;
67
+ /**
68
+ * Retrieve all promotions with the specified IDs
69
+ */
70
+ getBulk(ids: Array<string>): Promise<Array<LocalDatabasePromotion>>;
71
+ }
72
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ export type ReceiptTypeUnion = "receipt-text" | "receipt-full" | "a4" | "email";
3
+ export interface ReceiptPaddingType {
4
+ top: number | null;
5
+ left: number | null;
6
+ right: number | null;
7
+ bottom: number | null;
8
+ }
9
+ export interface LocalDatabaseReceipt {
10
+ accountReceipt: boolean;
11
+ components: string;
12
+ name: string;
13
+ receiptWidth: number;
14
+ type: ReceiptTypeUnion;
15
+ uuid: string;
16
+ padding: null | ReceiptPaddingType;
17
+ attachments: null | Array<{
18
+ receipt: string;
19
+ name: string;
20
+ }>;
21
+ }
22
+ export interface BaseReceiptRepository extends BaseRepository<LocalDatabaseReceipt> {
23
+ /**
24
+ * Retrieve all receipts that pass the specified filter
25
+ */
26
+ filter(filter: (item: LocalDatabaseReceipt) => boolean): Promise<Array<LocalDatabaseReceipt>>;
27
+ /**
28
+ * Retrieve all receipts with the specified type
29
+ */
30
+ getByType(type: ReceiptTypeUnion): Promise<Array<LocalDatabaseReceipt>>;
31
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,56 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ export type ShouldPrintOptions = "table" | "total" | "none";
3
+ export interface LocalDatabaseRegister {
4
+ closure_print_settings: {
5
+ account: ShouldPrintOptions;
6
+ account_payments: ShouldPrintOptions;
7
+ discounts: ShouldPrintOptions;
8
+ gift_cards_redeemed: ShouldPrintOptions;
9
+ gift_cards_sold: ShouldPrintOptions;
10
+ movements: ShouldPrintOptions;
11
+ payments: ShouldPrintOptions;
12
+ refunds: ShouldPrintOptions;
13
+ tax: ShouldPrintOptions;
14
+ loyalty: ShouldPrintOptions;
15
+ notes: boolean;
16
+ tags: boolean;
17
+ payment_subtypes: boolean;
18
+ statistics: boolean;
19
+ };
20
+ close_register_tags: Array<string>;
21
+ float: {
22
+ monday: number;
23
+ tuesday: number;
24
+ wednesday: number;
25
+ thursday: number;
26
+ friday: number;
27
+ saturday: number;
28
+ sunday: number;
29
+ };
30
+ surcharges?: Array<{
31
+ id: number;
32
+ type: "PERCENTAGE" | "FIXED";
33
+ amount: number;
34
+ taxRate: string | null;
35
+ day: string;
36
+ start: string;
37
+ end: string;
38
+ name: string;
39
+ appliesTo: Array<{
40
+ id: string;
41
+ type: "Category" | "Tag";
42
+ }> | null;
43
+ }>;
44
+ surcharging_enabled: boolean;
45
+ name: string;
46
+ outlet_id: string;
47
+ payment_methods: Array<string>;
48
+ settings: Record<string, unknown>;
49
+ uuid: string;
50
+ }
51
+ export interface BaseRegisterRepository extends BaseRepository<LocalDatabaseRegister> {
52
+ /**
53
+ * Update a register's data
54
+ */
55
+ update(id: string, changes: Partial<LocalDatabaseRegister>): Promise<void>;
56
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ export default interface BaseRepository<DataType extends object = object, IdType = string> {
2
+ /**
3
+ * Retrieve all items in the repository
4
+ * @param orderBy
5
+ */
6
+ all(orderBy?: string): Promise<Array<DataType>>;
7
+ /**
8
+ * Retrieve an item by its UUID
9
+ * @param uuid
10
+ */
11
+ get(uuid: IdType): Promise<DataType>;
12
+ /**
13
+ * Add an item to the repository
14
+ * @param item
15
+ */
16
+ put(item: Array<DataType> | DataType): Promise<IdType>;
17
+ /**
18
+ * Update an item in the repository
19
+ * @param uuid
20
+ * @param changes
21
+ */
22
+ update(uuid: IdType, changes: Partial<DataType>): Promise<void>;
23
+ /**
24
+ * Return the number of items in the repository
25
+ */
26
+ count(): Promise<number>;
27
+ /**
28
+ * Delete all items from the repository
29
+ */
30
+ empty(): Promise<void>;
31
+ /**
32
+ * Delete multiple items from the repository
33
+ * @param items
34
+ */
35
+ delete(items: IdType | Array<IdType>): Promise<void>;
36
+ /**
37
+ * Invoke a callback for each item in the repository
38
+ * @param callback
39
+ */
40
+ each(callback: (item: DataType) => void): Promise<void>;
41
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,37 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ export type SaleKeyActionType = "add-single" | "add-case" | "add-giftcard" | "product-details" | "case" | "open-drawer" | "add-note" | "create-customer" | "return-item" | "flip-sale" | "pay-exact" | "pay-amount" | "view-promotions" | "sale-search" | "cancel-sale" | "add-product" | "subtract-product" | "add-product-barcode" | "subtract-product-barcode" | "open-folder" | "previous-folder" | "display-classification" | "keyboard" | "reweigh" | "customer-list" | "live-profit" | "current-time" | "previous-date" | "add-component" | "remove-component" | "display-classification-case" | "change-price-set" | "add-customer" | "make-customer-payment" | "apply-discount" | "add-component-to-current" | "remove-component-from-current" | "add-order-reference" | "search-additional" | "show-backorders" | "pay-loyalty";
3
+ export type SaleKeyActionUnion = SaleKeyActionType | "noop" | string;
4
+ export interface SaleKeyType {
5
+ action: SaleKeyActionUnion;
6
+ actionargs: Record<string, unknown>;
7
+ background: string;
8
+ backgroundhover: string;
9
+ bordercolour: string;
10
+ constrainheight: boolean;
11
+ constrainwidth: boolean;
12
+ disabled: boolean;
13
+ fill: boolean;
14
+ hover: boolean;
15
+ hoveranimation: boolean;
16
+ image: string | null;
17
+ imagehover: string | null;
18
+ preventdisable: boolean;
19
+ text: string;
20
+ textcolour: string;
21
+ texthover: string;
22
+ texthovercolour: string;
23
+ top: number;
24
+ left: number;
25
+ width: number;
26
+ height: number;
27
+ fontSize?: number;
28
+ bold?: boolean;
29
+ italic?: boolean;
30
+ underline?: boolean;
31
+ }
32
+ export interface LocalDatabaseSaleKeys {
33
+ keys: Array<SaleKeyType>;
34
+ name: string;
35
+ uuid: string;
36
+ }
37
+ export type BaseSalesKeyRepository = BaseRepository<LocalDatabaseSaleKeys>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,123 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ type SaleActionType = "PRODUCT_SCAN" | "PRODUCT_SEARCH_ADD" | "PRODUCT_KEY_ADD" | "QUANTITY_OVERRIDE" | "INCREMENT" | "DECREMENT" | "REMOVE_PRODUCT" | "CUSTOMER_SCAN" | "CUSTOMER_SEARCH_ADD" | "CUSTOMER_KEY_ADD" | "REMOVE_CUSTOMER" | "ADD_PAYMENT" | "REMOVE_PAYMENT";
3
+ interface SaleAction {
4
+ timestamp: string;
5
+ action: SaleActionType;
6
+ value: string;
7
+ affecting: string;
8
+ user: string;
9
+ }
10
+ export type LocalDatabaseSalePaymentStatus = "cancelled" | "completed" | "failed";
11
+ type SaleStatus = "COMPLETED" | "CANCELLED" | "PARKED" | "INCOMPLETE" | "UNPARKED";
12
+ export interface LocalDatabaseSaleItemTypeProduct {
13
+ id: string;
14
+ type: "Product";
15
+ name: string;
16
+ }
17
+ export interface LocalDatabaseSaleItemTypeGiftCard {
18
+ type: "GiftCard";
19
+ id: string;
20
+ name: string;
21
+ code: string;
22
+ expiry: string;
23
+ source: string;
24
+ }
25
+ export interface LocalDatabaseSaleItemTypeSurcharge {
26
+ type: "Surcharge";
27
+ }
28
+ export type LocalDatabaseSaleItemType = LocalDatabaseSaleItemTypeProduct | LocalDatabaseSaleItemTypeGiftCard | LocalDatabaseSaleItemTypeSurcharge;
29
+ export interface LocalDatabaseSaleItemPromotion {
30
+ promotion: string;
31
+ rebateAmount: number;
32
+ rebateQuantity: number;
33
+ savings: number;
34
+ quantity: number;
35
+ }
36
+ export interface LocalDatabaseSaleItem {
37
+ basePrice: number;
38
+ caseQuantity: number;
39
+ cost?: number;
40
+ discount: {
41
+ amount: string;
42
+ reason: string;
43
+ };
44
+ item: LocalDatabaseSaleItemType;
45
+ loyaltyValue: number;
46
+ note: string;
47
+ products: Array<LocalDatabaseSaleItem>;
48
+ promotions: Array<LocalDatabaseSaleItemPromotion>;
49
+ quantity: number;
50
+ savings: number;
51
+ tax: number;
52
+ taxRate: string | null;
53
+ totalPrice: number;
54
+ priceList: boolean;
55
+ metaData: Record<string, unknown>;
56
+ }
57
+ export interface LocalDatabaseSalePayment {
58
+ amount: number;
59
+ metaData?: unknown;
60
+ cashout: number;
61
+ rounding: number;
62
+ paymentMethodId: string;
63
+ registerId: string;
64
+ status: LocalDatabaseSalePaymentStatus;
65
+ processTime: string;
66
+ receipt: string | null;
67
+ subtype: null | string;
68
+ }
69
+ export interface LocalDatabaseSale {
70
+ cashout: number;
71
+ clientId?: string;
72
+ createdAt: string;
73
+ customerId: null | string;
74
+ discount: {
75
+ amount: string;
76
+ reason: string;
77
+ };
78
+ id: string;
79
+ invoiceId: string;
80
+ items: Array<LocalDatabaseSaleItem>;
81
+ linkedTo: null | string;
82
+ loyaltyValue: number;
83
+ notes: {
84
+ internal: string;
85
+ sale: string;
86
+ };
87
+ orderReference: string;
88
+ payments: Array<LocalDatabaseSalePayment>;
89
+ refundReason: null | string;
90
+ registerId: string;
91
+ status: SaleStatus;
92
+ totalBase: number;
93
+ totalChange: number;
94
+ totalCost: number;
95
+ totalPrice: number;
96
+ totalQuantity: number;
97
+ totalRounding: number;
98
+ totalTax: number;
99
+ updatedAt: string;
100
+ uploaded: boolean;
101
+ userId: string;
102
+ actions: Array<SaleAction>;
103
+ metaData: Record<string, unknown>;
104
+ }
105
+ export interface BaseSalesRepository extends BaseRepository<LocalDatabaseSale> {
106
+ /**
107
+ * Retrieve all parked sales
108
+ */
109
+ parked(): Promise<Array<LocalDatabaseSale>>;
110
+ /**
111
+ * Retrieve all sales with the specified client ID
112
+ */
113
+ getByClientId(id: string): Promise<Array<LocalDatabaseSale>>;
114
+ /**
115
+ * Retrieve all sales with the specified invoice ID
116
+ */
117
+ search(invoiceId: string): Promise<Array<LocalDatabaseSale>>;
118
+ /**
119
+ * Retrieve all sales that pass the specified filter
120
+ */
121
+ filter(callback: (sale: LocalDatabaseSale) => boolean): Promise<Array<LocalDatabaseSale>>;
122
+ }
123
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export interface BaseSearchableRepository<DataType extends object, SearchOptions = undefined> {
2
+ /**
3
+ * Search the repository for all items with the specified needle
4
+ * @param needle
5
+ * @param options
6
+ */
7
+ search(needle: string, options?: Partial<SearchOptions>): Promise<Array<DataType>>;
8
+ }
@@ -0,0 +1,16 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ export interface LocalDatabaseStocktakeAccumulated {
3
+ accumulated: number;
4
+ stocktake_id: string;
5
+ uuid: string;
6
+ }
7
+ export interface BaseStocktakeAccumulatedRepository extends BaseRepository<LocalDatabaseStocktakeAccumulated> {
8
+ /**
9
+ * Retrieve all accumulated stocktakes by stocktake ID
10
+ */
11
+ stocktake(stocktake: string): Promise<Array<LocalDatabaseStocktakeAccumulated>>;
12
+ /**
13
+ * Update an accumulated stocktake's data
14
+ */
15
+ update(uuid: string, changes: Partial<LocalDatabaseStocktakeAccumulated>): Promise<void>;
16
+ }
@@ -0,0 +1,8 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ export interface LocalDatabaseStocktake {
3
+ display_expected: boolean;
4
+ name: string;
5
+ outlet_id: string;
6
+ uuid: string;
7
+ }
8
+ export type BaseStocktakeRepository = BaseRepository<LocalDatabaseStocktake>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ export interface LocalDatabaseStocktakeScanned {
3
+ id?: number;
4
+ accumulated: number;
5
+ linked_to: null | number;
6
+ product_id: string;
7
+ quantity: number;
8
+ removed: boolean;
9
+ stocktake_id: string;
10
+ timestamp: string;
11
+ user_id: null | string;
12
+ barcode: string | undefined;
13
+ client_id: string;
14
+ }
15
+ export interface BaseStocktakeScannedRepository extends BaseRepository<LocalDatabaseStocktakeScanned, number> {
16
+ /**
17
+ * Retrieve all scanned stocktakes by stocktake ID
18
+ */
19
+ stocktake(stocktake: string): Promise<Array<LocalDatabaseStocktakeScanned>>;
20
+ /**
21
+ * Update a scanned stocktake's data
22
+ */
23
+ update(id: number, changes: Partial<LocalDatabaseStocktakeScanned>): Promise<void>;
24
+ }
@@ -0,0 +1,35 @@
1
+ import { LocalDatabaseContact } from "./BaseCustomerRepository.js";
2
+ import BaseRepository from "./BaseRepository.js";
3
+ import { BaseSearchableRepository } from "./BaseSearchableRepository.js";
4
+ export interface LocalDatabaseSupplier {
5
+ account_number: string;
6
+ business_number: string;
7
+ comments: string;
8
+ contact: LocalDatabaseContact;
9
+ default_order_tax: "inc_tax" | "ex_tax" | "ex_wet";
10
+ distribute_fees: "proportionally" | "evenly";
11
+ distribute_freight: "items" | "cases" | "mixed";
12
+ email_format: "inline" | "csv" | "pdf";
13
+ fee_amount: number;
14
+ mdb_id: null | number;
15
+ name: string;
16
+ status: "ACTIVE" | "INACTIVE";
17
+ order_automatic_email: boolean;
18
+ order_notes: string;
19
+ order_internal_notes: string;
20
+ uuid: string;
21
+ freight_included_on_invoices: boolean;
22
+ freight_tax_id: string | null;
23
+ fees_tax_id: string | null;
24
+ minimum_order_value: null | number;
25
+ maximum_order_value: null | number;
26
+ allow_order_below_minimum: boolean;
27
+ default_days_until_due: number | null;
28
+ freight_fixed_cost_per_case: number | null;
29
+ additional_contacts: Array<LocalDatabaseAdditionalContact>;
30
+ }
31
+ export interface LocalDatabaseAdditionalContact {
32
+ name: string;
33
+ contact: LocalDatabaseContact;
34
+ }
35
+ export type BaseSupplierRepository = BaseRepository<LocalDatabaseSupplier> & BaseSearchableRepository<LocalDatabaseSupplier>;
@@ -0,0 +1 @@
1
+ export {};