@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,13 @@
1
+ import { PaymentMethodTypeUnion } from "./BasePaymentMethodRepository.js";
2
+ import BaseRepository from "./BaseRepository.js";
3
+ export interface LocalDatabaseTakings {
4
+ amount: number;
5
+ type: PaymentMethodTypeUnion;
6
+ uuid: string;
7
+ }
8
+ export interface BaseTakingsRepository extends BaseRepository<LocalDatabaseTakings> {
9
+ /**
10
+ * Retrieve all takings with the specified type
11
+ */
12
+ getByType(type: PaymentMethodTypeUnion): Promise<Array<LocalDatabaseTakings>>;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ import { BaseSearchableRepository } from "./BaseSearchableRepository.js";
3
+ export interface LocalDatabaseTaxRate {
4
+ amount: number;
5
+ mdb_id: null | number;
6
+ name: string;
7
+ uuid: string;
8
+ }
9
+ export type BaseTaxRateRepository = BaseRepository<LocalDatabaseTaxRate> & BaseSearchableRepository<LocalDatabaseTaxRate>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { LocalDatabaseContact } from "./BaseCustomerRepository.js";
2
+ import BaseRepository from "./BaseRepository.js";
3
+ import { BaseSearchableRepository } from "./BaseSearchableRepository.js";
4
+ export type LocalEmailFormatUnion = "inline" | "csv" | "pdf";
5
+ export interface LocalDatabaseTransferee {
6
+ name: string;
7
+ uuid: string;
8
+ contact: LocalDatabaseContact;
9
+ email_format: LocalEmailFormatUnion;
10
+ order_automatic_email: boolean;
11
+ }
12
+ export type BaseTransfereeRepository = BaseRepository<LocalDatabaseTransferee> & BaseSearchableRepository<LocalDatabaseTransferee>;
@@ -0,0 +1,7 @@
1
+ import BaseRepository from "./BaseRepository.js";
2
+ import { BaseSearchableRepository } from "./BaseSearchableRepository.js";
3
+ export interface LocalDatabaseVendorConnection {
4
+ uuid: string;
5
+ name: string;
6
+ }
7
+ export type BaseVendorConnectionRepository = BaseRepository<LocalDatabaseVendorConnection> & BaseSearchableRepository<LocalDatabaseVendorConnection>;
@@ -0,0 +1,61 @@
1
+ import { BaseBarcodeTemplateRepository } from "./BaseBarcodeTemplateRepository.js";
2
+ import { BaseClassificationRepository } from "./BaseClassificationRepository.js";
3
+ import { BaseCustomerDisplayRepository } from "./BaseCustomerDisplayRepository.js";
4
+ import { BaseCustomerGroupRepository } from "./BaseCustomerGroupRepository.js";
5
+ import { BaseCustomerRepository } from "./BaseCustomerRepository.js";
6
+ import { BaseEnterpriseRepository } from "./BaseEnterpriseRepository.js";
7
+ import { BaseGiftCardRepository } from "./BaseGiftCardRepository.js";
8
+ import { BaseLoyaltyRepository } from "./BaseLoyaltyRepository.js";
9
+ import { BaseMovementRepository } from "./BaseMovementRepository.js";
10
+ import { BaseOutletRepository } from "./BaseOutletRepository.js";
11
+ import { BasePaymentMethodRepository } from "./BasePaymentMethodRepository.js";
12
+ import { BasePriceListRepository } from "./BasePriceListRepository.js";
13
+ import { BasePriceSetRepository } from "./BasePriceSetRepository.js";
14
+ import { BaseProductRepository } from "./BaseProductRepository.js";
15
+ import { BasePromotionCategoryRepository } from "./BasePromotionCategoryRepository.js";
16
+ import { BasePromotionRepository } from "./BasePromotionRepository.js";
17
+ import { BaseReceiptRepository } from "./BaseReceiptRepository.js";
18
+ import { BaseRegisterRepository } from "./BaseRegisterRepository.js";
19
+ import { BaseSalesKeyRepository } from "./BaseSalesKeyRepository.js";
20
+ import { BaseSalesRepository } from "./BaseSalesRepository.js";
21
+ import { BaseStocktakeAccumulatedRepository } from "./BaseStocktakeAccumulatedRepository.js";
22
+ import { BaseStocktakeRepository } from "./BaseStocktakeRepository.js";
23
+ import { BaseStocktakeScannedRepository } from "./BaseStocktakeScannedRepository.js";
24
+ import { BaseSupplierRepository } from "./BaseSupplierRepository.js";
25
+ import { BaseTakingsRepository } from "./BaseTakingsRepository.js";
26
+ import { BaseTaxRateRepository } from "./BaseTaxRateRepository.js";
27
+ import { BaseTransfereeRepository } from "./BaseTransfereeRepository.js";
28
+ import { BaseVendorConnectionRepository } from "./BaseVendorConnectionRepository.js";
29
+ export interface DataSourceTables {
30
+ products: BaseProductRepository;
31
+ customers: BaseCustomerRepository;
32
+ customerGroups: BaseCustomerGroupRepository;
33
+ promotions: BasePromotionRepository;
34
+ promotionCategories: BasePromotionCategoryRepository;
35
+ priceLists: BasePriceListRepository;
36
+ paymentMethods: BasePaymentMethodRepository;
37
+ salesKeys: BaseSalesKeyRepository;
38
+ receipts: BaseReceiptRepository;
39
+ giftCards: BaseGiftCardRepository;
40
+ loyalty: BaseLoyaltyRepository;
41
+ customerDisplays: BaseCustomerDisplayRepository;
42
+ sales: BaseSalesRepository;
43
+ brands: BaseClassificationRepository;
44
+ categories: BaseClassificationRepository;
45
+ families: BaseClassificationRepository;
46
+ tags: BaseClassificationRepository;
47
+ outlets: BaseOutletRepository;
48
+ registers: BaseRegisterRepository;
49
+ taxRates: BaseTaxRateRepository;
50
+ takings: BaseTakingsRepository;
51
+ suppliers: BaseSupplierRepository;
52
+ priceSets: BasePriceSetRepository;
53
+ transferees: BaseTransfereeRepository;
54
+ movements: BaseMovementRepository;
55
+ stocktakes: BaseStocktakeRepository;
56
+ stocktakeScanned: BaseStocktakeScannedRepository;
57
+ stocktakeAccumulated: BaseStocktakeAccumulatedRepository;
58
+ barcodeTemplates: BaseBarcodeTemplateRepository;
59
+ vendorConnections: BaseVendorConnectionRepository;
60
+ enterprises: BaseEnterpriseRepository;
61
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- export declare type OrderStatus = "PENDING_APPROVAL" | "WAITING_FOR_PACKING" | "PACKED" | "COLLECTED" | "COMPLETED";
1
+ export type OrderStatus = "PENDING_APPROVAL" | "WAITING_FOR_PACKING" | "PACKED" | "COLLECTED" | "COMPLETED";
2
2
  export interface OrderSummaryDetails {
3
3
  id: string;
4
4
  customer: {
@@ -17,7 +17,7 @@ export interface OrderSummaryDetails {
17
17
  finalLabel?: string;
18
18
  createdAt: string;
19
19
  }
20
- export declare type OrderCreateDetails = Omit<OrderSummaryDetails, "status"> & Partial<Pick<OrderSummaryDetails, "status">>;
20
+ export type OrderCreateDetails = Omit<OrderSummaryDetails, "status"> & Partial<Pick<OrderSummaryDetails, "status">>;
21
21
  export interface OrderDetails extends OrderSummaryDetails {
22
22
  items: Array<OrderItem>;
23
23
  }
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,10 +1,13 @@
1
- import { Application } from "../../Application";
2
- import { FromShopfront } from "../../ApplicationEvents";
3
- export declare type InternalPageMessageMethod = keyof FromShopfront | "EXTERNAL_APPLICATION";
1
+ import { Application } from "../../Application.js";
2
+ import { FromShopfront } from "../../ApplicationEvents.js";
3
+ export type InternalPageMessageMethod = keyof FromShopfront | "EXTERNAL_APPLICATION";
4
4
  export declare class InternalMessageSource {
5
5
  protected application: Application;
6
6
  protected method: InternalPageMessageMethod;
7
7
  protected url: string;
8
8
  constructor(application: Application, method: InternalPageMessageMethod, url: string);
9
+ /**
10
+ * Sends an internal message to Shopfront
11
+ */
9
12
  send(message: unknown): void;
10
13
  }
@@ -1,15 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InternalMessageSource = void 0;
4
- const InternalMessage_1 = require("../../EmitableEvents/InternalMessage");
5
- class InternalMessageSource {
1
+ import { InternalMessage } from "../../EmitableEvents/InternalMessage.js";
2
+ export class InternalMessageSource {
6
3
  constructor(application, method, url) {
7
4
  this.application = application;
8
5
  this.method = method;
9
6
  this.url = url;
10
7
  }
8
+ /**
9
+ * Sends an internal message to Shopfront
10
+ */
11
11
  send(message) {
12
- this.application.send(new InternalMessage_1.InternalMessage(this.method, this.url, message));
12
+ this.application.send(new InternalMessage(this.method, this.url, message));
13
13
  }
14
14
  }
15
- exports.InternalMessageSource = InternalMessageSource;
@@ -0,0 +1,83 @@
1
+ import { BaseApplication } from "../../BaseApplication.js";
2
+ import { BaseSale } from "./BaseSale.js";
3
+ import { SaleCustomer } from "./SaleCustomer.js";
4
+ import { SalePayment } from "./SalePayment.js";
5
+ import { SaleProduct } from "./SaleProduct.js";
6
+ import { ShopfrontSaleState } from "./ShopfrontSaleState.js";
7
+ export declare abstract class BaseCurrentSale extends BaseSale {
8
+ protected application: BaseApplication;
9
+ protected cancelled: boolean;
10
+ /**
11
+ * Create a sale from a sale state.
12
+ * It's highly recommend to not construct a sale manually, instead use application.getCurrentSale().
13
+ */
14
+ constructor(application: BaseApplication, saleState: ShopfrontSaleState);
15
+ /**
16
+ * Update the sale to be the latest sale that exists on the sell screen.
17
+ */
18
+ abstract refreshSale(): Promise<void>;
19
+ /**
20
+ * Cancel the current sale in progress.
21
+ */
22
+ abstract cancelSale(): Promise<void>;
23
+ /**
24
+ * Add a product to the sale.
25
+ */
26
+ abstract addProduct(product: SaleProduct): Promise<void>;
27
+ /**
28
+ * Remove a product from the sale.
29
+ * It's highly recommended that you pass in a product that has been retrieved using sale.getProducts().
30
+ */
31
+ abstract removeProduct(product: SaleProduct): Promise<void>;
32
+ /**
33
+ * Add a payment to the sell screen.
34
+ *
35
+ * If you specify a payment with a status, it will bypass the payment gateway (i.e. it won't request that the
36
+ * user takes money from the customer).
37
+ *
38
+ * If you don't specify a cashout amount, it will automatically determine if the payment method normally requests
39
+ * cashout (from the payment method settings).
40
+ */
41
+ abstract addPayment(payment: SalePayment): Promise<void>;
42
+ /**
43
+ * Reverse a payment on the sell screen.
44
+ *
45
+ * This is used to issue a refund to the customer. The sale payment amount should be positive.
46
+ */
47
+ abstract reversePayment(payment: SalePayment): Promise<void>;
48
+ /**
49
+ * Add a customer to the sale.
50
+ * If there is already a customer on the sale this will override that customer.
51
+ */
52
+ abstract addCustomer(customer: SaleCustomer): Promise<void>;
53
+ /**
54
+ * Remove the customer from the current sale.
55
+ * If there is no customer currently on the sale this will be ignored.
56
+ * If there are "on account" or loyalty payments still on the sale, this will be ignored.
57
+ */
58
+ abstract removeCustomer(): Promise<void>;
59
+ /**
60
+ * Set the external note for the sale.
61
+ * @param note The note to set.
62
+ * @param append Whether to append the note to the current sale note.
63
+ */
64
+ abstract setExternalNote(note: string, append?: boolean): Promise<void>;
65
+ /**
66
+ * Set the internal note for the sale.
67
+ * @param note The note to set.
68
+ * @param append Whether to append the note to the current sale note.
69
+ */
70
+ abstract setInternalNote(note: string, append?: boolean): Promise<void>;
71
+ /**
72
+ * Set the order reference to the provided string.
73
+ */
74
+ abstract setOrderReference(reference: string): Promise<void>;
75
+ /**
76
+ * Set the meta-data of the sale, this will override the previous meta data.
77
+ */
78
+ abstract setMetaData(metaData: Record<string, unknown>): Promise<void>;
79
+ /**
80
+ * Update a product's details; currently this can update quantity, price and metadata
81
+ */
82
+ abstract updateProduct(product: SaleProduct): Promise<void>;
83
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseSale } from "./BaseSale.js";
2
+ import { Sale } from "./Sale.js";
3
+ export class BaseCurrentSale extends BaseSale {
4
+ /**
5
+ * Create a sale from a sale state.
6
+ * It's highly recommend to not construct a sale manually, instead use application.getCurrentSale().
7
+ */
8
+ constructor(application, saleState) {
9
+ super(Sale.buildSaleData(saleState));
10
+ this.application = application;
11
+ this.cancelled = false;
12
+ }
13
+ }
@@ -1,6 +1,6 @@
1
- import { SaleCustomer } from "./SaleCustomer";
2
- import { SalePayment } from "./SalePayment";
3
- import { SaleProduct } from "./SaleProduct";
1
+ import { SaleCustomer } from "./SaleCustomer.js";
2
+ import { SalePayment } from "./SalePayment.js";
3
+ import { SaleProduct } from "./SaleProduct.js";
4
4
  export interface BaseSaleData {
5
5
  register: string | undefined;
6
6
  clientId: string | undefined;
@@ -33,105 +33,70 @@ export declare abstract class BaseSale {
33
33
  protected constructor({ customer, payments, products, ...sale }: SaleData);
34
34
  /**
35
35
  * Updates the sale data to be inline with the new sale
36
- *
37
- * @param {BaseSale} sale
38
- * @protected
39
36
  */
40
37
  protected hydrate(sale: BaseSale): void;
41
38
  /**
42
39
  * Get the products that are currently on the sale.
43
- *
44
- * @returns {Array<SaleProduct>}
45
40
  */
46
41
  getProducts(): Array<SaleProduct>;
47
42
  /**
48
43
  * Get the payments that are currently on the sale.
49
- *
50
- * @returns {Array<SalePayment>}
51
44
  */
52
45
  getPayments(): Array<SalePayment>;
53
46
  /**
54
47
  * Get the current customer on the sale.
55
- *
56
- * @returns {SaleCustomer | null}
57
48
  */
58
49
  getCustomer(): null | SaleCustomer;
59
50
  /**
60
51
  * Get the register.
61
- *
62
- * @returns {string | undefined}
63
52
  */
64
53
  getRegister(): string | undefined;
65
54
  /**
66
55
  * Get the client id.
67
- *
68
- * @returns {string | null}
69
56
  */
70
57
  getClientId(): string | undefined;
71
58
  /**
72
59
  * Get the current sale total on the sale.
73
- *
74
- * @returns {number}
75
60
  */
76
61
  getSaleTotal(): number;
77
62
  /**
78
63
  * Get the current paid total on the sale.
79
- *
80
- * @returns {number}
81
64
  */
82
65
  getPaidTotal(): number;
83
66
  /**
84
67
  * Get the current savings total on the sale.
85
- *
86
- * @returns {number}
87
68
  */
88
69
  getSavingsTotal(): number;
89
70
  /**
90
71
  * Get the current discount total on the sale.
91
- *
92
- * @returns {number}
93
72
  */
94
73
  getDiscountTotal(): number;
95
74
  /**
96
75
  * Get the linked to value on the sale.
97
- *
98
- * @returns {string}
99
76
  */
100
77
  getLinkedTo(): string;
101
78
  /**
102
79
  * Get the refund reason on the sale.
103
- *
104
- * @returns {string}
105
80
  */
106
81
  getRefundReason(): string;
107
82
  /**
108
83
  * Get the price set on the sale.
109
- *
110
- * @returns {string | null}
111
84
  */
112
85
  getPriceSet(): string | null;
113
86
  /**
114
87
  * Get the external sale note (visible to the customer).
115
- *
116
- * @returns {string}
117
88
  */
118
89
  getExternalNote(): string;
119
90
  /**
120
91
  * Get the internal sale note.
121
- *
122
- * @returns {string}
123
92
  */
124
93
  getInternalNote(): string;
125
94
  /**
126
95
  * Get the order reference (visible to the customer).
127
- *
128
- * @returns {string}
129
96
  */
130
97
  getOrderReference(): string;
131
98
  /**
132
99
  * Get the current meta data for the sale
133
- *
134
- * @returns {Record<string, unknown>}
135
100
  */
136
101
  getMetaData(): Record<string, unknown>;
137
102
  abstract addProduct(product: SaleProduct): Promise<void>;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseSale = void 0;
4
- class BaseSale {
1
+ export class BaseSale {
5
2
  constructor({ customer, payments, products, ...sale }) {
6
3
  this.sale = sale;
7
4
  this.customer = customer;
@@ -10,9 +7,6 @@ class BaseSale {
10
7
  }
11
8
  /**
12
9
  * Updates the sale data to be inline with the new sale
13
- *
14
- * @param {BaseSale} sale
15
- * @protected
16
10
  */
17
11
  hydrate(sale) {
18
12
  this.sale = sale.sale;
@@ -22,131 +16,98 @@ class BaseSale {
22
16
  }
23
17
  /**
24
18
  * Get the products that are currently on the sale.
25
- *
26
- * @returns {Array<SaleProduct>}
27
19
  */
28
20
  getProducts() {
29
21
  return this.products;
30
22
  }
31
23
  /**
32
24
  * Get the payments that are currently on the sale.
33
- *
34
- * @returns {Array<SalePayment>}
35
25
  */
36
26
  getPayments() {
37
27
  return this.payments;
38
28
  }
39
29
  /**
40
30
  * Get the current customer on the sale.
41
- *
42
- * @returns {SaleCustomer | null}
43
31
  */
44
32
  getCustomer() {
45
33
  return this.customer;
46
34
  }
47
35
  /**
48
36
  * Get the register.
49
- *
50
- * @returns {string | undefined}
51
37
  */
52
38
  getRegister() {
53
39
  return this.sale.register;
54
40
  }
55
41
  /**
56
42
  * Get the client id.
57
- *
58
- * @returns {string | null}
59
43
  */
60
44
  getClientId() {
61
45
  return this.sale.clientId;
62
46
  }
63
47
  /**
64
48
  * Get the current sale total on the sale.
65
- *
66
- * @returns {number}
67
49
  */
68
50
  getSaleTotal() {
69
51
  return this.sale.totals.sale;
70
52
  }
71
53
  /**
72
54
  * Get the current paid total on the sale.
73
- *
74
- * @returns {number}
75
55
  */
76
56
  getPaidTotal() {
77
57
  return this.sale.totals.paid;
78
58
  }
79
59
  /**
80
60
  * Get the current savings total on the sale.
81
- *
82
- * @returns {number}
83
61
  */
84
62
  getSavingsTotal() {
85
63
  return this.sale.totals.savings;
86
64
  }
87
65
  /**
88
66
  * Get the current discount total on the sale.
89
- *
90
- * @returns {number}
91
67
  */
92
68
  getDiscountTotal() {
93
69
  return this.sale.totals.discount;
94
70
  }
95
71
  /**
96
72
  * Get the linked to value on the sale.
97
- *
98
- * @returns {string}
99
73
  */
100
74
  getLinkedTo() {
101
75
  return this.sale.linkedTo;
102
76
  }
103
77
  /**
104
78
  * Get the refund reason on the sale.
105
- *
106
- * @returns {string}
107
79
  */
108
80
  getRefundReason() {
109
81
  return this.sale.refundReason;
110
82
  }
111
83
  /**
112
84
  * Get the price set on the sale.
113
- *
114
- * @returns {string | null}
115
85
  */
116
86
  getPriceSet() {
117
87
  return this.sale.priceSet;
118
88
  }
119
89
  /**
120
90
  * Get the external sale note (visible to the customer).
121
- *
122
- * @returns {string}
123
91
  */
124
92
  getExternalNote() {
125
93
  return this.sale.notes.sale;
126
94
  }
127
95
  /**
128
96
  * Get the internal sale note.
129
- *
130
- * @returns {string}
131
97
  */
132
98
  getInternalNote() {
133
99
  return this.sale.notes.internal;
134
100
  }
135
101
  /**
136
102
  * Get the order reference (visible to the customer).
137
- *
138
- * @returns {string}
139
103
  */
140
104
  getOrderReference() {
141
105
  return this.sale.orderReference;
142
106
  }
143
107
  /**
144
108
  * Get the current meta data for the sale
145
- *
146
- * @returns {Record<string, unknown>}
147
109
  */
148
110
  getMetaData() {
149
111
  return this.sale.metaData;
150
112
  }
151
113
  }
152
- exports.BaseSale = BaseSale;