@managesome/eposmatic-toolkit 0.3.8 → 0.3.9

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 (436) hide show
  1. package/esm/constants/ANALYTICS.js +146 -0
  2. package/esm/constants/API_ERRORS.js +6 -0
  3. package/esm/constants/COMMON.js +369 -0
  4. package/esm/constants/DELIVERY.js +45 -0
  5. package/esm/constants/DIALER_ENUMS.js +11 -0
  6. package/esm/constants/ENUMS.js +1988 -0
  7. package/esm/constants/FBR_ENUMS.js +18 -0
  8. package/esm/constants/HUBRISE_ENUMS.js +179 -0
  9. package/esm/constants/INTERNAL_ENUMS.js +49 -0
  10. package/esm/constants/NOTIFICATIONS.js +6 -0
  11. package/esm/constants/ORDER.js +251 -0
  12. package/esm/constants/PRA_ENUMS.js +18 -0
  13. package/esm/constants/REPORT_WEBVIEW.js +28 -0
  14. package/esm/constants/RFQ_GO.js +83 -0
  15. package/esm/constants/SMARTPAY_ENUMS.js +55 -0
  16. package/esm/constants/SOCKET.js +149 -0
  17. package/esm/constants/SRB_ENUMS.js +13 -0
  18. package/esm/constants/SWITCHPAY.js +28 -0
  19. package/esm/constants/TENANT_ENUMS.js +90 -0
  20. package/esm/constants/TENANT_PURCHASE_ORDER.js +91 -0
  21. package/esm/constants/WALLET.js +51 -0
  22. package/esm/constants/WAREHOUSE_ANALYTICS.js +28 -0
  23. package/esm/constants/WAREHOUSE_ENUMS.js +420 -0
  24. package/esm/constants/WAREHOUSE_PURCHASE_ORDER.js +97 -0
  25. package/esm/constants/WEBVIEW.js +43 -0
  26. package/esm/constants/WORKER_ENDPOINTS.js +79 -0
  27. package/esm/constants/index.js +27 -0
  28. package/esm/constants/types.js +2 -0
  29. package/esm/helpers/fbr/generate-invoice.js +94 -0
  30. package/esm/helpers/fbr/index.js +1 -0
  31. package/esm/helpers/hubrise/hubrise-catalog.js +304 -0
  32. package/esm/helpers/hubrise/index.js +1 -0
  33. package/esm/helpers/index.js +9 -0
  34. package/esm/helpers/kpra/generate-invoice.js +26 -0
  35. package/esm/helpers/kpra/index.js +1 -0
  36. package/esm/helpers/order/generate-order.js +508 -0
  37. package/esm/helpers/order/generate-warehouse-internal-movement.js +71 -0
  38. package/esm/helpers/order/generate-warehouse-purchase-order-rfq.js +176 -0
  39. package/esm/helpers/order/generate-warehouse-purchase-order.js +187 -0
  40. package/esm/helpers/order/generate-warehouse-sale-order-rfq.js +176 -0
  41. package/esm/helpers/order/generate-warehouse-sale-order.js +149 -0
  42. package/esm/helpers/order/index.js +6 -0
  43. package/esm/helpers/pra/generate-invoice.js +94 -0
  44. package/esm/helpers/pra/index.js +1 -0
  45. package/esm/helpers/srb/generate-invoice.js +68 -0
  46. package/esm/helpers/srb/index.js +1 -0
  47. package/esm/helpers/store/all-orders-actions.js +17 -0
  48. package/esm/helpers/store/all-tenant-purchase-orders-actions.js +45 -0
  49. package/esm/helpers/store/all-warehouse-purchase-order-rfqs-actions.js +66 -0
  50. package/esm/helpers/store/all-warehouse-purchase-order-vendor-return-actions.js +50 -0
  51. package/esm/helpers/store/all-warehouse-purchase-orders-actions.js +49 -0
  52. package/esm/helpers/store/all-warehouse-sale-order-invoices-actions.js +132 -0
  53. package/esm/helpers/store/all-warehouse-sale-order-rfqs-actions.js +66 -0
  54. package/esm/helpers/store/all-warehouse-sale-orders-actions.js +72 -0
  55. package/esm/helpers/store/cart-actions.js +3563 -0
  56. package/esm/helpers/store/catalog-actions.js +379 -0
  57. package/esm/helpers/store/common-order-actions.js +937 -0
  58. package/esm/helpers/store/common-tenant-purchase-order-actions.js +440 -0
  59. package/esm/helpers/store/common-warehouse-internal-movement-actions.js +95 -0
  60. package/esm/helpers/store/common-warehouse-purchase-order-actions.js +530 -0
  61. package/esm/helpers/store/common-warehouse-purchase-order-receipt-actions.js +33 -0
  62. package/esm/helpers/store/common-warehouse-purchase-order-rfq-actions.js +523 -0
  63. package/esm/helpers/store/common-warehouse-purchase-order-vendor-return-actions.js +25 -0
  64. package/esm/helpers/store/common-warehouse-sale-order-actions.js +483 -0
  65. package/esm/helpers/store/common-warehouse-sale-order-invoice-actions.js +54 -0
  66. package/esm/helpers/store/common-warehouse-sale-order-rfq-actions.js +523 -0
  67. package/esm/helpers/store/index.js +26 -0
  68. package/esm/helpers/store/offline-ordering.js +251 -0
  69. package/esm/helpers/store/tenant-purchase-orders-cart-actions.js +379 -0
  70. package/esm/helpers/store/warehouse-purchase-order-rfq-cart-actions.js +360 -0
  71. package/esm/helpers/store/warehouse-purchase-orders-cart-actions.js +470 -0
  72. package/esm/helpers/store/warehouse-sale-order-rfq-cart-actions.js +359 -0
  73. package/esm/helpers/store/warehouse-sale-orders-cart-actions.js +456 -0
  74. package/esm/helpers/types/api-types.js +1 -0
  75. package/esm/helpers/types/cart-actions.js +1 -0
  76. package/esm/helpers/types/cart-helpers.js +1 -0
  77. package/esm/helpers/types/catalog.js +1 -0
  78. package/esm/helpers/types/common.js +1 -0
  79. package/esm/helpers/types/deliverect_menu.js +1 -0
  80. package/esm/helpers/types/email-templates.js +1 -0
  81. package/esm/helpers/types/fbr-generate-invoice.js +1 -0
  82. package/esm/helpers/types/halfhalf.js +1 -0
  83. package/esm/helpers/types/hubrise_catalog.js +1 -0
  84. package/esm/helpers/types/hubrise_customers.js +1 -0
  85. package/esm/helpers/types/hubrise_deliveries.js +1 -0
  86. package/esm/helpers/types/hubrise_location.js +1 -0
  87. package/esm/helpers/types/hubrise_orders.js +1 -0
  88. package/esm/helpers/types/index.js +33 -0
  89. package/esm/helpers/types/internal-leads.js +1 -0
  90. package/esm/helpers/types/inventory-catalog.js +1 -0
  91. package/esm/helpers/types/kpra-generate-invoice.js +1 -0
  92. package/esm/helpers/types/marketing.js +1 -0
  93. package/esm/helpers/types/order-engine.js +1 -0
  94. package/esm/helpers/types/pra-generate-invoice.js +1 -0
  95. package/esm/helpers/types/report-webview.js +1 -0
  96. package/esm/helpers/types/reports.js +1 -0
  97. package/esm/helpers/types/smartpay-apis.js +2 -0
  98. package/esm/helpers/types/specials.js +1 -0
  99. package/esm/helpers/types/split_bill.js +1 -0
  100. package/esm/helpers/types/srb-generate-invoice.js +1 -0
  101. package/esm/helpers/types/switchpay.js +1 -0
  102. package/esm/helpers/types/tenant-purchase-order-cart-actions.js +1 -0
  103. package/esm/helpers/types/warehouse-catalog.js +1 -0
  104. package/esm/helpers/types/warehouse-purchase-order-cart-actions.js +1 -0
  105. package/esm/helpers/types/warehouse-purchase-order-rfq-cart-actions.js +1 -0
  106. package/esm/helpers/types/warehouse-sale-order-cart-actions.js +1 -0
  107. package/esm/helpers/types/warehouse-sale-order-rfq-cart-actions.js +1 -0
  108. package/esm/helpers/types/workers.js +1 -0
  109. package/esm/helpers/utils/asaanbill-identifier-helpers.js +31 -0
  110. package/esm/helpers/utils/business-day-helpers.js +201 -0
  111. package/esm/helpers/utils/cart-helpers.js +156 -0
  112. package/esm/helpers/utils/catalog-conversion.js +129 -0
  113. package/esm/helpers/utils/code-redemption-helpers.js +452 -0
  114. package/esm/helpers/utils/color-helpers.js +31 -0
  115. package/esm/helpers/utils/common.js +368 -0
  116. package/esm/helpers/utils/crypt.js +40 -0
  117. package/esm/helpers/utils/customers-helpers.js +15 -0
  118. package/esm/helpers/utils/delivery-area-helpers.js +42 -0
  119. package/esm/helpers/utils/delivery-helpers.js +87 -0
  120. package/esm/helpers/utils/denominations-helpers.js +53 -0
  121. package/esm/helpers/utils/dinein.js +39 -0
  122. package/esm/helpers/utils/discount-helpers.js +55 -0
  123. package/esm/helpers/utils/email-helpers.js +111 -0
  124. package/esm/helpers/utils/error-helpers.js +14 -0
  125. package/esm/helpers/utils/expense.js +26 -0
  126. package/esm/helpers/utils/getFormFieldsDiff.js +15 -0
  127. package/esm/helpers/utils/gift-card-helpers.js +258 -0
  128. package/esm/helpers/utils/halfhalf-setup-helpers.js +779 -0
  129. package/esm/helpers/utils/hourly-comparison-report-helpers.js +851 -0
  130. package/esm/helpers/utils/hr-helpers.js +62 -0
  131. package/esm/helpers/utils/hubrise-utils.js +32 -0
  132. package/esm/helpers/utils/image-helpers.js +95 -0
  133. package/esm/helpers/utils/image-url-helpers.js +96 -0
  134. package/esm/helpers/utils/index.js +96 -0
  135. package/esm/helpers/utils/ingredients.js +26 -0
  136. package/esm/helpers/utils/internal-amount-helpers.js +49 -0
  137. package/esm/helpers/utils/inventory.js +123 -0
  138. package/esm/helpers/utils/inventory_entries.js +91 -0
  139. package/esm/helpers/utils/inventory_transactions.js +91 -0
  140. package/esm/helpers/utils/item-report-helpers.js +2603 -0
  141. package/esm/helpers/utils/items-comparison-report-helpers.js +1057 -0
  142. package/esm/helpers/utils/kds-helpers.js +43 -0
  143. package/esm/helpers/utils/location-helpers.js +13 -0
  144. package/esm/helpers/utils/menu-helpers.js +44 -0
  145. package/esm/helpers/utils/minified-catalog.js +428 -0
  146. package/esm/helpers/utils/offer-apply-helpers.js +613 -0
  147. package/esm/helpers/utils/offers-helpers.js +3351 -0
  148. package/esm/helpers/utils/operational-roles-helpers.js +33 -0
  149. package/esm/helpers/utils/order-engine.js +1409 -0
  150. package/esm/helpers/utils/order-history.js +208 -0
  151. package/esm/helpers/utils/payment-comparison-report-helpers.js +873 -0
  152. package/esm/helpers/utils/payment-helpers.js +302 -0
  153. package/esm/helpers/utils/pdf-generator.js +110 -0
  154. package/esm/helpers/utils/platform-catalog.js +306 -0
  155. package/esm/helpers/utils/platform-num.js +188 -0
  156. package/esm/helpers/utils/platform-specific-tenant-shifts.js +19 -0
  157. package/esm/helpers/utils/price-conversion.js +24 -0
  158. package/esm/helpers/utils/printer-helpers.js +319 -0
  159. package/esm/helpers/utils/public-holidays-helpers.js +8 -0
  160. package/esm/helpers/utils/ratings-comparison-report-helpers.js +1187 -0
  161. package/esm/helpers/utils/receipt-engine.js +1050 -0
  162. package/esm/helpers/utils/review-helpers.js +391 -0
  163. package/esm/helpers/utils/rider-tracking.js +12 -0
  164. package/esm/helpers/utils/riders-report-helpers.js +1590 -0
  165. package/esm/helpers/utils/sales-comparison-report-helpers.js +1259 -0
  166. package/esm/helpers/utils/sales-comparitive-report-helpers.js +939 -0
  167. package/esm/helpers/utils/sales-overview-report-helpers.js +1046 -0
  168. package/esm/helpers/utils/sales-summary-report-helpers.js +877 -0
  169. package/esm/helpers/utils/scan-code-helpers.js +31 -0
  170. package/esm/helpers/utils/selection-model.js +68 -0
  171. package/esm/helpers/utils/shift-window-helpers.js +148 -0
  172. package/esm/helpers/utils/simplified-catalog.js +107 -0
  173. package/esm/helpers/utils/simplified-halfhalf.js +101 -0
  174. package/esm/helpers/utils/simplified-specials.js +107 -0
  175. package/esm/helpers/utils/simplified-tenant.js +411 -0
  176. package/esm/helpers/utils/specials-helpers.js +727 -0
  177. package/esm/helpers/utils/tenant-calendar-helpers.js +67 -0
  178. package/esm/helpers/utils/tenant-cash-drawer-sessions-helpers.js +248 -0
  179. package/esm/helpers/utils/tenant-cash-drawers-helpers.js +31 -0
  180. package/esm/helpers/utils/tenant-cash-in-out-helpers.js +47 -0
  181. package/esm/helpers/utils/tenant-day-sessions-helpers.js +167 -0
  182. package/esm/helpers/utils/tenant-instore-shift-sessions-helpers.js +227 -0
  183. package/esm/helpers/utils/tenant-staff-helpers.js +19 -0
  184. package/esm/helpers/utils/tenant_cash_in_hand_transactions.js +31 -0
  185. package/esm/helpers/utils/time-helpers.js +142 -0
  186. package/esm/helpers/utils/void-items-report-helpers.js +529 -0
  187. package/esm/helpers/utils/void-order-items-helpers.js +32 -0
  188. package/esm/helpers/utils/voidations-summary-report-helpers.js +800 -0
  189. package/esm/helpers/utils/wallet-helpers.js +22 -0
  190. package/esm/helpers/utils/wallet-redemption-helpers.js +46 -0
  191. package/esm/helpers/utils/warehouse-catalog-conversion.js +117 -0
  192. package/esm/helpers/utils/warehouse-inventory.js +59 -0
  193. package/esm/helpers/utils/warehouse-purchase-order-engine.js +27 -0
  194. package/esm/helpers/utils/warehouse-purchase-order-receipt-engine.js +205 -0
  195. package/esm/helpers/utils/warehouse-purchase-order-x-report-helpers.js +1432 -0
  196. package/esm/helpers/utils/warehouse-sale-order-engine.js +27 -0
  197. package/esm/helpers/utils/warehouse-sale-order-receipt-engine.js +207 -0
  198. package/esm/helpers/utils/warehouse-sale-order-x-report-helpers.js +1 -0
  199. package/esm/helpers/utils/warehouse-sale-x-report-helpers.js +1434 -0
  200. package/esm/helpers/utils/warehouse-settings-helpers.js +37 -0
  201. package/esm/helpers/utils/warehouse-void-purchase-order-items-helpers.js +34 -0
  202. package/esm/helpers/utils/warehouse-void-purchase-order-items-report-helpers.js +18 -0
  203. package/esm/helpers/utils/warehouse-void-sale-order-items-helpers.js +34 -0
  204. package/esm/helpers/utils/warehouse-void-sale-order-items-report-helpers.js +18 -0
  205. package/esm/helpers/utils/warehouse_inventory_transactions.js +91 -0
  206. package/esm/helpers/utils/x-report-helpers.js +1850 -0
  207. package/esm/index.js +3 -0
  208. package/esm/schemas/index.js +2 -0
  209. package/esm/schemas/models/app_configs.js +36 -0
  210. package/esm/schemas/models/applied_order_discounts.js +103 -0
  211. package/esm/schemas/models/brands.js +56 -0
  212. package/esm/schemas/models/categories.js +74 -0
  213. package/esm/schemas/models/close_dates.js +63 -0
  214. package/esm/schemas/models/common-models.js +449 -0
  215. package/esm/schemas/models/courses.js +62 -0
  216. package/esm/schemas/models/customer_redemptions.js +82 -0
  217. package/esm/schemas/models/customers.js +269 -0
  218. package/esm/schemas/models/deliveries.js +137 -0
  219. package/esm/schemas/models/delivery_areas.js +97 -0
  220. package/esm/schemas/models/dinein_floors.js +55 -0
  221. package/esm/schemas/models/dinein_tables.js +97 -0
  222. package/esm/schemas/models/dinein_tables_fingerprints.js +96 -0
  223. package/esm/schemas/models/discounts.js +87 -0
  224. package/esm/schemas/models/expense_categories.js +61 -0
  225. package/esm/schemas/models/expense_details.js +130 -0
  226. package/esm/schemas/models/gift_cards.js +342 -0
  227. package/esm/schemas/models/halfhalf_setup.js +142 -0
  228. package/esm/schemas/models/index.js +111 -0
  229. package/esm/schemas/models/internal_customers.js +139 -0
  230. package/esm/schemas/models/internal_invoices.js +119 -0
  231. package/esm/schemas/models/internal_leads.js +78 -0
  232. package/esm/schemas/models/internal_operational_roles.js +85 -0
  233. package/esm/schemas/models/internal_staffs.js +65 -0
  234. package/esm/schemas/models/inventories.js +103 -0
  235. package/esm/schemas/models/inventory_categories.js +52 -0
  236. package/esm/schemas/models/inventory_transactions.js +143 -0
  237. package/esm/schemas/models/item_transactions.js +117 -0
  238. package/esm/schemas/models/items.js +341 -0
  239. package/esm/schemas/models/marketing_fingerprints.js +92 -0
  240. package/esm/schemas/models/menus.js +66 -0
  241. package/esm/schemas/models/messaging_devices.js +99 -0
  242. package/esm/schemas/models/modifier_extras.js +120 -0
  243. package/esm/schemas/models/offers.js +470 -0
  244. package/esm/schemas/models/offers_fingerprints.js +61 -0
  245. package/esm/schemas/models/operational_roles.js +155 -0
  246. package/esm/schemas/models/orders.js +1051 -0
  247. package/esm/schemas/models/printer_settings.js +245 -0
  248. package/esm/schemas/models/public_holidays.js +58 -0
  249. package/esm/schemas/models/reservations.js +127 -0
  250. package/esm/schemas/models/reviews.js +145 -0
  251. package/esm/schemas/models/rewards_usage.js +61 -0
  252. package/esm/schemas/models/riders.js +75 -0
  253. package/esm/schemas/models/specials.js +169 -0
  254. package/esm/schemas/models/staff_shifts.js +66 -0
  255. package/esm/schemas/models/tenant-activity-logs.js +126 -0
  256. package/esm/schemas/models/tenant_active_jobs.js +77 -0
  257. package/esm/schemas/models/tenant_calendar.js +89 -0
  258. package/esm/schemas/models/tenant_cash_drawer_sessions.js +208 -0
  259. package/esm/schemas/models/tenant_cash_drawers.js +60 -0
  260. package/esm/schemas/models/tenant_cash_in_hand_transactions.js +69 -0
  261. package/esm/schemas/models/tenant_cash_in_out.js +104 -0
  262. package/esm/schemas/models/tenant_clients.js +66 -0
  263. package/esm/schemas/models/tenant_day_sessions.js +166 -0
  264. package/esm/schemas/models/tenant_hr_attendance_records.js +87 -0
  265. package/esm/schemas/models/tenant_hr_biometric_enrollments.js +69 -0
  266. package/esm/schemas/models/tenant_hr_departments.js +42 -0
  267. package/esm/schemas/models/tenant_hr_documents.js +71 -0
  268. package/esm/schemas/models/tenant_hr_employees.js +172 -0
  269. package/esm/schemas/models/tenant_hr_leave_requests.js +80 -0
  270. package/esm/schemas/models/tenant_hr_payrolls.js +131 -0
  271. package/esm/schemas/models/tenant_hr_performance_reviews.js +58 -0
  272. package/esm/schemas/models/tenant_hr_policies.js +57 -0
  273. package/esm/schemas/models/tenant_hr_positions.js +48 -0
  274. package/esm/schemas/models/tenant_hr_shift_schedules.js +84 -0
  275. package/esm/schemas/models/tenant_hr_shifts.js +64 -0
  276. package/esm/schemas/models/tenant_instore_shift_sessions.js +204 -0
  277. package/esm/schemas/models/tenant_instore_shifts.js +63 -0
  278. package/esm/schemas/models/tenant_inventory_department_transactions.js +116 -0
  279. package/esm/schemas/models/tenant_inventory_department_utilities.js +85 -0
  280. package/esm/schemas/models/tenant_inventory_departments.js +55 -0
  281. package/esm/schemas/models/tenant_inventory_entries.js +131 -0
  282. package/esm/schemas/models/tenant_metadata.js +88 -0
  283. package/esm/schemas/models/tenant_order_item_instructions.js +66 -0
  284. package/esm/schemas/models/tenant_purchase_order_vendor_returns.js +80 -0
  285. package/esm/schemas/models/tenant_purchase_orders.js +158 -0
  286. package/esm/schemas/models/tenant_shifts.js +57 -0
  287. package/esm/schemas/models/tenant_staffs.js +129 -0
  288. package/esm/schemas/models/tenant_vendors.js +99 -0
  289. package/esm/schemas/models/tenants.js +811 -0
  290. package/esm/schemas/models/terminal_devices.js +63 -0
  291. package/esm/schemas/models/tokens.js +73 -0
  292. package/esm/schemas/models/track_order_numbers.js +42 -0
  293. package/esm/schemas/models/void_order_items.js +210 -0
  294. package/esm/schemas/models/vouchers.js +101 -0
  295. package/esm/schemas/models/wallet_transactions.js +128 -0
  296. package/esm/schemas/models/wallets.js +44 -0
  297. package/esm/schemas/models/warehouse-activity-logs.js +144 -0
  298. package/esm/schemas/models/warehouse_categories.js +83 -0
  299. package/esm/schemas/models/warehouse_clients.js +81 -0
  300. package/esm/schemas/models/warehouse_communications.js +226 -0
  301. package/esm/schemas/models/warehouse_internal_movements.js +463 -0
  302. package/esm/schemas/models/warehouse_inventory_entries.js +125 -0
  303. package/esm/schemas/models/warehouse_inventory_lot_serial_numbers.js +188 -0
  304. package/esm/schemas/models/warehouse_inventory_transactions.js +133 -0
  305. package/esm/schemas/models/warehouse_item_transactions.js +97 -0
  306. package/esm/schemas/models/warehouse_items.js +173 -0
  307. package/esm/schemas/models/warehouse_operational_roles.js +87 -0
  308. package/esm/schemas/models/warehouse_purchase_order_receipts.js +163 -0
  309. package/esm/schemas/models/warehouse_purchase_order_rfqs.js +339 -0
  310. package/esm/schemas/models/warehouse_purchase_order_vendor_returns.js +199 -0
  311. package/esm/schemas/models/warehouse_purchase_orders.js +334 -0
  312. package/esm/schemas/models/warehouse_sale_deliveries.js +155 -0
  313. package/esm/schemas/models/warehouse_sale_invoices.js +229 -0
  314. package/esm/schemas/models/warehouse_sale_order_rfqs.js +340 -0
  315. package/esm/schemas/models/warehouse_sale_orders.js +322 -0
  316. package/esm/schemas/models/warehouse_staffs.js +104 -0
  317. package/esm/schemas/models/warehouse_track_order_numbers.js +73 -0
  318. package/esm/schemas/models/warehouse_vendors.js +99 -0
  319. package/esm/schemas/models/warehouse_void_purchase_order_items.js +174 -0
  320. package/esm/schemas/models/warehouse_void_sale_order_items.js +174 -0
  321. package/esm/schemas/models/warehouses.js +253 -0
  322. package/esm/schemas/types/app_configs.js +1 -0
  323. package/esm/schemas/types/applied_order_discounts.js +1 -0
  324. package/esm/schemas/types/brands.js +1 -0
  325. package/esm/schemas/types/categories.js +1 -0
  326. package/esm/schemas/types/close_dates.js +1 -0
  327. package/esm/schemas/types/common.js +1 -0
  328. package/esm/schemas/types/courses.js +1 -0
  329. package/esm/schemas/types/customer_redemptions.js +1 -0
  330. package/esm/schemas/types/customers.js +1 -0
  331. package/esm/schemas/types/deliveries.js +1 -0
  332. package/esm/schemas/types/delivery_areas.js +1 -0
  333. package/esm/schemas/types/dinein_floors.js +1 -0
  334. package/esm/schemas/types/dinein_tables.js +1 -0
  335. package/esm/schemas/types/dinein_tables_fingerprints.js +1 -0
  336. package/esm/schemas/types/discounts.js +1 -0
  337. package/esm/schemas/types/expense_categories.js +1 -0
  338. package/esm/schemas/types/expense_details.js +1 -0
  339. package/esm/schemas/types/gift_cards.js +1 -0
  340. package/esm/schemas/types/halfhalf_setup.js +1 -0
  341. package/esm/schemas/types/index.js +113 -0
  342. package/esm/schemas/types/internal_customers.js +1 -0
  343. package/esm/schemas/types/internal_invoices.js +1 -0
  344. package/esm/schemas/types/internal_leads.js +1 -0
  345. package/esm/schemas/types/internal_operational_roles.js +16 -0
  346. package/esm/schemas/types/internal_staffs.js +1 -0
  347. package/esm/schemas/types/inventories.js +1 -0
  348. package/esm/schemas/types/inventory_categories.js +1 -0
  349. package/esm/schemas/types/inventory_department_transactions.js +1 -0
  350. package/esm/schemas/types/inventory_department_utilities.js +1 -0
  351. package/esm/schemas/types/inventory_departments.js +1 -0
  352. package/esm/schemas/types/inventory_transactions.js +1 -0
  353. package/esm/schemas/types/item_transactions.js +1 -0
  354. package/esm/schemas/types/items.js +1 -0
  355. package/esm/schemas/types/marketing_fingerprints.js +1 -0
  356. package/esm/schemas/types/menus.js +1 -0
  357. package/esm/schemas/types/messaging_devices.js +1 -0
  358. package/esm/schemas/types/modifier_extras.js +1 -0
  359. package/esm/schemas/types/multi_tenants.js +1 -0
  360. package/esm/schemas/types/offers.js +1 -0
  361. package/esm/schemas/types/offers_fingerprints.js +1 -0
  362. package/esm/schemas/types/operational_roles.js +15 -0
  363. package/esm/schemas/types/orders.js +1 -0
  364. package/esm/schemas/types/printer_settings.js +1 -0
  365. package/esm/schemas/types/public_holidays.js +1 -0
  366. package/esm/schemas/types/reservations.js +1 -0
  367. package/esm/schemas/types/reviews.js +1 -0
  368. package/esm/schemas/types/rewards_usage.js +1 -0
  369. package/esm/schemas/types/riders.js +1 -0
  370. package/esm/schemas/types/specials.js +1 -0
  371. package/esm/schemas/types/staff_shifts.js +1 -0
  372. package/esm/schemas/types/tenant-activity-logs.js +1 -0
  373. package/esm/schemas/types/tenant_active_jobs.js +1 -0
  374. package/esm/schemas/types/tenant_calendar.js +1 -0
  375. package/esm/schemas/types/tenant_cash_drawer_sessions.js +1 -0
  376. package/esm/schemas/types/tenant_cash_drawers.js +1 -0
  377. package/esm/schemas/types/tenant_cash_in_hand_transactions.js +1 -0
  378. package/esm/schemas/types/tenant_cash_in_out.js +1 -0
  379. package/esm/schemas/types/tenant_clients.js +1 -0
  380. package/esm/schemas/types/tenant_day_sessions.js +1 -0
  381. package/esm/schemas/types/tenant_hr_attendance_records.js +1 -0
  382. package/esm/schemas/types/tenant_hr_biometric_enrollments.js +1 -0
  383. package/esm/schemas/types/tenant_hr_departments.js +1 -0
  384. package/esm/schemas/types/tenant_hr_documents.js +1 -0
  385. package/esm/schemas/types/tenant_hr_employees.js +1 -0
  386. package/esm/schemas/types/tenant_hr_leave_requests.js +1 -0
  387. package/esm/schemas/types/tenant_hr_payrolls.js +1 -0
  388. package/esm/schemas/types/tenant_hr_performance_reviews.js +1 -0
  389. package/esm/schemas/types/tenant_hr_policies.js +1 -0
  390. package/esm/schemas/types/tenant_hr_positions.js +1 -0
  391. package/esm/schemas/types/tenant_hr_shift_schedules.js +1 -0
  392. package/esm/schemas/types/tenant_hr_shifts.js +1 -0
  393. package/esm/schemas/types/tenant_instore_shift_sessions.js +1 -0
  394. package/esm/schemas/types/tenant_instore_shifts.js +1 -0
  395. package/esm/schemas/types/tenant_inventory_entries.js +1 -0
  396. package/esm/schemas/types/tenant_metadata.js +1 -0
  397. package/esm/schemas/types/tenant_order_item_instructions.js +1 -0
  398. package/esm/schemas/types/tenant_purchase_order_vendor_returns.js +1 -0
  399. package/esm/schemas/types/tenant_purchase_orders.js +1 -0
  400. package/esm/schemas/types/tenant_shifts.js +1 -0
  401. package/esm/schemas/types/tenant_staffs.js +1 -0
  402. package/esm/schemas/types/tenant_vendors.js +1 -0
  403. package/esm/schemas/types/tenants.js +1 -0
  404. package/esm/schemas/types/terminal_devices.js +1 -0
  405. package/esm/schemas/types/tokens.js +1 -0
  406. package/esm/schemas/types/track_order_numbers.js +1 -0
  407. package/esm/schemas/types/void_order_items.js +1 -0
  408. package/esm/schemas/types/vouchers.js +1 -0
  409. package/esm/schemas/types/wallet_transactions.js +1 -0
  410. package/esm/schemas/types/wallets.js +1 -0
  411. package/esm/schemas/types/warehouse-activity-logs.js +1 -0
  412. package/esm/schemas/types/warehouse_categories.js +1 -0
  413. package/esm/schemas/types/warehouse_clients.js +1 -0
  414. package/esm/schemas/types/warehouse_communications.js +1 -0
  415. package/esm/schemas/types/warehouse_internal_movements.js +1 -0
  416. package/esm/schemas/types/warehouse_inventory_entries.js +1 -0
  417. package/esm/schemas/types/warehouse_inventory_lot_serial_numbers.js +1 -0
  418. package/esm/schemas/types/warehouse_inventory_transactions.js +1 -0
  419. package/esm/schemas/types/warehouse_item_transactions.js +1 -0
  420. package/esm/schemas/types/warehouse_items.js +1 -0
  421. package/esm/schemas/types/warehouse_operational_roles.js +15 -0
  422. package/esm/schemas/types/warehouse_purchase_order_receipts.js +18 -0
  423. package/esm/schemas/types/warehouse_purchase_order_rfqs.js +1 -0
  424. package/esm/schemas/types/warehouse_purchase_order_vendor_returns.js +1 -0
  425. package/esm/schemas/types/warehouse_purchase_orders.js +1 -0
  426. package/esm/schemas/types/warehouse_sale_deliveries.js +1 -0
  427. package/esm/schemas/types/warehouse_sale_invoices.js +1 -0
  428. package/esm/schemas/types/warehouse_sale_order_rfqs.js +1 -0
  429. package/esm/schemas/types/warehouse_sale_orders.js +1 -0
  430. package/esm/schemas/types/warehouse_staffs.js +1 -0
  431. package/esm/schemas/types/warehouse_track_order_numbers.js +1 -0
  432. package/esm/schemas/types/warehouse_vendors.js +1 -0
  433. package/esm/schemas/types/warehouse_void_purchase_order_items.js +1 -0
  434. package/esm/schemas/types/warehouse_void_sale_order_items.js +1 -0
  435. package/esm/schemas/types/warehouses.js +1 -0
  436. package/package.json +6 -3
@@ -0,0 +1,62 @@
1
+ import { convertDecimalToInt, convertIntToDecimal } from './price-conversion';
2
+ export function getHrPayrollWithPrice(payroll, writeable) {
3
+ const convert = writeable ? convertDecimalToInt : convertIntToDecimal;
4
+ return {
5
+ ...payroll,
6
+ ...(payroll.salary_per_hour != null ? { salary_per_hour: convert(payroll.salary_per_hour) } : {}),
7
+ ...(payroll.monthly_salary != null ? { monthly_salary: convert(payroll.monthly_salary) } : {}),
8
+ ...(payroll.working_days_per_month != null
9
+ ? { working_days_per_month: convert(payroll.working_days_per_month) }
10
+ : {}),
11
+ ...(payroll.hours_per_working_day != null ? { hours_per_working_day: convert(payroll.hours_per_working_day) } : {}),
12
+ ...(payroll.overtime_multiplier != null ? { overtime_multiplier: convert(payroll.overtime_multiplier) } : {}),
13
+ ...(payroll.regular_hours != null ? { regular_hours: convert(payroll.regular_hours) } : {}),
14
+ ...(payroll.overtime_hours != null ? { overtime_hours: convert(payroll.overtime_hours) } : {}),
15
+ ...(payroll.unpaid_leave_days != null ? { unpaid_leave_days: convert(payroll.unpaid_leave_days) } : {}),
16
+ ...(payroll.regular_pay != null ? { regular_pay: convert(payroll.regular_pay) } : {}),
17
+ ...(payroll.overtime_pay != null ? { overtime_pay: convert(payroll.overtime_pay) } : {}),
18
+ ...(payroll.gross_salary != null ? { gross_salary: convert(payroll.gross_salary) } : {}),
19
+ ...(payroll.unpaid_leave_deduction != null
20
+ ? { unpaid_leave_deduction: convert(payroll.unpaid_leave_deduction) }
21
+ : {}),
22
+ ...(payroll.other_deductions != null ? { other_deductions: convert(payroll.other_deductions) } : {}),
23
+ ...(payroll.total_deductions != null ? { total_deductions: convert(payroll.total_deductions) } : {}),
24
+ ...(payroll.net_salary != null ? { net_salary: convert(payroll.net_salary) } : {}),
25
+ };
26
+ }
27
+ export function getHrPayrollsFetchedData(data) {
28
+ return data.map((payroll) => getHrPayrollWithPrice(payroll, false));
29
+ }
30
+ // Same encoding for the money/policy values on an HR employee record.
31
+ export function getHrEmployeeWithPrice(employee, writeable) {
32
+ const convert = writeable ? convertDecimalToInt : convertIntToDecimal;
33
+ return {
34
+ ...employee,
35
+ ...(employee.leave_allowance
36
+ ? {
37
+ leave_allowance: Object.fromEntries(Object.entries(employee.leave_allowance).map(([leave_type, days]) => [
38
+ leave_type,
39
+ typeof days === 'number' ? convert(days) : days,
40
+ ])),
41
+ }
42
+ : {}),
43
+ ...(employee.salary_per_hour != null ? { salary_per_hour: convert(employee.salary_per_hour) } : {}),
44
+ ...(employee.monthly_salary != null ? { monthly_salary: convert(employee.monthly_salary) } : {}),
45
+ ...(employee.hr_working_days_per_month != null
46
+ ? {
47
+ hr_working_days_per_month: convert(employee.hr_working_days_per_month),
48
+ }
49
+ : {}),
50
+ ...(employee.hr_hours_per_working_day != null
51
+ ? {
52
+ hr_hours_per_working_day: convert(employee.hr_hours_per_working_day),
53
+ }
54
+ : {}),
55
+ ...(employee.hr_overtime_multiplier != null
56
+ ? { hr_overtime_multiplier: convert(employee.hr_overtime_multiplier) }
57
+ : {}),
58
+ };
59
+ }
60
+ export function getHrEmployeesFetchedData(data) {
61
+ return data.map((employee) => getHrEmployeeWithPrice(employee, false));
62
+ }
@@ -0,0 +1,32 @@
1
+ import { DAY_INDEX_ENUM } from '../../constants';
2
+ import { getPriceEnum } from './platform-catalog';
3
+ import { convertPriceFromCents } from './price-conversion';
4
+ export function convertEposmaticPriceToHubrisePrice(payload) {
5
+ const price = getPriceEnum(payload.price, payload.platform);
6
+ const discount = getPriceEnum(payload.discount_amount, payload.platform);
7
+ const discountedPrice = price - discount;
8
+ const priceInDollars = convertPriceFromCents(discountedPrice);
9
+ return `${priceInDollars.toFixed(2)} ${payload.currency_code}`;
10
+ }
11
+ export function convertDateToHubriseDate(date) {
12
+ return new Date(date).toLocaleDateString().split('/').reverse().join('-');
13
+ }
14
+ export function convertMsToHubriseTime(milliseconds) {
15
+ let hours = Math.floor(milliseconds / (1000 * 60 * 60));
16
+ let minutes = Math.floor((milliseconds % (1000 * 60 * 60)) / (1000 * 60));
17
+ hours = hours < 10 ? '0' + hours : hours;
18
+ minutes = minutes < 10 ? '0' + minutes : minutes;
19
+ return hours + ':' + minutes;
20
+ }
21
+ export function convertDaysIndexToHubriseDOW(days_index) {
22
+ const dow = [
23
+ days_index.includes(DAY_INDEX_ENUM.MON) ? '1' : '-',
24
+ days_index.includes(DAY_INDEX_ENUM.TUE) ? '2' : '-',
25
+ days_index.includes(DAY_INDEX_ENUM.WED) ? '3' : '-',
26
+ days_index.includes(DAY_INDEX_ENUM.THU) ? '4' : '-',
27
+ days_index.includes(DAY_INDEX_ENUM.FRI) ? '5' : '-',
28
+ days_index.includes(DAY_INDEX_ENUM.SAT) ? '6' : '-',
29
+ days_index.includes(DAY_INDEX_ENUM.SUN) ? '7' : '-',
30
+ ].join('');
31
+ return dow;
32
+ }
@@ -0,0 +1,95 @@
1
+ export function toMonoImage(imgdata, s = 1, g = 1) {
2
+ const x = String.fromCharCode;
3
+ const m8 = [
4
+ [2, 130, 34, 162, 10, 138, 42, 170],
5
+ [194, 66, 226, 98, 202, 74, 234, 106],
6
+ [50, 178, 18, 146, 58, 186, 26, 154],
7
+ [242, 114, 210, 82, 250, 122, 218, 90],
8
+ [14, 142, 46, 174, 6, 134, 38, 166],
9
+ [206, 78, 238, 110, 198, 70, 230, 102],
10
+ [62, 190, 30, 158, 54, 182, 22, 150],
11
+ [254, 126, 222, 94, 246, 118, 214, 86],
12
+ ];
13
+ const d = imgdata.data;
14
+ const w = imgdata.width;
15
+ const h = imgdata.height;
16
+ const r = new Array(((w + 7) >> 3) * h);
17
+ let n = 0;
18
+ let p = 0;
19
+ let q = 0;
20
+ let t = 128;
21
+ const e = new Array();
22
+ let e1;
23
+ let e2;
24
+ let b;
25
+ let v;
26
+ let f;
27
+ let i;
28
+ let j;
29
+ if (s == 1) {
30
+ i = w;
31
+ while (i--) {
32
+ e.push(0);
33
+ }
34
+ }
35
+ for (j = 0; j < h; j++) {
36
+ e1 = 0;
37
+ e2 = 0;
38
+ i = 0;
39
+ while (i < w) {
40
+ b = i & 7;
41
+ if (s == 0) {
42
+ t = m8[j & 7][b];
43
+ }
44
+ v =
45
+ (Math.pow((((d[p++] * 0.29891 + d[p++] * 0.58661 + d[p++] * 0.11448) * d[p]) / 255 + 255 - d[p++]) / 255, 1 / g) *
46
+ 255) |
47
+ 0;
48
+ if (s == 1) {
49
+ v += (e[i] + e1) >> 4;
50
+ f = v - (v < t ? 0 : 255);
51
+ if (i > 0) {
52
+ e[i - 1] += f;
53
+ }
54
+ e[i] = f * 7 + e2;
55
+ e1 = f * 5;
56
+ e2 = f * 3;
57
+ }
58
+ if (v < t) {
59
+ n |= 128 >> b;
60
+ }
61
+ i++;
62
+ if (b == 7 || i == w) {
63
+ r[q++] = x(n == 16 ? 32 : n);
64
+ n = 0;
65
+ }
66
+ }
67
+ }
68
+ return r.join('');
69
+ }
70
+ export function toBase64Binary(s) {
71
+ const l = s.length;
72
+ const r = new Array(((l + 2) / 3) << 2);
73
+ const t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
74
+ let p = (3 - (l % 3)) % 3;
75
+ let j = 0;
76
+ let i = 0;
77
+ let n;
78
+ s += '\x00\x00';
79
+ while (i < l) {
80
+ n = (s.charCodeAt(i++) << 16) | (s.charCodeAt(i++) << 8) | s.charCodeAt(i++);
81
+ r[j++] = t.charAt((n >> 18) & 63);
82
+ r[j++] = t.charAt((n >> 12) & 63);
83
+ r[j++] = t.charAt((n >> 6) & 63);
84
+ r[j++] = t.charAt(n & 63);
85
+ }
86
+ while (p--) {
87
+ r[--j] = '=';
88
+ }
89
+ return r.join('');
90
+ }
91
+ export function getBase64BinaryImage(imageData) {
92
+ const raster = toMonoImage(imageData, 1, 1);
93
+ const monoImage = toBase64Binary(raster);
94
+ return monoImage;
95
+ }
@@ -0,0 +1,96 @@
1
+ const VARIANTS_HOST = 'firebasestorage.googleapis.com';
2
+ /**
3
+ * Transforms a Firebase Storage download URL for an original image into the
4
+ * URL of a resized WebP variant stored in the `{project}-variants` bucket.
5
+ *
6
+ * Returns the input unchanged if it is not a parseable firebasestorage URL,
7
+ * so consumers degrade gracefully to the original when no variant exists.
8
+ *
9
+ * Naming parity with the backfill + Cloud Function:
10
+ * - variants bucket = source bucket minus `.appspot.com` plus `-variants`
11
+ * - variant path = original path minus extension + `_{size}`
12
+ * - `.webp` is appended only when the original had an extension
13
+ * (extensionless originals produce extensionless variants)
14
+ *
15
+ * Idempotent for variants: only URLs in the default `{project}.appspot.com`
16
+ * bucket are transformed. Anything else — including already-generated
17
+ * `{project}-variants` URLs or custom buckets — is returned unchanged, so
18
+ * precomputed variants are never re-variantized (e.g. `prod-managesome-variants`
19
+ * must not become `...-variants-variants`).
20
+ */
21
+ export function getImageVariantUrl(downloadUrl, size) {
22
+ if (!downloadUrl)
23
+ return;
24
+ let url;
25
+ try {
26
+ url = new URL(downloadUrl);
27
+ }
28
+ catch {
29
+ return downloadUrl;
30
+ }
31
+ if (url.hostname !== VARIANTS_HOST) {
32
+ return downloadUrl;
33
+ }
34
+ // Path shape: /v0/b/{bucket}/o/{encodedPath}
35
+ const segments = url.pathname.split('/');
36
+ if (segments[1] !== 'v0' || segments[2] !== 'b' || segments[4] !== 'o') {
37
+ return downloadUrl;
38
+ }
39
+ const bucket = segments[3];
40
+ if (!bucket) {
41
+ return downloadUrl;
42
+ }
43
+ // Only images stored in the default `{project}.appspot.com` bucket are
44
+ // variant sources. Anything else — including already-generated
45
+ // `{project}-variants` URLs or custom buckets — is returned unchanged.
46
+ if (!bucket.endsWith('.appspot.com')) {
47
+ return downloadUrl;
48
+ }
49
+ const encodedPath = segments.slice(5).join('/');
50
+ if (!encodedPath) {
51
+ return downloadUrl;
52
+ }
53
+ // Guard: malformed percent-encoding (e.g. "%zz") throws URIError —
54
+ // degrade to the original URL rather than crash.
55
+ let sourcePath;
56
+ try {
57
+ sourcePath = decodeURIComponent(encodedPath);
58
+ }
59
+ catch {
60
+ return downloadUrl;
61
+ }
62
+ const variantsBucket = bucket.replace(/\.appspot\.com$/, '') + '-variants';
63
+ const variantPath = buildVariantPath(sourcePath, size);
64
+ const result = new URL(`https://${VARIANTS_HOST}/v0/b/${variantsBucket}/o/`);
65
+ result.pathname += encodeURIComponent(variantPath);
66
+ result.searchParams.set('alt', 'media');
67
+ // Preserve a cache-busting timestamp from the original URL (if present) so
68
+ // variant URLs refresh in sync with the source image.
69
+ const originalTimestamp = url.searchParams.get('timestamp');
70
+ if (originalTimestamp !== null) {
71
+ result.searchParams.set('timestamp', originalTimestamp);
72
+ }
73
+ return result.toString();
74
+ }
75
+ /**
76
+ * Derive the variant object path from the source path and size.
77
+ * e.g. "images/common/logo.png" -> "images/common/logo_128x128.webp"
78
+ * "images/brands/x/image_url" -> "images/brands/x/image_url_128x128"
79
+ */
80
+ function buildVariantPath(sourcePath, size) {
81
+ const hasExtension = hasFileExtension(sourcePath);
82
+ if (!hasExtension) {
83
+ return `${sourcePath}_${size}`;
84
+ }
85
+ const basePath = sourcePath.replace(/\.[^.]+$/, '');
86
+ return `${basePath}_${size}.webp`;
87
+ }
88
+ /**
89
+ * Determine whether the final path segment carries a file extension.
90
+ * A leading dot (e.g. ".webp" as a bare name) is treated as extensionless.
91
+ */
92
+ function hasFileExtension(sourcePath) {
93
+ const lastSegment = sourcePath.slice(sourcePath.lastIndexOf('/') + 1);
94
+ const dotIndex = lastSegment.lastIndexOf('.');
95
+ return dotIndex > 0;
96
+ }
@@ -0,0 +1,96 @@
1
+ export * from './asaanbill-identifier-helpers';
2
+ export * from './business-day-helpers';
3
+ export * from './cart-helpers';
4
+ export * from './catalog-conversion';
5
+ export * from './code-redemption-helpers';
6
+ export * from './color-helpers';
7
+ export * from './common';
8
+ export * from './crypt';
9
+ export * from './customers-helpers';
10
+ export * from './delivery-area-helpers';
11
+ export * from './delivery-helpers';
12
+ export * from './denominations-helpers';
13
+ export * from './dinein';
14
+ export * from './discount-helpers';
15
+ export * from './email-helpers';
16
+ export * from './error-helpers';
17
+ export * from './expense';
18
+ export * from './getFormFieldsDiff';
19
+ export * from './gift-card-helpers';
20
+ export * from './halfhalf-setup-helpers';
21
+ export * from './hourly-comparison-report-helpers';
22
+ export * from './hr-helpers';
23
+ export * from './hubrise-utils';
24
+ export * from './image-helpers';
25
+ export * from './image-url-helpers';
26
+ export * from './ingredients';
27
+ export * from './internal-amount-helpers';
28
+ export * from './inventory';
29
+ export * from './inventory_entries';
30
+ export * from './inventory_transactions';
31
+ export * from './item-report-helpers';
32
+ export * from './items-comparison-report-helpers';
33
+ export * from './kds-helpers';
34
+ export * from './location-helpers';
35
+ export * from './menu-helpers';
36
+ export * from './minified-catalog';
37
+ export * from './offer-apply-helpers';
38
+ export * from './offers-helpers';
39
+ export * from './operational-roles-helpers';
40
+ export * from './order-engine';
41
+ export * from './order-history';
42
+ export * from './payment-comparison-report-helpers';
43
+ export * from './payment-helpers';
44
+ export * from './pdf-generator';
45
+ export * from './platform-catalog';
46
+ export * from './platform-num';
47
+ export * from './platform-specific-tenant-shifts';
48
+ export * from './price-conversion';
49
+ export * from './printer-helpers';
50
+ export * from './public-holidays-helpers';
51
+ export * from './ratings-comparison-report-helpers';
52
+ export * from './receipt-engine';
53
+ export * from './review-helpers';
54
+ export * from './rider-tracking';
55
+ export * from './riders-report-helpers';
56
+ export * from './sales-comparison-report-helpers';
57
+ export * from './sales-comparitive-report-helpers';
58
+ export * from './sales-overview-report-helpers';
59
+ export * from './sales-summary-report-helpers';
60
+ export * from './scan-code-helpers';
61
+ export * from './shift-window-helpers';
62
+ export * from './simplified-catalog';
63
+ export * from './simplified-halfhalf';
64
+ export * from './simplified-specials';
65
+ export * from './simplified-tenant';
66
+ export * from './specials-helpers';
67
+ export * from './tenant-calendar-helpers';
68
+ export * from './tenant-cash-drawer-sessions-helpers';
69
+ export * from './tenant-cash-drawers-helpers';
70
+ export * from './tenant-cash-in-out-helpers';
71
+ export * from './tenant-day-sessions-helpers';
72
+ export * from './tenant-instore-shift-sessions-helpers';
73
+ export * from './tenant-staff-helpers';
74
+ export * from './tenant_cash_in_hand_transactions';
75
+ export * from './time-helpers';
76
+ export * from './void-items-report-helpers';
77
+ export * from './void-order-items-helpers';
78
+ export * from './voidations-summary-report-helpers';
79
+ export * from './wallet-helpers';
80
+ export * from './wallet-redemption-helpers';
81
+ export * from './warehouse-catalog-conversion';
82
+ export * from './warehouse-inventory';
83
+ export * from './warehouse-purchase-order-engine';
84
+ export * from './warehouse-purchase-order-receipt-engine';
85
+ export * from './warehouse-purchase-order-x-report-helpers';
86
+ export * from './warehouse-sale-order-engine';
87
+ export * from './warehouse-sale-order-receipt-engine';
88
+ export * from './warehouse-sale-order-x-report-helpers';
89
+ export * from './warehouse-sale-x-report-helpers';
90
+ export * from './warehouse-settings-helpers';
91
+ export * from './warehouse-void-purchase-order-items-helpers';
92
+ export * from './warehouse-void-purchase-order-items-report-helpers';
93
+ export * from './warehouse-void-sale-order-items-helpers';
94
+ export * from './warehouse-void-sale-order-items-report-helpers';
95
+ export * from './warehouse_inventory_transactions';
96
+ export * from './x-report-helpers';
@@ -0,0 +1,26 @@
1
+ import { convertDecimalToInt, convertIntToDecimal } from './price-conversion';
2
+ export function getIngredientsWithInt(ingredients) {
3
+ if (!ingredients || ingredients.length === 0)
4
+ return null;
5
+ const sortedIngredients = ingredients.map((ingredient) => ({
6
+ ...ingredient,
7
+ ...(typeof ingredient?.usage_quantity === 'number'
8
+ ? {
9
+ usage_quantity: convertDecimalToInt(ingredient.usage_quantity),
10
+ }
11
+ : {}),
12
+ }));
13
+ return sortedIngredients;
14
+ }
15
+ export function getIngredientsWithDecimal(ingredients) {
16
+ if (!ingredients)
17
+ return null;
18
+ return ingredients.map((ingredient) => ({
19
+ ...ingredient,
20
+ ...(typeof ingredient?.usage_quantity === 'number'
21
+ ? {
22
+ usage_quantity: convertIntToDecimal(ingredient.usage_quantity),
23
+ }
24
+ : {}),
25
+ }));
26
+ }
@@ -0,0 +1,49 @@
1
+ import { convertPriceFromCents, convertPriceToCents } from './price-conversion';
2
+ /**
3
+ * Converts all monetary fields on an invoice from cents to dollars.
4
+ */
5
+ export function convertInvoiceAmountsFromCents(invoice) {
6
+ return {
7
+ ...invoice,
8
+ subtotal: convertPriceFromCents(invoice.subtotal),
9
+ discount_amount: convertPriceFromCents(invoice.discount_amount),
10
+ tax_amount: convertPriceFromCents(invoice.tax_amount),
11
+ grand_total: convertPriceFromCents(invoice.grand_total),
12
+ };
13
+ }
14
+ /**
15
+ * Converts all monetary fields on an invoice from dollars to cents.
16
+ */
17
+ export function convertInvoiceAmountsToCents(invoice) {
18
+ return {
19
+ ...invoice,
20
+ subtotal: convertPriceToCents(invoice.subtotal),
21
+ discount_amount: convertPriceToCents(invoice.discount_amount),
22
+ tax_amount: convertPriceToCents(invoice.tax_amount),
23
+ grand_total: convertPriceToCents(invoice.grand_total),
24
+ };
25
+ }
26
+ /**
27
+ * Converts all subscription base amount fields on a customer from cents to dollars.
28
+ */
29
+ export function convertCustomerInvoiceAmountsFromCents(customer) {
30
+ return {
31
+ ...customer,
32
+ base_invoice_price: convertPriceFromCents(customer.base_invoice_price),
33
+ base_invoice_discount_amount: convertPriceFromCents(customer.base_invoice_discount_amount),
34
+ base_invoice_tax_amount: convertPriceFromCents(customer.base_invoice_tax_amount),
35
+ base_invoice_grand_total: convertPriceFromCents(customer.base_invoice_grand_total),
36
+ };
37
+ }
38
+ /**
39
+ * Converts all subscription base amount fields on a customer from dollars to cents.
40
+ */
41
+ export function convertCustomerInvoiceAmountsToCents(customer) {
42
+ return {
43
+ ...customer,
44
+ base_invoice_price: convertPriceToCents(customer.base_invoice_price),
45
+ base_invoice_discount_amount: convertPriceToCents(customer.base_invoice_discount_amount),
46
+ base_invoice_tax_amount: convertPriceToCents(customer.base_invoice_tax_amount),
47
+ base_invoice_grand_total: convertPriceToCents(customer.base_invoice_grand_total),
48
+ };
49
+ }
@@ -0,0 +1,123 @@
1
+ // =====================Fetch Stock===================
2
+ import { getIngredientsWithDecimal, getIngredientsWithInt } from './ingredients';
3
+ import { convertDecimalToInt, convertIntToDecimal } from './price-conversion';
4
+ // ========================================>>><<<========================================
5
+ export function getInventoryWithInt(inventory) {
6
+ return {
7
+ ...inventory,
8
+ ...(typeof inventory.threshold_quantity === 'number'
9
+ ? {
10
+ threshold_quantity: convertDecimalToInt(inventory.threshold_quantity),
11
+ }
12
+ : {}),
13
+ ...(typeof inventory.quantity_left === 'number'
14
+ ? {
15
+ quantity_left: convertDecimalToInt(inventory.quantity_left),
16
+ }
17
+ : {}),
18
+ ...(typeof inventory.unit_price === 'number'
19
+ ? {
20
+ unit_price: convertDecimalToInt(inventory.unit_price),
21
+ }
22
+ : {}),
23
+ ...(typeof inventory.remaining_stock_price === 'number'
24
+ ? {
25
+ remaining_stock_price: convertDecimalToInt(inventory.remaining_stock_price),
26
+ }
27
+ : {}),
28
+ ...(inventory.ingredients != null
29
+ ? {
30
+ ingredients: getIngredientsWithInt(inventory.ingredients),
31
+ }
32
+ : {}),
33
+ };
34
+ }
35
+ export function getInventoryWithDecimal(inventory) {
36
+ return {
37
+ ...inventory,
38
+ ...(typeof inventory.threshold_quantity === 'number'
39
+ ? {
40
+ threshold_quantity: convertIntToDecimal(inventory.threshold_quantity),
41
+ }
42
+ : {}),
43
+ ...(typeof inventory.quantity_left === 'number'
44
+ ? {
45
+ quantity_left: convertIntToDecimal(inventory.quantity_left),
46
+ }
47
+ : {}),
48
+ ...(typeof inventory.unit_price === 'number'
49
+ ? {
50
+ unit_price: convertIntToDecimal(inventory.unit_price),
51
+ }
52
+ : {}),
53
+ ...(typeof inventory.remaining_stock_price === 'number'
54
+ ? {
55
+ remaining_stock_price: convertIntToDecimal(inventory.remaining_stock_price),
56
+ }
57
+ : {}),
58
+ ...(inventory.ingredients != null
59
+ ? {
60
+ ingredients: getIngredientsWithDecimal(inventory.ingredients),
61
+ }
62
+ : {}),
63
+ };
64
+ }
65
+ export function getKitchenInventoryWithDecimal(inventory) {
66
+ return {
67
+ ...inventory,
68
+ ...(typeof inventory.threshold_quantity === 'number'
69
+ ? {
70
+ threshold_quantity: convertIntToDecimal(inventory.threshold_quantity),
71
+ }
72
+ : {}),
73
+ ...(typeof inventory.quantity_left === 'number'
74
+ ? {
75
+ quantity_left: convertIntToDecimal(inventory.quantity_left),
76
+ }
77
+ : {}),
78
+ ...(typeof inventory.previous_quantity_left === 'number'
79
+ ? {
80
+ previous_quantity_left: convertIntToDecimal(inventory.previous_quantity_left),
81
+ }
82
+ : {}),
83
+ ...(typeof inventory.quantity_added === 'number'
84
+ ? { quantity_added: convertIntToDecimal(inventory.quantity_added) }
85
+ : {}),
86
+ ...(typeof inventory.quantity_consumed === 'number'
87
+ ? { quantity_consumed: convertIntToDecimal(inventory.quantity_consumed) }
88
+ : {}),
89
+ ...(typeof inventory.quantity_wasted === 'number'
90
+ ? { quantity_wasted: convertIntToDecimal(inventory.quantity_wasted) }
91
+ : {}),
92
+ ...(typeof inventory.quantity_short === 'number'
93
+ ? { quantity_short: convertIntToDecimal(inventory.quantity_short) }
94
+ : {}),
95
+ ...(typeof inventory.variance_quantity === 'number'
96
+ ? { variance_quantity: convertIntToDecimal(inventory.variance_quantity) }
97
+ : {}),
98
+ ...(typeof inventory.transfer_quantity === 'number'
99
+ ? { transfer_quantity: convertIntToDecimal(inventory.transfer_quantity) }
100
+ : {}),
101
+ ...(typeof inventory.return_quantity === 'number'
102
+ ? { return_quantity: convertIntToDecimal(inventory.return_quantity) }
103
+ : {}),
104
+ ...(typeof inventory.new_stock_price === 'number'
105
+ ? { new_stock_price: convertIntToDecimal(inventory.new_stock_price) }
106
+ : {}),
107
+ ...(typeof inventory.previous_unit_price === 'number'
108
+ ? { previous_unit_price: convertIntToDecimal(inventory.previous_unit_price) }
109
+ : {}),
110
+ ...(typeof inventory.unit_price === 'number' ? { unit_price: convertIntToDecimal(inventory.unit_price) } : {}),
111
+ ...(typeof inventory.remaining_stock_price === 'number'
112
+ ? { remaining_stock_price: convertIntToDecimal(inventory.remaining_stock_price) }
113
+ : {}),
114
+ ...(typeof inventory.previous_remaining_stock_price === 'number'
115
+ ? { previous_remaining_stock_price: convertIntToDecimal(inventory.previous_remaining_stock_price) }
116
+ : {}),
117
+ ...(inventory.ingredients != null
118
+ ? {
119
+ ingredients: getIngredientsWithDecimal(inventory.ingredients),
120
+ }
121
+ : {}),
122
+ };
123
+ }
@@ -0,0 +1,91 @@
1
+ import { convertDecimalToInt, convertIntToDecimal } from './price-conversion';
2
+ /*
3
+ * Warehouse and tenant entries live in separate collections with duplicated item types, but the
4
+ * item payload is field-for-field identical, so the item / preparation converters are written
5
+ * once against the warehouse item shape - the two shapes are mutually assignable, so no cast is
6
+ * needed to use them from the tenant entry function.
7
+ *
8
+ * Every quantity and money value inside an entry is stored in the int domain (x100000).
9
+ */
10
+ /**
11
+ * Convert the quantities and costs on a batch ingredient map.
12
+ */
13
+ export function getPreparationWithPrice(preparation, convertToPrice) {
14
+ const converted = {};
15
+ for (const [key, value] of Object.entries(preparation)) {
16
+ converted[key] = {
17
+ ...value,
18
+ ...(typeof value.usage_quantity === 'number' ? { usage_quantity: convertToPrice(value.usage_quantity) } : {}),
19
+ ...(typeof value.waste_quantity === 'number' ? { waste_quantity: convertToPrice(value.waste_quantity) } : {}),
20
+ ...(typeof value.unit_cost === 'number' ? { unit_cost: convertToPrice(value.unit_cost) } : {}),
21
+ ...(typeof value.final_cost === 'number' ? { final_cost: convertToPrice(value.final_cost) } : {}),
22
+ ...(typeof value.waste_cost === 'number' ? { waste_cost: convertToPrice(value.waste_cost) } : {}),
23
+ };
24
+ }
25
+ return converted;
26
+ }
27
+ /**
28
+ * Convert every quantity and money field on every inventory entry item.
29
+ */
30
+ export function getInventoryEntryItemsWithPrice(items, convertToPrice) {
31
+ if (!items)
32
+ return [];
33
+ return items.map((item) => ({
34
+ ...item,
35
+ transaction_quantity: convertToPrice(item.transaction_quantity),
36
+ stock_price: item.stock_price != null ? convertToPrice(item.stock_price) : undefined,
37
+ ...(item.preparation != null ? { preparation: getPreparationWithPrice(item.preparation, convertToPrice) } : {}),
38
+ }));
39
+ }
40
+ /**
41
+ * Convert every quantity and money field on a warehouse inventory entry.
42
+ *
43
+ * - `writeable = true` -> decimal -> int domain (before sending to backend)
44
+ * - `writeable = false` -> int domain -> decimal (after receiving from backend)
45
+ */
46
+ export function getWarehouseInventoryEntryWithPrice(entry, writeable) {
47
+ const convertToPrice = writeable ? convertDecimalToInt : convertIntToDecimal;
48
+ return {
49
+ ...entry,
50
+ ...(entry.items != null
51
+ ? {
52
+ items: getInventoryEntryItemsWithPrice(entry.items, convertToPrice),
53
+ }
54
+ : {}),
55
+ ...(entry.total_stock_price != null ? { total_stock_price: convertToPrice(entry.total_stock_price) } : {}),
56
+ };
57
+ }
58
+ /**
59
+ * Convert every warehouse inventory entry in a list.
60
+ */
61
+ export function getWarehouseInventoryEntriesWithPrice(entries, writeable) {
62
+ if (!entries)
63
+ return [];
64
+ return entries.map((entry) => getWarehouseInventoryEntryWithPrice(entry, writeable));
65
+ }
66
+ /**
67
+ * Convert every quantity and money field on a tenant inventory entry.
68
+ *
69
+ * - `writeable = true` -> decimal -> int domain (before sending to backend)
70
+ * - `writeable = false` -> int domain -> decimal (after receiving from backend)
71
+ */
72
+ export function getTenantInventoryEntryWithPrice(entry, writeable) {
73
+ const convertToPrice = writeable ? convertDecimalToInt : convertIntToDecimal;
74
+ return {
75
+ ...entry,
76
+ ...(entry.items != null
77
+ ? {
78
+ items: getInventoryEntryItemsWithPrice(entry.items, convertToPrice),
79
+ }
80
+ : {}),
81
+ ...(entry.total_stock_price != null ? { total_stock_price: convertToPrice(entry.total_stock_price) } : {}),
82
+ };
83
+ }
84
+ /**
85
+ * Convert every tenant inventory entry in a list.
86
+ */
87
+ export function getTenantInventoryEntriesWithPrice(entries, writeable) {
88
+ if (!entries)
89
+ return [];
90
+ return entries.map((entry) => getTenantInventoryEntryWithPrice(entry, writeable));
91
+ }