@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,79 @@
1
+ export const WORKER_ENDPOINTS = {
2
+ // ========================>> Customer / Order <<======================= //
3
+ CREATE_DELIVERY: '/create-delivery',
4
+ UPDATE_CUSTOMER_INFO_ON_CREATE_ORDER: '/update-customer-info-on-create-order',
5
+ UPDATE_CUSTOMER_INFO_ON_CANCEL_ORDER: '/update-customer-info-on-cancel-order',
6
+ UPDATE_CUSTOMER_INFO_ON_SETTLE_ORDER: '/update-customer-info-on-settle-order',
7
+ CLEANUP_REWARDS_AND_ASSETS_ON_SETTLE_ORDER: '/cleanup-rewards-and-assets-on-settle-order',
8
+ ADD_OFFER_FINGERPRINTS_ON_SETTLE_ORDER: '/add-offer-fingerprints-on-settle-order',
9
+ RESERVE_CUSTOMER_REDEMPTIONS_FOR_ORDER: '/reserve-customer-redemptions-for-order',
10
+ RELEASE_CUSTOMER_REDEMPTIONS_FOR_ORDER: '/release-customer-redemptions-for-order',
11
+ UPDATE_CUSTOMER_REDEMPTIONS_ON_WALLET_ASSIGNMENT: '/update-customer-redemptions-on-wallet-assignment',
12
+ SEND_WA_ORDER_NOTIFICATION: '/send-wa-order-notification',
13
+ SEND_EMAIL_ORDER_NOTIFICATION: '/send-email-order-notification',
14
+ SEND_APP_ORDER_NOTIFICATION: '/send-app-order-notification',
15
+ NOTIFY_TO_RATE_ORDER: '/notify-to-rate-order',
16
+ CREATE_VOID_ORDER_ITEMS: '/create-void-order-items',
17
+ CREATE_VOID_ORDER_ITEMS_ON_OFFLINE_SYNC: '/create-void-order-items-on-offline-sync',
18
+ CANCEL_DELIVERY: '/cancel-delivery',
19
+ ALERT_UNCONFIRMED_ORDER: '/alert-unconfirmed-order',
20
+ SUBSCRIPTION_STATUS_UPDATE: '/subscription-status-update',
21
+ EMAIL_ACCOUNT_ACTIVATION_STATUS: '/email-account-activation-status',
22
+ INTERNAL_LEAD_SUBMISSION: '/internal-lead-submission',
23
+ // ========================>> Dine-In Tables <<======================= //
24
+ UPDATE_DINEIN_TABLE_ON_UPDATE_ORDER: '/update-dinein-table-on-update-order',
25
+ SYNC_DINEIN_TABLE_WITH_ORDER: '/sync-dinein-table-with-order',
26
+ POST_DINEIN_TABLE_FINGERPRINT: '/post-dinein-table-fingerprint',
27
+ UPDATE_NUM_OF_GUESTS_FOR_ORDER: '/update-num-of-guests-for-order',
28
+ UPDATE_DINEIN_TABLE_ON_CREATE_ORDER: '/update-dinein-table-on-create-order',
29
+ INCREMENT_CASH_IN_HAND: '/increment-cash-in-hand',
30
+ REMOVE_DINEIN_TABLE: '/remove-dinein-table',
31
+ // ========================>> Modifiers / Catalog <<======================= //
32
+ UPDATE_MODIFIER_NAME_IN_ITEMS: '/update-modifier-name-in-items',
33
+ ITEMS_USING_MODIFIER: '/items-using-modifier',
34
+ AUDIT_ITEM_MODIFIERS: '/audit-item-modifiers',
35
+ // ========================>> Payment (SwitchPay) <<======================= //
36
+ PROCESS_SWITCHPAY_PAYMENT_FOR_ORDER: '/process-switchpay-payment-for-order',
37
+ COMMIT_SWITCHPAY_PAYMENT_FOR_ORDER: '/commit-switchpay-payment-for-order',
38
+ SYNC_SWITCHPAY_PAYMENT_SUCCESS: '/sync-switchpay-payment-success',
39
+ SYNC_SWITCHPAY_PAYMENT_STATUS: '/sync-switchpay-payment-status',
40
+ // ========================>> Payment (AsaanBill) <<======================= //
41
+ SYNC_ASAANBILL_PAYMENT_STATUS: '/sync-asaanbill-payment-status',
42
+ REGEN_ASAANBILL_DQRC_AMOUNT: '/regen-asaanbill-dqrc-amount',
43
+ // ========================>> Payment (Stripe) <<======================= //
44
+ PROCESS_STRIPE_PAYMENT_POLLING: '/process-stripe-payment-polling',
45
+ SYNC_STRIPE_PAYMENT_SUCCESS: '/sync-stripe-payment-success',
46
+ // ========================>> Delivery / Order Status <<======================= //
47
+ UPDATE_ORDER_STATUS_ON_DELIVERY_STATUS_UPDATE: '/update-order-status-on-delivery-status-update',
48
+ // ========================>> Inventory (Order-based) <<======================= //
49
+ UPDATE_TENANT_INVENTORY_ON_CREATE_ORDER: '/update-tenant-inventory-on-create-order',
50
+ UPDATE_TENANT_INVENTORY_ON_UPDATE_ORDER: '/update-tenant-inventory-on-update-order',
51
+ UPDATE_TENANT_INVENTORY_ON_CANCEL_ORDER: '/update-tenant-inventory-on-cancel-order',
52
+ UPDATE_TENANT_INVENTORY_ON_OFFLINE_SYNC: '/update-tenant-inventory-on-offline-sync',
53
+ UPDATE_TENANT_INVENTORY_ON_SPLIT_ORDER: '/update-tenant-inventory-on-split-order',
54
+ UPDATE_TENANT_INVENTORY_ON_REVERT_SPLIT_ORDER: '/update-tenant-inventory-on-revert-split-order',
55
+ UPDATE_TENANT_INVENTORY_ON_PURCHASE_ORDER_RECEIVE: '/update-tenant-inventory-on-purchase-order-receive',
56
+ UPDATE_TENANT_INVENTORY_ON_VENDOR_RETURN_DISPATCHED: '/update-tenant-inventory-on-vendor-return-dispatched',
57
+ // ========================>> Warehouse Inventory <<======================= //
58
+ UPDATE_WAREHOUSE_INVENTORY_ON_COMPLETE_PURCHASE_ORDER: '/update-warehouse-inventory-on-complete-purchase-order',
59
+ UPDATE_WAREHOUSE_INVENTORY_ON_CANCEL_PURCHASE_ORDER: '/update-warehouse-inventory-on-cancel-purchase-order',
60
+ UPDATE_WAREHOUSE_INVENTORY_ON_CANCEL_SALE_ORDER: '/update-warehouse-inventory-on-cancel-sale-order',
61
+ UPDATE_WAREHOUSE_INVENTORY_ON_PURCHASE_ORDER_EDIT: '/update-warehouse-inventory-on-purchase-order-edit',
62
+ UPDATE_WAREHOUSE_INVENTORY_ON_RECEIPT_VALIDATED: '/update-warehouse-inventory-on-receipt-validated',
63
+ UPDATE_WAREHOUSE_INVENTORY_ON_SALE_ORDER_DELIVERY_STATUS: '/update-warehouse-inventory-on-sale-order-delivery-status',
64
+ UPDATE_WAREHOUSE_INVENTORY_ON_VENDOR_RETURN_DISPATCHED: '/update-warehouse-inventory-on-vendor-return-dispatched',
65
+ UPDATE_WAREHOUSE_LOT_SERIAL_ON_CANCEL_PURCHASE_ORDER: '/update-warehouse-lot-serial-on-cancel-purchase-order',
66
+ UPDATE_WAREHOUSE_LOT_SERIAL_ON_PURCHASE_ORDER_EDIT: '/update-warehouse-lot-serial-on-purchase-order-edit',
67
+ UPDATE_WAREHOUSE_INTERNAL_MOVEMENT_INVENTORY_ON_DELIVERED: '/update-warehouse-internal-movement-inventory-on-delivered',
68
+ // ========================>> Foodstreet <<======================= //
69
+ POSTED_FOODSTREET_ORDER: '/posted-foodstreet-order',
70
+ UPDATED_FOODSTREET_ORIGINAL_ORDER: '/updated-foodstreet-original-order',
71
+ UPDATED_FOODSTREET_SPLIT_ORDER: '/updated-foodstreet-split-order',
72
+ REOPENED_FOODSTREET_ORIGINAL_ORDER: '/reopened-foodstreet-original-order',
73
+ REOPENED_FOODSTREET_SPLIT_ORDER: '/reopened-foodstreet-split-order',
74
+ // ========================>> Activity Logs <<======================= //
75
+ POST_WAREHOUSE_ACTIVITY_LOGS: '/post-warehouse-activity-logs',
76
+ // ========================>> Shift / Business Day / Cash Drawer (compile) <<======================= //
77
+ END_INSTORE_SHIFT: '/end-instore-shift',
78
+ END_TENANT_DAY: '/end-tenant-day',
79
+ };
@@ -0,0 +1,27 @@
1
+ export * from './ANALYTICS';
2
+ export * from './API_ERRORS';
3
+ export * from './COMMON';
4
+ export * from './DELIVERY';
5
+ export * from './DIALER_ENUMS';
6
+ export * from './ENUMS';
7
+ export * from './FBR_ENUMS';
8
+ export * from './HUBRISE_ENUMS';
9
+ export * from './INTERNAL_ENUMS';
10
+ export * from './NOTIFICATIONS';
11
+ export * from './ORDER';
12
+ export * from './PRA_ENUMS';
13
+ export * from './REPORT_WEBVIEW';
14
+ export * from './RFQ_GO';
15
+ export * from './SMARTPAY_ENUMS';
16
+ export * from './SOCKET';
17
+ export * from './SRB_ENUMS';
18
+ export * from './SWITCHPAY';
19
+ export * from './TENANT_ENUMS';
20
+ export * from './TENANT_PURCHASE_ORDER';
21
+ export * from './types';
22
+ export * from './WALLET';
23
+ export * from './WAREHOUSE_ANALYTICS';
24
+ export * from './WAREHOUSE_ENUMS';
25
+ export * from './WAREHOUSE_PURCHASE_ORDER';
26
+ export * from './WEBVIEW';
27
+ export * from './WORKER_ENDPOINTS';
@@ -0,0 +1,2 @@
1
+ // NOTE: Tenant ID is not required as it is in the URL query params
2
+ export {};
@@ -0,0 +1,94 @@
1
+ import { FBR_INVOICE_TYPE_ENUM, FBR_PAYMENT_MODE_ENUM, ORDER_STATUS_ENUM } from '../../constants';
2
+ import { formatDateToDateTime, getPercentageAmount, parseNum } from '../utils';
3
+ export function convertOrderToFbrInvoice({ posId, card_gst, order, gmtOffset }) {
4
+ let PaymentMode;
5
+ if (order.gst === card_gst) {
6
+ PaymentMode = FBR_PAYMENT_MODE_ENUM.CREDIT;
7
+ }
8
+ else {
9
+ PaymentMode = FBR_PAYMENT_MODE_ENUM.CASH;
10
+ }
11
+ let InvoiceType = FBR_INVOICE_TYPE_ENUM.NEW;
12
+ if (order.order_status === ORDER_STATUS_ENUM.CANCELLED) {
13
+ InvoiceType = FBR_INVOICE_TYPE_ENUM.CREDIT;
14
+ }
15
+ const Items = [];
16
+ let TotalQuantity = 0;
17
+ const TaxRate = parseNum(order.gst ?? 0);
18
+ for (let i = 0; i < order.categories.length; i++) {
19
+ const category = order.categories[i];
20
+ for (let j = 0; j < category.items.length; j++) {
21
+ const item = category.items[j];
22
+ TotalQuantity += item.quantity;
23
+ // Exclusive of Tax and Discount
24
+ let SaleValue = item.subtotal;
25
+ const Discount = item.item_discount_details?.total_discount ?? 0;
26
+ if (Discount > 0) {
27
+ SaleValue += Discount;
28
+ }
29
+ if (order.is_gst_inclusive) {
30
+ // If GST is inclusive, then that means that the Tax is already included in the Sale Value
31
+ // However, we need to calculate the Sale Value without the Tax
32
+ SaleValue = SaleValue / (1 + TaxRate / 100);
33
+ }
34
+ let TaxCharged = getPercentageAmount(SaleValue, TaxRate);
35
+ let TotalAmount = SaleValue + TaxCharged;
36
+ TotalAmount = parseNum(TotalAmount);
37
+ TaxCharged = parseNum(TaxCharged);
38
+ SaleValue = parseNum(TotalAmount - TaxCharged);
39
+ const fbrInvoiceItem = {
40
+ ItemCode: String(item._id),
41
+ ItemName: item.name,
42
+ Quantity: parseNum(item.quantity, true),
43
+ PCTCode: '00000000', // For no PCT Codes add 00000000 as default)
44
+ TaxRate,
45
+ SaleValue,
46
+ TotalAmount,
47
+ TaxCharged,
48
+ InvoiceType,
49
+ };
50
+ Items.push(fbrInvoiceItem);
51
+ }
52
+ }
53
+ const gstAmount = order.gst_amount ?? 0;
54
+ let TotalSaleValue = order.price;
55
+ if (order.is_gst_inclusive) {
56
+ TotalSaleValue -= gstAmount;
57
+ }
58
+ let TotalBillAmount = TotalSaleValue;
59
+ let TotalTaxCharged = gstAmount;
60
+ let FurtherTaxCharged = 0;
61
+ if (order.is_service_fee_taxable) {
62
+ const serviceFeeAmount = order.service_fee_amount ?? 0;
63
+ const serviceFeeTax = getPercentageAmount(serviceFeeAmount, TaxRate);
64
+ FurtherTaxCharged += serviceFeeTax;
65
+ TotalTaxCharged -= serviceFeeTax;
66
+ }
67
+ if (order.is_surcharge_taxable) {
68
+ const surchargeAmount = order.surcharge_amount ?? 0;
69
+ const surchargeTax = getPercentageAmount(surchargeAmount, TaxRate);
70
+ FurtherTaxCharged += surchargeTax;
71
+ TotalTaxCharged -= surchargeTax;
72
+ }
73
+ TotalBillAmount += TotalTaxCharged;
74
+ TotalBillAmount += FurtherTaxCharged;
75
+ const Discount = order.total_discount_applied ?? 0;
76
+ const fbrInvoice = {
77
+ InvoiceNumber: String(order._id),
78
+ USIN: String(order._id),
79
+ POSID: parseInt(posId, 10),
80
+ DateTime: formatDateToDateTime(order.order_settled_at, gmtOffset),
81
+ PaymentMode,
82
+ InvoiceType,
83
+ BuyerName: `${order.consumer.first_name} ${order.consumer.last_name}`.trim(),
84
+ BuyerPhoneNumber: order.consumer.phone,
85
+ TotalQuantity: parseNum(TotalQuantity, true),
86
+ TotalSaleValue: parseNum(TotalSaleValue),
87
+ TotalTaxCharged: parseNum(TotalTaxCharged),
88
+ TotalBillAmount: parseNum(TotalBillAmount),
89
+ Discount: parseNum(Discount),
90
+ FurtherTax: parseNum(FurtherTaxCharged),
91
+ Items,
92
+ };
93
+ return fbrInvoice;
94
+ }
@@ -0,0 +1 @@
1
+ export * from './generate-invoice';
@@ -0,0 +1,304 @@
1
+ import { CURRENCY_CODE_ENUM } from '../../constants';
2
+ import { HUBRISE_VARIANTS_NAMES, HUBRISE_VARIANTS_TO_PLATFORMS, } from '../../constants/HUBRISE_ENUMS';
3
+ import { convertDateToHubriseDate, convertDaysIndexToHubriseDOW, convertEposmaticPriceToHubrisePrice, convertMsToHubriseTime, } from '../utils/hubrise-utils';
4
+ // ==============================>>><<<============================== //
5
+ export function getHubriseVariants(variants) {
6
+ const hubriseVariants = [];
7
+ for (let i = 0; i < variants.length; i++) {
8
+ const platform = variants[i];
9
+ const hubriseVariant = {
10
+ ref: platform,
11
+ name: HUBRISE_VARIANTS_NAMES[platform],
12
+ };
13
+ hubriseVariants.push(hubriseVariant);
14
+ }
15
+ return hubriseVariants;
16
+ }
17
+ // ==============================>>><<<============================== //
18
+ export function convertEposmaticCategoriesToHubriseCategories(categories) {
19
+ const hubriseCategories = [];
20
+ for (let i = 0; i < categories.length; i++) {
21
+ const category = categories[i];
22
+ if (!category.active)
23
+ continue;
24
+ const hubriseCategory = {
25
+ ref: category._id,
26
+ name: category.name,
27
+ description: category.subtitle,
28
+ // image_ids: [], // TODO: Add image_ids later
29
+ };
30
+ hubriseCategories.push(hubriseCategory);
31
+ }
32
+ return hubriseCategories;
33
+ }
34
+ // ==============================>>><<<============================== //
35
+ export function getAllModifierIdsForVariant({ modifiers, tenant_id, variant, }) {
36
+ const modifierIds = [];
37
+ const platform = HUBRISE_VARIANTS_TO_PLATFORMS[variant];
38
+ for (let i = 0; i < modifiers.length; i++) {
39
+ const modifier = modifiers[i];
40
+ for (let j = 0; j < modifier.options.length; j++) {
41
+ const option = modifier.options[j];
42
+ if (option.excluded_platforms.includes(platform))
43
+ continue;
44
+ if (option.modifiers != null) {
45
+ const subModifierIds = getAllModifierIdsForVariant({
46
+ modifiers: option.modifiers,
47
+ tenant_id,
48
+ variant,
49
+ });
50
+ modifierIds.push(...subModifierIds);
51
+ }
52
+ }
53
+ modifierIds.push(modifier._id);
54
+ }
55
+ return modifierIds;
56
+ }
57
+ // ==============================>>><<<============================== //
58
+ export function getHubriseSkusRestrictionsForItem({ item, variant, special_hours, tenant_id, }) {
59
+ const platform = HUBRISE_VARIANTS_TO_PLATFORMS[variant];
60
+ let dow;
61
+ let start_time;
62
+ let end_time;
63
+ let start_date;
64
+ let end_date;
65
+ if (special_hours != null && special_hours.length > 0) {
66
+ const special_hour = special_hours.find((special_hour) => !special_hour.excluded_platforms.includes(platform));
67
+ if (special_hour != null) {
68
+ dow = convertDaysIndexToHubriseDOW(special_hour.days_index);
69
+ start_date = special_hour.start_date != null ? convertDateToHubriseDate(special_hour.start_date) : undefined;
70
+ end_date = special_hour.end_date != null ? convertDateToHubriseDate(special_hour.end_date) : undefined;
71
+ start_time = special_hour.start_time != null ? convertMsToHubriseTime(special_hour.start_time) : undefined;
72
+ end_time = special_hour.end_time != null ? convertMsToHubriseTime(special_hour.end_time) : undefined;
73
+ }
74
+ }
75
+ const restrictions = {
76
+ enabled: item.active && !item.sold_out.includes(tenant_id),
77
+ variant_refs: [variant],
78
+ dow,
79
+ start_time,
80
+ end_time,
81
+ start_date,
82
+ end_date,
83
+ // service_types?: string[];
84
+ // service_type_refs?: string[];
85
+ // min_order_amount?: string;
86
+ // max_per_order?: number;
87
+ // max_per_customer?: number;
88
+ };
89
+ return restrictions;
90
+ }
91
+ // ==============================>>><<<============================== //
92
+ export function getHubriseProductSkusForItem({ item, tenant_id, currency_code, variants, }) {
93
+ const hubriseProductSkus = [];
94
+ for (let i = 0; i < variants.length; i++) {
95
+ const variant = variants[i];
96
+ const platform = HUBRISE_VARIANTS_TO_PLATFORMS[variant];
97
+ if (!item.included_platforms.includes(platform))
98
+ continue;
99
+ // This is to make item available depending on availability
100
+ const restrictions = getHubriseSkusRestrictionsForItem({
101
+ item,
102
+ special_hours: item.item_special_hours,
103
+ variant,
104
+ tenant_id,
105
+ });
106
+ const option_list_refs = item.modifiers != null && item.modifiers.length > 0
107
+ ? getAllModifierIdsForVariant({
108
+ modifiers: item.modifiers,
109
+ tenant_id,
110
+ variant,
111
+ })
112
+ : undefined;
113
+ const basePrice = convertEposmaticPriceToHubrisePrice({
114
+ price: item.price,
115
+ discount_amount: item.discount_amount,
116
+ platform,
117
+ currency_code,
118
+ });
119
+ const price_overrides = getHubrisePriceOverrides({
120
+ price: item.price,
121
+ variant,
122
+ special_hours: item.item_special_hours,
123
+ currency_code,
124
+ discount_amount: item.discount_amount,
125
+ });
126
+ hubriseProductSkus.push({
127
+ // ref: item._id, // Ref already exists in product
128
+ // name: item.name, // Name already exists in product
129
+ restrictions,
130
+ price: basePrice, // Money
131
+ price_overrides,
132
+ option_list_refs,
133
+ });
134
+ }
135
+ return hubriseProductSkus;
136
+ }
137
+ // ==============================>>><<<============================== //
138
+ export function convertEposmaticItemsToHubriseProducts({ items, tenant_id, currency_code, variants, platforms, }) {
139
+ const hubriseProducts = [];
140
+ for (let i = 0; i < items.length; i++) {
141
+ const item = items[i];
142
+ // if (!item.active || item.sold_out.includes(tenant_id)) continue;
143
+ if (!item.included_platforms.some((platform) => platforms.includes(platform)))
144
+ continue;
145
+ // const skus = [];
146
+ const hubriseProduct = {
147
+ ref: item._id,
148
+ category_ref: item.category_id,
149
+ name: item.name,
150
+ description: item.description,
151
+ // image_ids // TODO: Add image_ids later
152
+ tags: item.keywords.concat(item.dietary_preferences).slice(0, 20),
153
+ skus: getHubriseProductSkusForItem({
154
+ item,
155
+ tenant_id,
156
+ currency_code,
157
+ variants,
158
+ }),
159
+ };
160
+ hubriseProducts.push(hubriseProduct);
161
+ }
162
+ return hubriseProducts;
163
+ }
164
+ // ==============================>>><<<============================== //
165
+ function getHubrisePriceOverrides({ price, discount_amount, variant, special_hours, currency_code, }) {
166
+ const hubrisePriceOverrides = [];
167
+ const platform = HUBRISE_VARIANTS_TO_PLATFORMS[variant];
168
+ const defaultPrice = convertEposmaticPriceToHubrisePrice({
169
+ price,
170
+ discount_amount,
171
+ platform,
172
+ currency_code,
173
+ });
174
+ // 1st
175
+ if (special_hours != null) {
176
+ for (let i = 0; i < special_hours.length; i++) {
177
+ const special_hour = special_hours[i];
178
+ if (special_hour.excluded_platforms.includes(platform))
179
+ continue;
180
+ const price = convertEposmaticPriceToHubrisePrice({
181
+ discount_amount: special_hour.discount_amount,
182
+ platform,
183
+ price: special_hour.price,
184
+ currency_code,
185
+ }) || defaultPrice;
186
+ const start_date = special_hour.start_date != null ? convertDateToHubriseDate(special_hour.start_date) : undefined;
187
+ const end_date = special_hour.end_date != null ? convertDateToHubriseDate(special_hour.end_date) : undefined;
188
+ const start_time = special_hour.start_time != null ? convertMsToHubriseTime(special_hour.start_time) : undefined;
189
+ const end_time = special_hour.end_time != null ? convertMsToHubriseTime(special_hour.end_time) : undefined;
190
+ const dow = convertDaysIndexToHubriseDOW(special_hour.days_index);
191
+ const hubrisePriceOverride = {
192
+ variant_refs: [variant],
193
+ price,
194
+ start_date,
195
+ end_date,
196
+ start_time,
197
+ end_time,
198
+ dow,
199
+ };
200
+ hubrisePriceOverrides.push(hubrisePriceOverride);
201
+ }
202
+ }
203
+ return hubrisePriceOverrides;
204
+ }
205
+ // ==============================>>><<<============================== //
206
+ function getHubriseOptionListOptions(modifier, variant, tenant_id, currency_code, hubriseOptionsList) {
207
+ const options = [];
208
+ const platform = HUBRISE_VARIANTS_TO_PLATFORMS[variant];
209
+ for (let j = 0; j < modifier.options.length; j++) {
210
+ const option = modifier.options[j];
211
+ if (!option.active || option.sold_out.includes(tenant_id) || option.excluded_platforms.includes(platform)) {
212
+ continue;
213
+ }
214
+ // NOTE: base price would be the price of dine-in
215
+ const basePrice = convertEposmaticPriceToHubrisePrice({
216
+ platform,
217
+ price: option.price,
218
+ currency_code,
219
+ });
220
+ const price_overrides = getHubrisePriceOverrides({
221
+ price: option.price,
222
+ variant,
223
+ special_hours: option.item_modifier_option_special_hours,
224
+ currency_code,
225
+ });
226
+ const hubriseOption = {
227
+ ref: option._id,
228
+ name: option.name,
229
+ price: basePrice,
230
+ price_overrides,
231
+ default: option.default,
232
+ };
233
+ options.push(hubriseOption);
234
+ if (option.modifiers != null) {
235
+ addModifiersToOptionsList(option.name, variant, tenant_id, option.modifiers, currency_code, hubriseOptionsList);
236
+ }
237
+ }
238
+ return options;
239
+ }
240
+ // ==============================>>><<<============================== //
241
+ function addModifiersToOptionsList(name, variant, tenant_id, modifiers, currency_code, hubriseOptionsList) {
242
+ for (let i = 0; i < modifiers.length; i++) {
243
+ const modifier = modifiers[i];
244
+ if (!modifier.active || modifier.sold_out.includes(tenant_id))
245
+ continue;
246
+ const options = getHubriseOptionListOptions(modifier, variant, tenant_id, currency_code, hubriseOptionsList);
247
+ const hubriseOptions = {
248
+ ref: modifier._id,
249
+ name,
250
+ min_selections: modifier.min_num_options ?? 0,
251
+ max_selections: modifier.max_num_options,
252
+ options,
253
+ };
254
+ hubriseOptionsList.push(hubriseOptions);
255
+ }
256
+ }
257
+ export function convertEposmaticModifiersToHubriseOptionsList({ items, variants, tenant_id, currency_code, }) {
258
+ const hubriseOptionsList = [];
259
+ for (let i = 0; i < items.length; i++) {
260
+ const item = items[i];
261
+ if (!item.active || item.sold_out.includes(tenant_id))
262
+ continue;
263
+ const modifiers = item.modifiers;
264
+ if (modifiers == null || modifiers.length === 0)
265
+ continue;
266
+ for (let j = 0; j < variants.length; j++) {
267
+ const variant = variants[j];
268
+ const platform = HUBRISE_VARIANTS_TO_PLATFORMS[variant];
269
+ if (!item.included_platforms.includes(platform))
270
+ continue;
271
+ addModifiersToOptionsList(item.name, variant, tenant_id, modifiers, currency_code, hubriseOptionsList);
272
+ }
273
+ }
274
+ return hubriseOptionsList;
275
+ }
276
+ export function convertEposmaticCatalogToHubriseCatalog({ settings, categories, items, variants, }) {
277
+ const name = settings.name;
278
+ const data = {};
279
+ // ==============================>>><<<============================== //
280
+ const allVariants = Array.from(new Set(variants));
281
+ const platforms = Array.from(new Set(allVariants.map((variant) => HUBRISE_VARIANTS_TO_PLATFORMS[variant])));
282
+ data['variants'] = getHubriseVariants(variants);
283
+ data['categories'] = convertEposmaticCategoriesToHubriseCategories(categories);
284
+ data['products'] = convertEposmaticItemsToHubriseProducts({
285
+ items,
286
+ tenant_id: settings._id,
287
+ currency_code: CURRENCY_CODE_ENUM.USD,
288
+ variants: allVariants,
289
+ platforms,
290
+ });
291
+ data['option_lists'] = convertEposmaticModifiersToHubriseOptionsList({
292
+ items,
293
+ variants: allVariants,
294
+ tenant_id: settings._id,
295
+ currency_code: CURRENCY_CODE_ENUM.USD,
296
+ });
297
+ // ==============================>>><<<============================== //
298
+ const response = {
299
+ name,
300
+ data,
301
+ };
302
+ return response;
303
+ }
304
+ // ==============================>>><<<============================== //
@@ -0,0 +1 @@
1
+ export * from './hubrise-catalog';
@@ -0,0 +1,9 @@
1
+ export * from './fbr';
2
+ export * from './hubrise';
3
+ export * from './kpra';
4
+ export * from './order';
5
+ export * from './pra';
6
+ export * from './srb';
7
+ export * from './store';
8
+ export * from './types';
9
+ export * from './utils';
@@ -0,0 +1,26 @@
1
+ import { formatDateToDateTime, parseNum } from '../utils';
2
+ export function convertOrderToKPRAInvoice({ order, gmtOffset }) {
3
+ const taxRate = parseNum(order.gst ?? 0);
4
+ const gstAmount = order.gst_amount ?? 0;
5
+ let totalBillAmount = order.price;
6
+ if (!order.exclude_discount_from_gst) {
7
+ const totalDiscount = order.total_discount_applied ?? 0;
8
+ totalBillAmount -= totalDiscount;
9
+ }
10
+ if (order.is_gst_inclusive) {
11
+ totalBillAmount -= gstAmount;
12
+ }
13
+ if (order.is_service_fee_taxable) {
14
+ totalBillAmount += order.service_fee_amount ?? 0;
15
+ }
16
+ if (order.is_surcharge_taxable) {
17
+ totalBillAmount += order.surcharge_amount ?? 0;
18
+ }
19
+ const kpraInvoice = {
20
+ date: formatDateToDateTime(order.order_settled_at, gmtOffset),
21
+ invoice_no: String(order._id),
22
+ amount: parseNum(totalBillAmount),
23
+ sts: parseNum(gstAmount),
24
+ };
25
+ return kpraInvoice;
26
+ }
@@ -0,0 +1 @@
1
+ export * from './generate-invoice';