@shophost/rest-api 2.0.30 → 2.0.32

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 (352) hide show
  1. package/package.json +18 -13
  2. package/scripts/minify.mjs +123 -0
  3. package/src/app.js +1 -53
  4. package/src/core/auth/auth.schema.js +1 -41
  5. package/src/core/auth/auth.util.js +1 -44
  6. package/src/core/auth/better-auth.lib.js +1 -100
  7. package/src/core/auth/generate-password-hash.util.d.ts +0 -3
  8. package/src/core/auth/generate-password-hash.util.js +1 -30
  9. package/src/core/auth/headers.schema.js +1 -22
  10. package/src/core/auth/user.schema.js +1 -30
  11. package/src/core/db/__generated__/client/browser.d.ts +0 -128
  12. package/src/core/db/__generated__/client/browser.js +1 -18
  13. package/src/core/db/__generated__/client/client.d.ts +0 -143
  14. package/src/core/db/__generated__/client/client.js +1 -35
  15. package/src/core/db/__generated__/client/commonInputTypes.js +1 -11
  16. package/src/core/db/__generated__/client/enums.js +1 -200
  17. package/src/core/db/__generated__/client/internal/class.d.ts +0 -343
  18. package/src/core/db/__generated__/client/internal/class.js +1 -55
  19. package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +0 -234
  20. package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -541
  21. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.d.ts +0 -15
  22. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +1 -512
  23. package/src/core/db/__generated__/client/models/Account.d.ts +0 -628
  24. package/src/core/db/__generated__/client/models/Account.js +1 -2
  25. package/src/core/db/__generated__/client/models/Address.d.ts +0 -701
  26. package/src/core/db/__generated__/client/models/Address.js +1 -2
  27. package/src/core/db/__generated__/client/models/Campaign.d.ts +0 -638
  28. package/src/core/db/__generated__/client/models/Campaign.js +1 -2
  29. package/src/core/db/__generated__/client/models/ClosingTimes.d.ts +0 -634
  30. package/src/core/db/__generated__/client/models/ClosingTimes.js +1 -2
  31. package/src/core/db/__generated__/client/models/File.d.ts +0 -752
  32. package/src/core/db/__generated__/client/models/File.js +1 -2
  33. package/src/core/db/__generated__/client/models/Invitation.d.ts +0 -628
  34. package/src/core/db/__generated__/client/models/Invitation.js +1 -2
  35. package/src/core/db/__generated__/client/models/LegalEntity.d.ts +0 -652
  36. package/src/core/db/__generated__/client/models/LegalEntity.js +1 -2
  37. package/src/core/db/__generated__/client/models/Manufacturer.d.ts +0 -679
  38. package/src/core/db/__generated__/client/models/Manufacturer.js +1 -2
  39. package/src/core/db/__generated__/client/models/ManufacturerTranslation.d.ts +0 -628
  40. package/src/core/db/__generated__/client/models/ManufacturerTranslation.js +1 -2
  41. package/src/core/db/__generated__/client/models/Member.d.ts +0 -628
  42. package/src/core/db/__generated__/client/models/Member.js +1 -2
  43. package/src/core/db/__generated__/client/models/Modifier.d.ts +0 -662
  44. package/src/core/db/__generated__/client/models/Modifier.js +1 -2
  45. package/src/core/db/__generated__/client/models/ModifierGroup.d.ts +0 -686
  46. package/src/core/db/__generated__/client/models/ModifierGroup.js +1 -2
  47. package/src/core/db/__generated__/client/models/ModifierGroupTranslation.d.ts +0 -628
  48. package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js +1 -2
  49. package/src/core/db/__generated__/client/models/OpeningTimes.d.ts +0 -634
  50. package/src/core/db/__generated__/client/models/OpeningTimes.js +1 -2
  51. package/src/core/db/__generated__/client/models/Order.d.ts +0 -700
  52. package/src/core/db/__generated__/client/models/Order.js +1 -2
  53. package/src/core/db/__generated__/client/models/OrderItem.d.ts +0 -686
  54. package/src/core/db/__generated__/client/models/OrderItem.js +1 -2
  55. package/src/core/db/__generated__/client/models/OrderItemTranslation.d.ts +0 -628
  56. package/src/core/db/__generated__/client/models/OrderItemTranslation.js +1 -2
  57. package/src/core/db/__generated__/client/models/Organization.d.ts +0 -811
  58. package/src/core/db/__generated__/client/models/Organization.js +1 -2
  59. package/src/core/db/__generated__/client/models/OrganizationConfiguration.d.ts +0 -676
  60. package/src/core/db/__generated__/client/models/OrganizationConfiguration.js +1 -2
  61. package/src/core/db/__generated__/client/models/Payment.d.ts +0 -668
  62. package/src/core/db/__generated__/client/models/Payment.js +1 -2
  63. package/src/core/db/__generated__/client/models/PaymentSession.d.ts +0 -638
  64. package/src/core/db/__generated__/client/models/PaymentSession.js +1 -2
  65. package/src/core/db/__generated__/client/models/Product.d.ts +0 -746
  66. package/src/core/db/__generated__/client/models/Product.js +1 -2
  67. package/src/core/db/__generated__/client/models/ProductCategory.d.ts +0 -689
  68. package/src/core/db/__generated__/client/models/ProductCategory.js +1 -2
  69. package/src/core/db/__generated__/client/models/ProductCategoryTranslation.d.ts +0 -628
  70. package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js +1 -2
  71. package/src/core/db/__generated__/client/models/ProductSnapshot.d.ts +0 -664
  72. package/src/core/db/__generated__/client/models/ProductSnapshot.js +1 -2
  73. package/src/core/db/__generated__/client/models/ProductTranslation.d.ts +0 -628
  74. package/src/core/db/__generated__/client/models/ProductTranslation.js +1 -2
  75. package/src/core/db/__generated__/client/models/Reservation.d.ts +0 -650
  76. package/src/core/db/__generated__/client/models/Reservation.js +1 -2
  77. package/src/core/db/__generated__/client/models/Session.d.ts +0 -628
  78. package/src/core/db/__generated__/client/models/Session.js +1 -2
  79. package/src/core/db/__generated__/client/models/ShippingMethod.d.ts +0 -679
  80. package/src/core/db/__generated__/client/models/ShippingMethod.js +1 -2
  81. package/src/core/db/__generated__/client/models/ShippingZone.d.ts +0 -638
  82. package/src/core/db/__generated__/client/models/ShippingZone.js +1 -2
  83. package/src/core/db/__generated__/client/models/User.d.ts +0 -736
  84. package/src/core/db/__generated__/client/models/User.js +1 -2
  85. package/src/core/db/__generated__/client/models/Verification.d.ts +0 -592
  86. package/src/core/db/__generated__/client/models/Verification.js +1 -2
  87. package/src/core/db/__generated__/client/models.js +1 -2
  88. package/src/core/db/index.js +1 -2
  89. package/src/core/exceptions/http-exception.js +1 -9
  90. package/src/core/hono/hono.js +1 -123
  91. package/src/core/lib/prisma.d.ts +9 -1
  92. package/src/core/lib/prisma.js +1 -11
  93. package/src/core/logging/pino.js +1 -5
  94. package/src/core/notifications/email.service.d.ts +0 -15
  95. package/src/core/notifications/email.service.js +1 -116
  96. package/src/core/openapi/openapi.lib.js +1 -26
  97. package/src/core/types/google-maps.types.js +1 -2
  98. package/src/core/utils/currency.util.js +1 -11
  99. package/src/core/utils/env.util.js +1 -8
  100. package/src/core/utils/object.util.d.ts +0 -10
  101. package/src/core/utils/object.util.js +1 -39
  102. package/src/core/utils/translations.util.js +0 -2
  103. package/src/core/utils/zod.util.d.ts +0 -12
  104. package/src/core/utils/zod.util.js +1 -85
  105. package/src/db.js +1 -3
  106. package/src/features/access/access.handler.js +1 -91
  107. package/src/features/access/access.route.js +1 -220
  108. package/src/features/access/access.schema.js +1 -108
  109. package/src/features/access/access.service.js +1 -294
  110. package/src/features/cart/cart.handler.js +1 -17
  111. package/src/features/cart/cart.route.js +1 -32
  112. package/src/features/cart/cart.schema.js +1 -39
  113. package/src/features/cart/cart.service.d.ts +0 -7
  114. package/src/features/cart/cart.service.js +1 -97
  115. package/src/features/cart/cart.util.js +1 -76
  116. package/src/features/file/file.handler.js +1 -23
  117. package/src/features/file/file.route.js +1 -34
  118. package/src/features/file/file.schema.js +1 -77
  119. package/src/features/file/file.service.d.ts +0 -6
  120. package/src/features/file/file.service.js +1 -66
  121. package/src/features/health/health.handler.js +1 -10
  122. package/src/features/health/health.route.js +1 -25
  123. package/src/features/index.js +1 -16
  124. package/src/features/location/location.handler.js +1 -25
  125. package/src/features/location/location.route.js +1 -56
  126. package/src/features/location/location.schema.js +1 -50
  127. package/src/features/location/location.service.d.ts +0 -3
  128. package/src/features/location/location.service.js +1 -141
  129. package/src/features/manufacturer/manufacturer.handler.js +1 -53
  130. package/src/features/manufacturer/manufacturer.route.js +1 -97
  131. package/src/features/manufacturer/manufacturer.schema.js +1 -125
  132. package/src/features/manufacturer/manufacturer.service.d.ts +0 -19
  133. package/src/features/manufacturer/manufacturer.service.js +1 -190
  134. package/src/features/order/emails/order-confirmation.email.js +1 -229
  135. package/src/features/order/emails/order-notification.email.js +1 -229
  136. package/src/features/order/fulfilment.schema.js +1 -3
  137. package/src/features/order/order.handler.js +1 -54
  138. package/src/features/order/order.route.js +1 -111
  139. package/src/features/order/order.schema.js +1 -158
  140. package/src/features/order/order.service.d.ts +0 -15
  141. package/src/features/order/order.service.js +1 -306
  142. package/src/features/order/recipient.schema.js +1 -38
  143. package/src/features/organization/legal-entity.schema.js +1 -83
  144. package/src/features/organization/organization-configuration.schema.js +1 -115
  145. package/src/features/organization/organization.handler.js +1 -48
  146. package/src/features/organization/organization.route.js +1 -84
  147. package/src/features/organization/organization.schema.js +1 -64
  148. package/src/features/organization/organization.service.d.ts +0 -15
  149. package/src/features/organization/organization.service.js +1 -334
  150. package/src/features/payment/payment.handler.js +1 -16
  151. package/src/features/payment/payment.route.js +1 -22
  152. package/src/features/payment/payment.schema.js +1 -46
  153. package/src/features/payment/payment.service.js +1 -100
  154. package/src/features/payment/stripe.service.js +1 -164
  155. package/src/features/product/product-modifier.schema.js +1 -84
  156. package/src/features/product/product.handler.js +1 -87
  157. package/src/features/product/product.route.js +1 -179
  158. package/src/features/product/product.schema.js +1 -143
  159. package/src/features/product/product.service.d.ts +0 -25
  160. package/src/features/product/product.service.js +1 -440
  161. package/src/features/product-category/product-category.handler.js +1 -59
  162. package/src/features/product-category/product-category.route.js +1 -139
  163. package/src/features/product-category/product-category.schema.js +1 -86
  164. package/src/features/product-category/product-category.service.d.ts +0 -22
  165. package/src/features/product-category/product-category.service.js +1 -220
  166. package/src/features/reservation/emails/reservation-cancellation.email.js +1 -82
  167. package/src/features/reservation/emails/reservation-confirmation.email.js +1 -82
  168. package/src/features/reservation/emails/reservation-notification.email.js +1 -93
  169. package/src/features/reservation/reservation.handler.js +1 -65
  170. package/src/features/reservation/reservation.route.js +1 -167
  171. package/src/features/reservation/reservation.schema.js +1 -51
  172. package/src/features/reservation/reservation.service.d.ts +0 -18
  173. package/src/features/reservation/reservation.service.js +1 -231
  174. package/src/features/shipping/shipping.handler.js +1 -32
  175. package/src/features/shipping/shipping.route.js +1 -51
  176. package/src/features/shipping/shipping.service.d.ts +0 -7
  177. package/src/features/shipping/shipping.service.js +1 -96
  178. package/src/features/shipping-method/shipping-method.handler.js +1 -60
  179. package/src/features/shipping-method/shipping-method.route.js +1 -144
  180. package/src/features/shipping-method/shipping-method.schema.js +1 -48
  181. package/src/features/shipping-method/shipping-method.service.d.ts +0 -25
  182. package/src/features/shipping-method/shipping-method.service.js +1 -229
  183. package/src/features/shipping-method/shipping-zone.schema.js +1 -31
  184. package/src/features/webhook/webhook.handler.js +1 -50
  185. package/src/features/webhook/webhook.route.js +1 -33
  186. package/src/index.js +1 -6
  187. package/src/integrations/next.js +1 -82
  188. package/src/schemas/address.schema.d.ts +0 -8
  189. package/src/schemas/address.schema.js +1 -112
  190. package/src/schemas/currency.schema.d.ts +0 -42
  191. package/src/schemas/currency.schema.js +1 -118
  192. package/src/schemas/error.schema.js +1 -12
  193. package/src/schemas/index.js +1 -29
  194. package/src/schemas/locales.schema.js +1 -238
  195. package/src/schemas/number.schema.js +1 -29
  196. package/src/schemas/pagination.schema.js +1 -54
  197. package/src/schemas/params.schema.js +1 -20
  198. package/src/schemas/queries.schema.js +1 -6
  199. package/src/test/global-setup.d.ts +1 -0
  200. package/src/test/global-setup.js +1 -0
  201. package/src/test/integration/api-fixtures.d.ts +4 -16
  202. package/src/test/integration/api-fixtures.js +1 -225
  203. package/src/test/integration/seed.d.ts +81 -0
  204. package/src/test/integration/seed.js +1 -0
  205. package/src/test/integration/test-helpers.d.ts +107 -924
  206. package/src/test/integration/test-helpers.js +1 -1100
  207. package/src/test/setup-test-env.d.ts +1 -1
  208. package/src/test/setup-test-env.js +1 -29
  209. package/src/app.js.map +0 -1
  210. package/src/core/auth/auth.schema.js.map +0 -1
  211. package/src/core/auth/auth.util.js.map +0 -1
  212. package/src/core/auth/better-auth.lib.js.map +0 -1
  213. package/src/core/auth/generate-password-hash.util.js.map +0 -1
  214. package/src/core/auth/headers.schema.js.map +0 -1
  215. package/src/core/auth/user.schema.js.map +0 -1
  216. package/src/core/db/__generated__/client/browser.js.map +0 -1
  217. package/src/core/db/__generated__/client/client.js.map +0 -1
  218. package/src/core/db/__generated__/client/commonInputTypes.js.map +0 -1
  219. package/src/core/db/__generated__/client/enums.js.map +0 -1
  220. package/src/core/db/__generated__/client/internal/class.js.map +0 -1
  221. package/src/core/db/__generated__/client/internal/prismaNamespace.js.map +0 -1
  222. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js.map +0 -1
  223. package/src/core/db/__generated__/client/models/Account.js.map +0 -1
  224. package/src/core/db/__generated__/client/models/Address.js.map +0 -1
  225. package/src/core/db/__generated__/client/models/Campaign.js.map +0 -1
  226. package/src/core/db/__generated__/client/models/ClosingTimes.js.map +0 -1
  227. package/src/core/db/__generated__/client/models/File.js.map +0 -1
  228. package/src/core/db/__generated__/client/models/Invitation.js.map +0 -1
  229. package/src/core/db/__generated__/client/models/LegalEntity.js.map +0 -1
  230. package/src/core/db/__generated__/client/models/Manufacturer.js.map +0 -1
  231. package/src/core/db/__generated__/client/models/ManufacturerTranslation.js.map +0 -1
  232. package/src/core/db/__generated__/client/models/Member.js.map +0 -1
  233. package/src/core/db/__generated__/client/models/Modifier.js.map +0 -1
  234. package/src/core/db/__generated__/client/models/ModifierGroup.js.map +0 -1
  235. package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js.map +0 -1
  236. package/src/core/db/__generated__/client/models/OpeningTimes.js.map +0 -1
  237. package/src/core/db/__generated__/client/models/Order.js.map +0 -1
  238. package/src/core/db/__generated__/client/models/OrderItem.js.map +0 -1
  239. package/src/core/db/__generated__/client/models/OrderItemTranslation.js.map +0 -1
  240. package/src/core/db/__generated__/client/models/Organization.js.map +0 -1
  241. package/src/core/db/__generated__/client/models/OrganizationConfiguration.js.map +0 -1
  242. package/src/core/db/__generated__/client/models/Payment.js.map +0 -1
  243. package/src/core/db/__generated__/client/models/PaymentSession.js.map +0 -1
  244. package/src/core/db/__generated__/client/models/Product.js.map +0 -1
  245. package/src/core/db/__generated__/client/models/ProductCategory.js.map +0 -1
  246. package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js.map +0 -1
  247. package/src/core/db/__generated__/client/models/ProductSnapshot.js.map +0 -1
  248. package/src/core/db/__generated__/client/models/ProductTranslation.js.map +0 -1
  249. package/src/core/db/__generated__/client/models/Reservation.js.map +0 -1
  250. package/src/core/db/__generated__/client/models/Session.js.map +0 -1
  251. package/src/core/db/__generated__/client/models/ShippingMethod.js.map +0 -1
  252. package/src/core/db/__generated__/client/models/ShippingZone.js.map +0 -1
  253. package/src/core/db/__generated__/client/models/User.js.map +0 -1
  254. package/src/core/db/__generated__/client/models/Verification.js.map +0 -1
  255. package/src/core/db/__generated__/client/models.js.map +0 -1
  256. package/src/core/db/index.js.map +0 -1
  257. package/src/core/exceptions/http-exception.js.map +0 -1
  258. package/src/core/hono/hono.js.map +0 -1
  259. package/src/core/lib/prisma.js.map +0 -1
  260. package/src/core/logging/pino.js.map +0 -1
  261. package/src/core/notifications/email.service.js.map +0 -1
  262. package/src/core/openapi/openapi.lib.js.map +0 -1
  263. package/src/core/types/google-maps.types.js.map +0 -1
  264. package/src/core/utils/currency.util.js.map +0 -1
  265. package/src/core/utils/env.util.js.map +0 -1
  266. package/src/core/utils/object.util.js.map +0 -1
  267. package/src/core/utils/translations.util.js.map +0 -1
  268. package/src/core/utils/zod.util.js.map +0 -1
  269. package/src/db.js.map +0 -1
  270. package/src/features/access/access.handler.js.map +0 -1
  271. package/src/features/access/access.route.js.map +0 -1
  272. package/src/features/access/access.schema.js.map +0 -1
  273. package/src/features/access/access.service.js.map +0 -1
  274. package/src/features/cart/cart.handler.js.map +0 -1
  275. package/src/features/cart/cart.route.js.map +0 -1
  276. package/src/features/cart/cart.schema.js.map +0 -1
  277. package/src/features/cart/cart.service.js.map +0 -1
  278. package/src/features/cart/cart.util.js.map +0 -1
  279. package/src/features/file/file.handler.js.map +0 -1
  280. package/src/features/file/file.route.js.map +0 -1
  281. package/src/features/file/file.schema.js.map +0 -1
  282. package/src/features/file/file.service.js.map +0 -1
  283. package/src/features/health/health.handler.js.map +0 -1
  284. package/src/features/health/health.route.js.map +0 -1
  285. package/src/features/index.js.map +0 -1
  286. package/src/features/location/location.handler.js.map +0 -1
  287. package/src/features/location/location.route.js.map +0 -1
  288. package/src/features/location/location.schema.js.map +0 -1
  289. package/src/features/location/location.service.js.map +0 -1
  290. package/src/features/manufacturer/manufacturer.handler.js.map +0 -1
  291. package/src/features/manufacturer/manufacturer.route.js.map +0 -1
  292. package/src/features/manufacturer/manufacturer.schema.js.map +0 -1
  293. package/src/features/manufacturer/manufacturer.service.js.map +0 -1
  294. package/src/features/order/emails/order-confirmation.email.js.map +0 -1
  295. package/src/features/order/emails/order-notification.email.js.map +0 -1
  296. package/src/features/order/fulfilment.schema.js.map +0 -1
  297. package/src/features/order/order.handler.js.map +0 -1
  298. package/src/features/order/order.route.js.map +0 -1
  299. package/src/features/order/order.schema.js.map +0 -1
  300. package/src/features/order/order.service.js.map +0 -1
  301. package/src/features/order/recipient.schema.js.map +0 -1
  302. package/src/features/organization/legal-entity.schema.js.map +0 -1
  303. package/src/features/organization/organization-configuration.schema.js.map +0 -1
  304. package/src/features/organization/organization.handler.js.map +0 -1
  305. package/src/features/organization/organization.route.js.map +0 -1
  306. package/src/features/organization/organization.schema.js.map +0 -1
  307. package/src/features/organization/organization.service.js.map +0 -1
  308. package/src/features/payment/payment.handler.js.map +0 -1
  309. package/src/features/payment/payment.route.js.map +0 -1
  310. package/src/features/payment/payment.schema.js.map +0 -1
  311. package/src/features/payment/payment.service.js.map +0 -1
  312. package/src/features/payment/stripe.service.js.map +0 -1
  313. package/src/features/product/product-modifier.schema.js.map +0 -1
  314. package/src/features/product/product.handler.js.map +0 -1
  315. package/src/features/product/product.route.js.map +0 -1
  316. package/src/features/product/product.schema.js.map +0 -1
  317. package/src/features/product/product.service.js.map +0 -1
  318. package/src/features/product-category/product-category.handler.js.map +0 -1
  319. package/src/features/product-category/product-category.route.js.map +0 -1
  320. package/src/features/product-category/product-category.schema.js.map +0 -1
  321. package/src/features/product-category/product-category.service.js.map +0 -1
  322. package/src/features/reservation/emails/reservation-cancellation.email.js.map +0 -1
  323. package/src/features/reservation/emails/reservation-confirmation.email.js.map +0 -1
  324. package/src/features/reservation/emails/reservation-notification.email.js.map +0 -1
  325. package/src/features/reservation/reservation.handler.js.map +0 -1
  326. package/src/features/reservation/reservation.route.js.map +0 -1
  327. package/src/features/reservation/reservation.schema.js.map +0 -1
  328. package/src/features/reservation/reservation.service.js.map +0 -1
  329. package/src/features/shipping/shipping.handler.js.map +0 -1
  330. package/src/features/shipping/shipping.route.js.map +0 -1
  331. package/src/features/shipping/shipping.service.js.map +0 -1
  332. package/src/features/shipping-method/shipping-method.handler.js.map +0 -1
  333. package/src/features/shipping-method/shipping-method.route.js.map +0 -1
  334. package/src/features/shipping-method/shipping-method.schema.js.map +0 -1
  335. package/src/features/shipping-method/shipping-method.service.js.map +0 -1
  336. package/src/features/shipping-method/shipping-zone.schema.js.map +0 -1
  337. package/src/features/webhook/webhook.handler.js.map +0 -1
  338. package/src/features/webhook/webhook.route.js.map +0 -1
  339. package/src/index.js.map +0 -1
  340. package/src/integrations/next.js.map +0 -1
  341. package/src/schemas/address.schema.js.map +0 -1
  342. package/src/schemas/currency.schema.js.map +0 -1
  343. package/src/schemas/error.schema.js.map +0 -1
  344. package/src/schemas/index.js.map +0 -1
  345. package/src/schemas/locales.schema.js.map +0 -1
  346. package/src/schemas/number.schema.js.map +0 -1
  347. package/src/schemas/pagination.schema.js.map +0 -1
  348. package/src/schemas/params.schema.js.map +0 -1
  349. package/src/schemas/queries.schema.js.map +0 -1
  350. package/src/test/integration/api-fixtures.js.map +0 -1
  351. package/src/test/integration/test-helpers.js.map +0 -1
  352. package/src/test/setup-test-env.js.map +0 -1
@@ -1,229 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Body, Column, Container, Head, Heading, Hr, Html, Img, Link, Preview, Row, Section, Tailwind, Text, } from "@react-email/components";
3
- const formatPrice = (price, currency = "PLN", locale = "en-US") => {
4
- return new Intl.NumberFormat(locale, {
5
- style: "currency",
6
- currency,
7
- }).format(price);
8
- };
9
- const OrderConfirmationEmail = ({ user, organization, order, }) => {
10
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
11
- const previewText = `This is your receipt from ${organization.name}`;
12
- const formattedDate = new Date().toLocaleDateString("en-GB", {
13
- day: "2-digit",
14
- month: "2-digit",
15
- year: "numeric",
16
- });
17
- // Extract data from order.payment safely
18
- const shippingCost = ((_a = order.payment) === null || _a === void 0 ? void 0 : _a.shipping) || 0;
19
- const discount = ((_b = order.payment) === null || _b === void 0 ? void 0 : _b.discount) || 0;
20
- const total = ((_c = order.payment) === null || _c === void 0 ? void 0 : _c.total) || 0;
21
- const trackingUrl = `https://${organization.configuration.hostname}/account/orders/${order.id}`;
22
- return (_jsxs(Html, { children: [_jsx(Head, {}), _jsx(Preview, { children: previewText }), _jsx(Tailwind, { children: _jsxs(Body, { className: "bg-gray-50 font-sans", children: [_jsxs(Container, { className: "bg-gray-50 p-6 max-w-[600px]", children: [_jsx(Section, { className: "mb-6", children: _jsxs(Row, { children: [_jsx(Column, { className: "w-[80%]", children: _jsx(Img, { alt: "React Email logo", height: "100", src: (_d = organization.logoFile) === null || _d === void 0 ? void 0 : _d.url, className: "rounded-lg" }) }), _jsx(Column, { align: "right", children: _jsxs(Row, { align: "right", children: [_jsx(Column, { children: _jsx(Link, { href: "https://www.instagram.com/madrasbistro/", children: _jsx(Img, { alt: "Instagram", className: "mx-[4px]", height: "36", src: "https://react.email/static/instagram-logo.png", width: "36" }) }) }), _jsx(Column, { children: _jsx(Link, { href: "https://www.facebook.com/madrasBistro/", children: _jsx(Img, { alt: "Facebook", className: "mx-[4px]", height: "36", src: "https://react.email/static/facebook-logo.png", width: "36" }) }) })] }) })] }) }), _jsxs(Section, { children: [_jsxs(Heading, { className: "text-3xl font-bold text-gray-800 mb-0", children: ["Hi ", user.firstname, ","] }), _jsx(Text, { className: "text-gray-600 mb-2 text-lg", children: "Your order has been received and is being processed." })] }), _jsx(Section, { className: "mb-0", children: _jsx(Link, { href: trackingUrl, className: "bg-gray-900 text-sm rounded-md text-white font-medium py-2 px-5 text-center inline-block my-4", children: "Track Your Order" }) })] }), _jsxs(Container, { className: "mx-auto max-w-[600px] rounded-xl bg-white px-6", children: [_jsx(Section, { className: "mb-6", children: _jsxs(Row, { children: [_jsxs(Column, { className: "w-[60%]", children: [_jsx(Text, { className: "text-gray-500 mb-0", children: "Shipping details" }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: [(_e = order.shippingAddress) === null || _e === void 0 ? void 0 : _e.firstname, " ", (_f = order.shippingAddress) === null || _f === void 0 ? void 0 : _f.lastname] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: [(_g = order.shippingAddress) === null || _g === void 0 ? void 0 : _g.addressLineOne, " ", ((_h = order.shippingAddress) === null || _h === void 0 ? void 0 : _h.doorNumber) &&
23
- ` / ${(_j = order.shippingAddress) === null || _j === void 0 ? void 0 : _j.doorNumber}`, _jsx("br", {}), (_k = order.shippingAddress) === null || _k === void 0 ? void 0 : _k.city, " ", (_l = order.shippingAddress) === null || _l === void 0 ? void 0 : _l.zipCode] }), _jsx(Text, { className: "text-gray-500 mb-0", children: "Phone" }), _jsx(Text, { className: "font-semibold text-gray-800 my-0", children: (_m = order.shippingAddress) === null || _m === void 0 ? void 0 : _m.phone })] }), _jsx(Column, { className: "w-[40%] p-0 mt-0", align: "right", valign: "top", children: _jsx(Text, { className: "text-gray-500 mb-0 pt-1", children: formattedDate }) })] }) }), _jsx(Text, { className: "text-gray-500 mb-0", children: "Order Summary" }), _jsx(Hr, { className: "border-gray-200 mb-0" }), _jsx(Section, { children: order.items.map((item, index) => {
24
- var _a, _b;
25
- // Safely cast item to include our extended fields
26
- const extendedItem = item;
27
- return (_jsx("table", { width: "100%", cellPadding: 0, cellSpacing: 0, border: 0, className: index === order.items.length - 1 ? "mb-0" : "mb-4", children: _jsxs("tr", { children: [_jsxs("td", { valign: "top", children: [_jsxs(Text, { className: "font-semibold mb-0", children: [((_a = extendedItem.translations[0]) === null || _a === void 0 ? void 0 : _a.title) || "Product", " (", ((_b = extendedItem.translations[0]) === null || _b === void 0 ? void 0 : _b.subtitle) || "", ")"] }), _jsxs(Text, { className: "text-gray-600 mb-0 mt-0", children: ["Quantity: ", extendedItem.quantity] })] }), _jsx("td", { align: "right", valign: "top", children: _jsx(Text, { className: "font-semibold", children: formatPrice(extendedItem.unitPrice * extendedItem.quantity, organization.configuration.defaultCurrency, organization.configuration.defaultLocale) }) })] }) }, index));
28
- }) }), _jsx(Hr, { className: "border-gray-200 mt-4" }), _jsx(Section, { children: _jsxs("table", { width: "100%", cellPadding: 0, cellSpacing: 0, border: 0, children: [_jsxs("tr", { children: [_jsx("td", { children: _jsx(Text, { className: "text-gray-700", children: "Delivery fee" }) }), _jsx("td", { align: "right", children: _jsx(Text, { className: "text-gray-700", children: formatPrice(shippingCost, organization.configuration.defaultCurrency, organization.configuration.defaultLocale) }) })] }), discount > 0 && (_jsxs("tr", { children: [_jsx("td", { children: _jsx(Text, { className: "text-gray-700", children: "Campaign" }) }), _jsx("td", { align: "right", children: _jsxs(Text, { className: "text-gray-700", children: ["-", formatPrice(discount, organization.configuration.defaultCurrency, organization.configuration.defaultLocale)] }) })] }))] }) }), _jsx(Hr, { className: "border-gray-200" }), _jsx(Section, { className: "mb-6", children: _jsx("table", { width: "100%", cellPadding: 0, cellSpacing: 0, border: 0, children: _jsxs("tr", { children: [_jsx("td", { children: _jsx(Text, { className: "text-xl font-bold mb-0", children: "Total:" }) }), _jsx("td", { align: "right", children: _jsx(Text, { className: "text-xl font-bold mb-0", children: formatPrice(total, organization.configuration.defaultCurrency, organization.configuration.defaultLocale) }) })] }) }) })] }), _jsx(Section, { className: "text-center bg-gray-50 py-5", children: _jsxs("table", { className: "w-full", children: [_jsx("tr", { className: "w-full", children: _jsx("td", { align: "center", children: ((_o = organization.logoFile) === null || _o === void 0 ? void 0 : _o.url) && (_jsx(Img, { alt: "React Email logo", height: "100", src: organization.logoFile.url, className: "rounded-lg" })) }) }), _jsx("tr", { className: "w-full", children: _jsxs("td", { align: "center", children: [_jsx(Text, { className: "my-[8px] text-[16px] font-semibold text-xl pt-2 text-gray-900", children: organization.name }), _jsxs(Text, { className: "my-[8px] text-[16px] leading-[24px] text-gray-500", children: [(_p = organization.address) === null || _p === void 0 ? void 0 : _p.addressLineOne, ",", " ", (_q = organization.address) === null || _q === void 0 ? void 0 : _q.zipCode, " ", (_r = organization.address) === null || _r === void 0 ? void 0 : _r.city] }), _jsx(Text, { className: "mb-0 mt-[4px] text-[16px] leading-[24px] text-gray-500", children: organization.phone })] }) }), _jsx("tr", { children: _jsx("td", { align: "center", children: _jsxs(Row, { className: "table-cell h-[44px] w-[56px] align-bottom pt-5", children: [_jsx(Column, { className: "pr-[8px]", children: _jsx(Link, { href: "https://www.facebook.com/madrasBistro/", children: _jsx(Img, { alt: "Facebook", height: "36", src: "https://react.email/static/facebook-logo.png", width: "36" }) }) }), _jsx(Column, { children: _jsx(Link, { href: "https://www.instagram.com/madrasbistro/", children: _jsx(Img, { alt: "Instagram", height: "36", src: "https://react.email/static/instagram-logo.png", width: "36" }) }) })] }) }) })] }) })] }) })] }));
29
- };
30
- const previewProps = {
31
- user: {
32
- id: "VD0OJ52f0mdAnm5YePP6BAW6hdbaCjAJ",
33
- name: "Abhishek Shaji",
34
- email: "kontakt@abhishek.pl",
35
- emailVerified: true,
36
- image: "https://lh3.googleusercontent.com/a/ACg8ocKbkCAMTNvMizjXNxcm1aYtBiWnYpCYmU-7aE2Ft_M_uiHheZ5f=s96-c",
37
- createdAt: "2025-03-22T22:54:40.260Z",
38
- updatedAt: "2025-03-22T22:54:40.260Z",
39
- firstname: "Abhishek",
40
- lastname: "Shaji",
41
- },
42
- order: {
43
- id: "cm94wbpbm0000itx1iv9k2mqr",
44
- referenceId: "PH6LD6",
45
- token: "VAE9TX",
46
- expiresAt: "2025-04-07T00:20:09.689Z",
47
- items: [
48
- {
49
- translations: [
50
- {
51
- locale: "en",
52
- title: "Masala Dosa",
53
- subtitle: "Spice Level: Medium",
54
- },
55
- {
56
- locale: "pl",
57
- title: "null",
58
- subtitle: "Spice Level: Medium",
59
- },
60
- ],
61
- rawData: {
62
- productId: "cm8kudyqq0006ityduhq0yveu",
63
- quantity: 6,
64
- modifierGroups: [
65
- {
66
- id: "cm8kuonhv0002ji032ji4bzmc",
67
- modifiers: [
68
- {
69
- id: "cm8kudyqq000ditydq25s2n2e",
70
- quantity: 1,
71
- },
72
- ],
73
- },
74
- ],
75
- },
76
- unitPrice: 39,
77
- image: {
78
- id: "cm8kuee0m0000l703ocs7snfb",
79
- url: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/Masala%20Dosa-b0tr9uWZqmBTPMUx4x0fzqkM6z5eCw.png",
80
- mimeType: "image/png",
81
- size: 1429845,
82
- filename: "Masala Dosa.png",
83
- },
84
- totalPrice: 234,
85
- quantity: 6,
86
- productSnapshotId: "cm8kuopty0006ji035n7w5iby",
87
- },
88
- {
89
- translations: [
90
- {
91
- locale: "en",
92
- title: "Masala Dosa",
93
- subtitle: "Spice Level: Medium",
94
- },
95
- {
96
- locale: "pl",
97
- title: "null",
98
- subtitle: "Spice Level: Medium",
99
- },
100
- ],
101
- rawData: {
102
- productId: "cm8kudyqq0006ityduhq0yveu",
103
- quantity: 6,
104
- modifierGroups: [
105
- {
106
- id: "cm8kuonhv0002ji032ji4bzmc",
107
- modifiers: [
108
- {
109
- id: "cm8kudyqq000ditydq25s2n2e",
110
- quantity: 1,
111
- },
112
- ],
113
- },
114
- ],
115
- },
116
- unitPrice: 39,
117
- image: {
118
- id: "cm8kuee0m0000l703ocs7snfb",
119
- url: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/Masala%20Dosa-b0tr9uWZqmBTPMUx4x0fzqkM6z5eCw.png",
120
- mimeType: "image/png",
121
- size: 1429845,
122
- filename: "Masala Dosa.png",
123
- },
124
- totalPrice: 234,
125
- quantity: 6,
126
- productSnapshotId: "cm8kuopty0006ji035n7w5iby",
127
- },
128
- ],
129
- shippingMethod: {
130
- id: "cm8kuqmkd000iitydar4a1poy",
131
- title: "Express Delivery",
132
- providerName: "Wolt Courier",
133
- requireDateOfDelivery: true,
134
- shippingZones: [
135
- {
136
- id: "cm8kuqmkd000jitydpdvck2th",
137
- title: "Zone 1",
138
- distanceUpto: 7,
139
- price: 1,
140
- minimumOrderAmount: 60,
141
- eta: "90min",
142
- },
143
- ],
144
- createdAt: "2025-03-22T23:40:23.101Z",
145
- updatedAt: "2025-03-22T23:40:35.319Z",
146
- },
147
- acceptedAt: null,
148
- dispatchedAt: null,
149
- readyForDispatchAt: null,
150
- completedAt: null,
151
- cancelledAt: null,
152
- shippingAddress: {
153
- id: "cm94wbpbm0007itx1akuqh77n",
154
- firstname: "Klaudia",
155
- lastname: "Smoter",
156
- phone: "+48570135862",
157
- addressLineOne: "Stanisława Lema 28",
158
- doorNumber: "54",
159
- addressLineTwo: null,
160
- zipCode: "31-571",
161
- city: "Kraków",
162
- country: "PL",
163
- placeId: "ChIJrQfdh9VaFkcRIvg8O2PqnWM",
164
- deliveryInstructions: "4th floor - Maho",
165
- },
166
- fulfilmentMethod: "delivery",
167
- currency: "PLN",
168
- payment: {
169
- id: "cm94wbpbm0008itx1thsnj7ui",
170
- method: "blik",
171
- provider: "stripe",
172
- status: "succeeded",
173
- shipping: 1,
174
- subtotal: 234,
175
- total: 235,
176
- discount: 0,
177
- currency: "PLN",
178
- },
179
- status: "pending",
180
- },
181
- organization: {
182
- id: "cm8kthfdq0001lg03b59mdy7b",
183
- name: "Madras Bistro",
184
- phone: "+48570135862",
185
- email: "contact@madrasbistro.pl",
186
- createdAt: "2025-03-22T23:05:14.271Z",
187
- legalEntityId: null,
188
- address: {
189
- id: "cm8kthfdr0002lg0350ijialt",
190
- firstname: null,
191
- lastname: null,
192
- phone: null,
193
- addressLineOne: "Plac Bohaterów Getta 2",
194
- doorNumber: null,
195
- addressLineTwo: "3",
196
- zipCode: "33-332",
197
- city: "Kraków",
198
- country: "PL",
199
- placeId: "ChIJf-nsRkRbFkcR21gtObFSSSA",
200
- deliveryInstructions: null,
201
- },
202
- configuration: {
203
- id: "cm8kthfdr0003lg03ghgs262n",
204
- hostname: "null",
205
- countriesShipping: ["us"],
206
- stripeAccountId: "null",
207
- enableHostCheckout: false,
208
- enableHostTracking: false,
209
- isAcceptingOrders: false,
210
- defaultLocale: "en",
211
- supportedLocales: ["en", "pl"],
212
- defaultCurrency: "PLN",
213
- createdAt: "2025-03-22T23:05:14.271Z",
214
- },
215
- logo: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",
216
- logoFile: {
217
- id: "cm8ktmu890005lg0356gwclfk",
218
- url: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",
219
- mimeType: "image/png",
220
- size: 1652289,
221
- filename: "logo.png",
222
- },
223
- },
224
- };
225
- // Fixed the TypeScript error by using proper type assertion
226
- OrderConfirmationEmail.PreviewProps = previewProps;
227
- export default OrderConfirmationEmail;
228
- export { OrderConfirmationEmail };
229
- //# sourceMappingURL=order-confirmation.email.js.map
1
+ import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Body as t,Column as a,Container as l,Head as r,Heading as n,Hr as d,Html as s,Img as c,Link as o,Preview as m,Row as h,Section as u,Tailwind as p,Text as g}from"@react-email/components";const b=(e,i="PLN",t="en-US")=>new Intl.NumberFormat(t,{style:"currency",currency:i}).format(e),y=({user:y,organization:f,order:x})=>{var v,N,w,k,q,A,P,L,M,S,z,C,j,T,I,D;const F=`This is your receipt from ${f.name}`,O=(new Date).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}),Z=(null===(v=x.payment)||void 0===v?void 0:v.shipping)||0,B=(null===(N=x.payment)||void 0===N?void 0:N.discount)||0,R=(null===(w=x.payment)||void 0===w?void 0:w.total)||0,W=`https://${f.configuration.hostname}/account/orders/${x.id}`;return i(s,{children:[e(r,{}),e(m,{children:F}),e(p,{children:i(t,{className:"bg-gray-50 font-sans",children:[i(l,{className:"bg-gray-50 p-6 max-w-[600px]",children:[e(u,{className:"mb-6",children:i(h,{children:[e(a,{className:"w-[80%]",children:e(c,{alt:"React Email logo",height:"100",src:null===(k=f.logoFile)||void 0===k?void 0:k.url,className:"rounded-lg"})}),e(a,{align:"right",children:i(h,{align:"right",children:[e(a,{children:e(o,{href:"https://www.instagram.com/madrasbistro/",children:e(c,{alt:"Instagram",className:"mx-[4px]",height:"36",src:"https://react.email/static/instagram-logo.png",width:"36"})})}),e(a,{children:e(o,{href:"https://www.facebook.com/madrasBistro/",children:e(c,{alt:"Facebook",className:"mx-[4px]",height:"36",src:"https://react.email/static/facebook-logo.png",width:"36"})})})]})})]})}),i(u,{children:[i(n,{className:"text-3xl font-bold text-gray-800 mb-0",children:["Hi ",y.firstname,","]}),e(g,{className:"text-gray-600 mb-2 text-lg",children:"Your order has been received and is being processed."})]}),e(u,{className:"mb-0",children:e(o,{href:W,className:"bg-gray-900 text-sm rounded-md text-white font-medium py-2 px-5 text-center inline-block my-4",children:"Track Your Order"})})]}),i(l,{className:"mx-auto max-w-[600px] rounded-xl bg-white px-6",children:[e(u,{className:"mb-6",children:i(h,{children:[i(a,{className:"w-[60%]",children:[e(g,{className:"text-gray-500 mb-0",children:"Shipping details"}),i(g,{className:"font-semibold text-gray-800 my-0",children:[null===(q=x.shippingAddress)||void 0===q?void 0:q.firstname," ",null===(A=x.shippingAddress)||void 0===A?void 0:A.lastname]}),i(g,{className:"font-semibold text-gray-800 my-0",children:[null===(P=x.shippingAddress)||void 0===P?void 0:P.addressLineOne," ",(null===(L=x.shippingAddress)||void 0===L?void 0:L.doorNumber)&&` / ${null===(M=x.shippingAddress)||void 0===M?void 0:M.doorNumber}`,e("br",{}),null===(S=x.shippingAddress)||void 0===S?void 0:S.city," ",null===(z=x.shippingAddress)||void 0===z?void 0:z.zipCode]}),e(g,{className:"text-gray-500 mb-0",children:"Phone"}),e(g,{className:"font-semibold text-gray-800 my-0",children:null===(C=x.shippingAddress)||void 0===C?void 0:C.phone})]}),e(a,{className:"w-[40%] p-0 mt-0",align:"right",valign:"top",children:e(g,{className:"text-gray-500 mb-0 pt-1",children:O})})]})}),e(g,{className:"text-gray-500 mb-0",children:"Order Summary"}),e(d,{className:"border-gray-200 mb-0"}),e(u,{children:x.items.map((t,a)=>{var l,r;const n=t;return e("table",{width:"100%",cellPadding:0,cellSpacing:0,border:0,className:a===x.items.length-1?"mb-0":"mb-4",children:i("tr",{children:[i("td",{valign:"top",children:[i(g,{className:"font-semibold mb-0",children:[(null===(l=n.translations[0])||void 0===l?void 0:l.title)||"Product"," (",(null===(r=n.translations[0])||void 0===r?void 0:r.subtitle)||"",")"]}),i(g,{className:"text-gray-600 mb-0 mt-0",children:["Quantity: ",n.quantity]})]}),e("td",{align:"right",valign:"top",children:e(g,{className:"font-semibold",children:b(n.unitPrice*n.quantity,f.configuration.defaultCurrency,f.configuration.defaultLocale)})})]})},a)})}),e(d,{className:"border-gray-200 mt-4"}),e(u,{children:i("table",{width:"100%",cellPadding:0,cellSpacing:0,border:0,children:[i("tr",{children:[e("td",{children:e(g,{className:"text-gray-700",children:"Delivery fee"})}),e("td",{align:"right",children:e(g,{className:"text-gray-700",children:b(Z,f.configuration.defaultCurrency,f.configuration.defaultLocale)})})]}),B>0&&i("tr",{children:[e("td",{children:e(g,{className:"text-gray-700",children:"Campaign"})}),e("td",{align:"right",children:i(g,{className:"text-gray-700",children:["-",b(B,f.configuration.defaultCurrency,f.configuration.defaultLocale)]})})]})]})}),e(d,{className:"border-gray-200"}),e(u,{className:"mb-6",children:e("table",{width:"100%",cellPadding:0,cellSpacing:0,border:0,children:i("tr",{children:[e("td",{children:e(g,{className:"text-xl font-bold mb-0",children:"Total:"})}),e("td",{align:"right",children:e(g,{className:"text-xl font-bold mb-0",children:b(R,f.configuration.defaultCurrency,f.configuration.defaultLocale)})})]})})})]}),e(u,{className:"text-center bg-gray-50 py-5",children:i("table",{className:"w-full",children:[e("tr",{className:"w-full",children:e("td",{align:"center",children:(null===(j=f.logoFile)||void 0===j?void 0:j.url)&&e(c,{alt:"React Email logo",height:"100",src:f.logoFile.url,className:"rounded-lg"})})}),e("tr",{className:"w-full",children:i("td",{align:"center",children:[e(g,{className:"my-[8px] text-[16px] font-semibold text-xl pt-2 text-gray-900",children:f.name}),i(g,{className:"my-[8px] text-[16px] leading-[24px] text-gray-500",children:[null===(T=f.address)||void 0===T?void 0:T.addressLineOne,","," ",null===(I=f.address)||void 0===I?void 0:I.zipCode," ",null===(D=f.address)||void 0===D?void 0:D.city]}),e(g,{className:"mb-0 mt-[4px] text-[16px] leading-[24px] text-gray-500",children:f.phone})]})}),e("tr",{children:e("td",{align:"center",children:i(h,{className:"table-cell h-[44px] w-[56px] align-bottom pt-5",children:[e(a,{className:"pr-[8px]",children:e(o,{href:"https://www.facebook.com/madrasBistro/",children:e(c,{alt:"Facebook",height:"36",src:"https://react.email/static/facebook-logo.png",width:"36"})})}),e(a,{children:e(o,{href:"https://www.instagram.com/madrasbistro/",children:e(c,{alt:"Instagram",height:"36",src:"https://react.email/static/instagram-logo.png",width:"36"})})})]})})})]})})]})})]})};y.PreviewProps={user:{id:"VD0OJ52f0mdAnm5YePP6BAW6hdbaCjAJ",name:"Abhishek Shaji",email:"kontakt@abhishek.pl",emailVerified:!0,image:"https://lh3.googleusercontent.com/a/ACg8ocKbkCAMTNvMizjXNxcm1aYtBiWnYpCYmU-7aE2Ft_M_uiHheZ5f=s96-c",createdAt:"2025-03-22T22:54:40.260Z",updatedAt:"2025-03-22T22:54:40.260Z",firstname:"Abhishek",lastname:"Shaji"},order:{id:"cm94wbpbm0000itx1iv9k2mqr",referenceId:"PH6LD6",token:"VAE9TX",expiresAt:"2025-04-07T00:20:09.689Z",items:[{translations:[{locale:"en",title:"Masala Dosa",subtitle:"Spice Level: Medium"},{locale:"pl",title:"null",subtitle:"Spice Level: Medium"}],rawData:{productId:"cm8kudyqq0006ityduhq0yveu",quantity:6,modifierGroups:[{id:"cm8kuonhv0002ji032ji4bzmc",modifiers:[{id:"cm8kudyqq000ditydq25s2n2e",quantity:1}]}]},unitPrice:39,image:{id:"cm8kuee0m0000l703ocs7snfb",url:"https://z3liuyatqnepss3d.public.blob.vercel-storage.com/Masala%20Dosa-b0tr9uWZqmBTPMUx4x0fzqkM6z5eCw.png",mimeType:"image/png",size:1429845,filename:"Masala Dosa.png"},totalPrice:234,quantity:6,productSnapshotId:"cm8kuopty0006ji035n7w5iby"},{translations:[{locale:"en",title:"Masala Dosa",subtitle:"Spice Level: Medium"},{locale:"pl",title:"null",subtitle:"Spice Level: Medium"}],rawData:{productId:"cm8kudyqq0006ityduhq0yveu",quantity:6,modifierGroups:[{id:"cm8kuonhv0002ji032ji4bzmc",modifiers:[{id:"cm8kudyqq000ditydq25s2n2e",quantity:1}]}]},unitPrice:39,image:{id:"cm8kuee0m0000l703ocs7snfb",url:"https://z3liuyatqnepss3d.public.blob.vercel-storage.com/Masala%20Dosa-b0tr9uWZqmBTPMUx4x0fzqkM6z5eCw.png",mimeType:"image/png",size:1429845,filename:"Masala Dosa.png"},totalPrice:234,quantity:6,productSnapshotId:"cm8kuopty0006ji035n7w5iby"}],shippingMethod:{id:"cm8kuqmkd000iitydar4a1poy",title:"Express Delivery",providerName:"Wolt Courier",requireDateOfDelivery:!0,shippingZones:[{id:"cm8kuqmkd000jitydpdvck2th",title:"Zone 1",distanceUpto:7,price:1,minimumOrderAmount:60,eta:"90min"}],createdAt:"2025-03-22T23:40:23.101Z",updatedAt:"2025-03-22T23:40:35.319Z"},acceptedAt:null,dispatchedAt:null,readyForDispatchAt:null,completedAt:null,cancelledAt:null,shippingAddress:{id:"cm94wbpbm0007itx1akuqh77n",firstname:"Klaudia",lastname:"Smoter",phone:"+48570135862",addressLineOne:"Stanisława Lema 28",doorNumber:"54",addressLineTwo:null,zipCode:"31-571",city:"Kraków",country:"PL",placeId:"ChIJrQfdh9VaFkcRIvg8O2PqnWM",deliveryInstructions:"4th floor - Maho"},fulfilmentMethod:"delivery",currency:"PLN",payment:{id:"cm94wbpbm0008itx1thsnj7ui",method:"blik",provider:"stripe",status:"succeeded",shipping:1,subtotal:234,total:235,discount:0,currency:"PLN"},status:"pending"},organization:{id:"cm8kthfdq0001lg03b59mdy7b",name:"Madras Bistro",phone:"+48570135862",email:"contact@madrasbistro.pl",createdAt:"2025-03-22T23:05:14.271Z",legalEntityId:null,address:{id:"cm8kthfdr0002lg0350ijialt",firstname:null,lastname:null,phone:null,addressLineOne:"Plac Bohaterów Getta 2",doorNumber:null,addressLineTwo:"3",zipCode:"33-332",city:"Kraków",country:"PL",placeId:"ChIJf-nsRkRbFkcR21gtObFSSSA",deliveryInstructions:null},configuration:{id:"cm8kthfdr0003lg03ghgs262n",hostname:"null",countriesShipping:["us"],stripeAccountId:"null",enableHostCheckout:!1,enableHostTracking:!1,isAcceptingOrders:!1,defaultLocale:"en",supportedLocales:["en","pl"],defaultCurrency:"PLN",createdAt:"2025-03-22T23:05:14.271Z"},logo:"https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",logoFile:{id:"cm8ktmu890005lg0356gwclfk",url:"https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",mimeType:"image/png",size:1652289,filename:"logo.png"}}};export default y;export{y as OrderConfirmationEmail};
@@ -1,229 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Body, Column, Container, Head, Heading, Hr, Html, Img, Link, Preview, Row, Section, Tailwind, Text, } from "@react-email/components";
3
- const formatPrice = (price, currency = "PLN", locale = "en-US") => {
4
- return new Intl.NumberFormat(locale, {
5
- style: "currency",
6
- currency,
7
- }).format(price);
8
- };
9
- const OrderNotificationEmail = ({ user, organization, order, }) => {
10
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
11
- const previewText = `New order #${order.referenceId} received`;
12
- const formattedDate = new Date().toLocaleDateString("en-GB", {
13
- day: "2-digit",
14
- month: "2-digit",
15
- year: "numeric",
16
- });
17
- // Extract data from order.payment safely
18
- const shippingCost = ((_a = order.payment) === null || _a === void 0 ? void 0 : _a.shipping) || 0;
19
- const discount = ((_b = order.payment) === null || _b === void 0 ? void 0 : _b.discount) || 0;
20
- const total = ((_c = order.payment) === null || _c === void 0 ? void 0 : _c.total) || 0;
21
- const ordersUrl = `https://${organization.configuration.hostname}/admin/orders/${order.id}`;
22
- return (_jsxs(Html, { children: [_jsx(Head, {}), _jsx(Preview, { children: previewText }), _jsx(Tailwind, { children: _jsxs(Body, { className: "bg-gray-50 font-sans", children: [_jsxs(Container, { className: "bg-gray-50 p-6 max-w-[600px]", children: [_jsx(Section, { className: "mb-6", children: _jsxs(Row, { children: [_jsx(Column, { className: "w-[80%]", children: _jsx(Img, { alt: `${organization.name} logo`, height: "100", src: (_d = organization.logoFile) === null || _d === void 0 ? void 0 : _d.url, className: "rounded-lg" }) }), _jsx(Column, { align: "right", children: _jsxs(Row, { align: "right", children: [_jsx(Column, { children: _jsx(Link, { href: "https://www.instagram.com/madrasbistro/", children: _jsx(Img, { alt: "Instagram", className: "mx-[4px]", height: "36", src: "https://react.email/static/instagram-logo.png", width: "36" }) }) }), _jsx(Column, { children: _jsx(Link, { href: "https://www.facebook.com/madrasBistro/", children: _jsx(Img, { alt: "Facebook", className: "mx-[4px]", height: "36", src: "https://react.email/static/facebook-logo.png", width: "36" }) }) })] }) })] }) }), _jsxs(Section, { children: [_jsx(Heading, { className: "text-3xl font-bold text-gray-800 mb-0", children: "You have received a new order" }), _jsxs(Text, { className: "text-gray-600 mb-2 text-lg", children: ["Order #", order.referenceId, " has been placed and is waiting for your action."] })] }), _jsx(Section, { className: "mb-0", children: _jsx(Link, { href: ordersUrl, className: "bg-gray-900 text-sm rounded-md text-white font-medium py-2 px-5 text-center inline-block my-4", children: "View Order Details" }) })] }), _jsxs(Container, { className: "mx-auto max-w-[600px] rounded-xl bg-white px-6", children: [_jsx(Section, { className: "mb-6", children: _jsxs(Row, { children: [_jsxs(Column, { className: "w-[60%]", children: [_jsx(Text, { className: "text-gray-500 mb-0", children: "Customer Information" }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: [user.firstname, " ", user.lastname] }), _jsx(Text, { className: "font-semibold text-gray-800 my-0", children: user.email }), _jsx(Hr, { className: "border-gray-200 mb-2 mt-2" }), _jsx(Text, { className: "text-gray-500 mb-0", children: "Delivery Address" }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: [(_e = order.shippingAddress) === null || _e === void 0 ? void 0 : _e.firstname, " ", (_f = order.shippingAddress) === null || _f === void 0 ? void 0 : _f.lastname] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: [(_g = order.shippingAddress) === null || _g === void 0 ? void 0 : _g.addressLineOne, " ", ((_h = order.shippingAddress) === null || _h === void 0 ? void 0 : _h.doorNumber) &&
23
- ` / ${(_j = order.shippingAddress) === null || _j === void 0 ? void 0 : _j.doorNumber}`, _jsx("br", {}), (_k = order.shippingAddress) === null || _k === void 0 ? void 0 : _k.city, " ", (_l = order.shippingAddress) === null || _l === void 0 ? void 0 : _l.zipCode] }), _jsx(Text, { className: "text-gray-500 mb-0", children: "Phone" }), _jsx(Text, { className: "font-semibold text-gray-800 my-0", children: (_m = order.shippingAddress) === null || _m === void 0 ? void 0 : _m.phone }), ((_o = order.shippingAddress) === null || _o === void 0 ? void 0 : _o.deliveryInstructions) && (_jsxs(_Fragment, { children: [_jsx(Text, { className: "text-gray-500 mb-0", children: "Delivery Instructions" }), _jsx(Text, { className: "font-semibold text-gray-800 my-0", children: order.shippingAddress.deliveryInstructions })] }))] }), _jsxs(Column, { className: "w-[40%] p-0 mt-0", align: "right", valign: "top", children: [_jsxs(Text, { className: "text-gray-500 mb-0 pt-1", children: ["Order Date: ", formattedDate] }), _jsxs(Text, { className: "text-gray-500 mb-0 pt-1", children: ["Order ID: ", order.referenceId] }), _jsxs(Text, { className: "text-gray-500 mb-0 pt-1", children: ["Payment: ", (_p = order.payment) === null || _p === void 0 ? void 0 : _p.status] })] })] }) }), _jsx(Text, { className: "text-gray-500 mb-0", children: "Order Items" }), _jsx(Hr, { className: "border-gray-200 mb-0" }), _jsx(Section, { children: order.items.map((item, index) => {
24
- var _a, _b;
25
- // Safely cast item to include our extended fields
26
- const extendedItem = item;
27
- return (_jsx("table", { width: "100%", cellPadding: 0, cellSpacing: 0, border: 0, className: index === order.items.length - 1 ? "mb-0" : "mb-4", children: _jsxs("tr", { children: [_jsxs("td", { valign: "top", children: [_jsxs(Text, { className: "font-semibold mb-0", children: [((_a = extendedItem.translations[0]) === null || _a === void 0 ? void 0 : _a.title) || "Product", " (", ((_b = extendedItem.translations[0]) === null || _b === void 0 ? void 0 : _b.subtitle) || "", ")"] }), _jsxs(Text, { className: "text-gray-600 mb-0 mt-0", children: ["Quantity: ", extendedItem.quantity] })] }), _jsx("td", { align: "right", valign: "top", children: _jsx(Text, { className: "font-semibold", children: formatPrice(extendedItem.unitPrice * extendedItem.quantity, organization.configuration.defaultCurrency, organization.configuration.defaultLocale) }) })] }) }, index));
28
- }) }), _jsx(Hr, { className: "border-gray-200 mt-4" }), _jsx(Section, { children: _jsxs("table", { width: "100%", cellPadding: 0, cellSpacing: 0, border: 0, children: [_jsxs("tr", { children: [_jsx("td", { children: _jsx(Text, { className: "text-gray-700", children: "Delivery fee" }) }), _jsx("td", { align: "right", children: _jsx(Text, { className: "text-gray-700", children: formatPrice(shippingCost, organization.configuration.defaultCurrency, organization.configuration.defaultLocale) }) })] }), discount > 0 && (_jsxs("tr", { children: [_jsx("td", { children: _jsx(Text, { className: "text-gray-700", children: "Campaign" }) }), _jsx("td", { align: "right", children: _jsxs(Text, { className: "text-gray-700", children: ["-", formatPrice(discount, organization.configuration.defaultCurrency, organization.configuration.defaultLocale)] }) })] }))] }) }), _jsx(Hr, { className: "border-gray-200" }), _jsx(Section, { className: "mb-6", children: _jsx("table", { width: "100%", cellPadding: 0, cellSpacing: 0, border: 0, children: _jsxs("tr", { children: [_jsx("td", { children: _jsx(Text, { className: "text-xl font-bold mb-0", children: "Total:" }) }), _jsx("td", { align: "right", children: _jsx(Text, { className: "text-xl font-bold mb-0", children: formatPrice(total, organization.configuration.defaultCurrency, organization.configuration.defaultLocale) }) })] }) }) })] }), _jsx(Section, { className: "text-center bg-gray-50 py-5", children: _jsxs("table", { className: "w-full", children: [_jsx("tr", { className: "w-full", children: _jsx("td", { align: "center", children: ((_q = organization.logoFile) === null || _q === void 0 ? void 0 : _q.url) && (_jsx(Img, { alt: `${organization.name} logo`, height: "100", src: organization.logoFile.url, className: "rounded-lg" })) }) }), _jsx("tr", { className: "w-full", children: _jsxs("td", { align: "center", children: [_jsx(Text, { className: "my-[8px] text-[16px] font-semibold text-xl pt-2 text-gray-900", children: organization.name }), _jsxs(Text, { className: "my-[8px] text-[16px] leading-[24px] text-gray-500", children: [(_r = organization.address) === null || _r === void 0 ? void 0 : _r.addressLineOne, ",", " ", (_s = organization.address) === null || _s === void 0 ? void 0 : _s.zipCode, " ", (_t = organization.address) === null || _t === void 0 ? void 0 : _t.city] }), _jsx(Text, { className: "mb-0 mt-[4px] text-[16px] leading-[24px] text-gray-500", children: organization.phone })] }) }), _jsx("tr", { children: _jsx("td", { align: "center", children: _jsxs(Row, { className: "table-cell h-[44px] w-[56px] align-bottom pt-5", children: [_jsx(Column, { className: "pr-[8px]", children: _jsx(Link, { href: "https://www.facebook.com/madrasBistro/", children: _jsx(Img, { alt: "Facebook", height: "36", src: "https://react.email/static/facebook-logo.png", width: "36" }) }) }), _jsx(Column, { children: _jsx(Link, { href: "https://www.instagram.com/madrasbistro/", children: _jsx(Img, { alt: "Instagram", height: "36", src: "https://react.email/static/instagram-logo.png", width: "36" }) }) })] }) }) })] }) })] }) })] }));
29
- };
30
- const previewProps = {
31
- user: {
32
- id: "VD0OJ52f0mdAnm5YePP6BAW6hdbaCjAJ",
33
- name: "Abhishek Shaji",
34
- email: "kontakt@abhishek.pl",
35
- emailVerified: true,
36
- image: "https://lh3.googleusercontent.com/a/ACg8ocKbkCAMTNvMizjXNxcm1aYtBiWnYpCYmU-7aE2Ft_M_uiHheZ5f=s96-c",
37
- createdAt: "2025-03-22T22:54:40.260Z",
38
- updatedAt: "2025-03-22T22:54:40.260Z",
39
- firstname: "Abhishek",
40
- lastname: "Shaji",
41
- },
42
- order: {
43
- id: "cm94wbpbm0000itx1iv9k2mqr",
44
- referenceId: "PH6LD6",
45
- token: "VAE9TX",
46
- expiresAt: "2025-04-07T00:20:09.689Z",
47
- items: [
48
- {
49
- translations: [
50
- {
51
- locale: "en",
52
- title: "Masala Dosa",
53
- subtitle: "Spice Level: Medium",
54
- },
55
- {
56
- locale: "pl",
57
- title: "null",
58
- subtitle: "Spice Level: Medium",
59
- },
60
- ],
61
- rawData: {
62
- productId: "cm8kudyqq0006ityduhq0yveu",
63
- quantity: 6,
64
- modifierGroups: [
65
- {
66
- id: "cm8kuonhv0002ji032ji4bzmc",
67
- modifiers: [
68
- {
69
- id: "cm8kudyqq000ditydq25s2n2e",
70
- quantity: 1,
71
- },
72
- ],
73
- },
74
- ],
75
- },
76
- unitPrice: 39,
77
- image: {
78
- id: "cm8kuee0m0000l703ocs7snfb",
79
- url: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/Masala%20Dosa-b0tr9uWZqmBTPMUx4x0fzqkM6z5eCw.png",
80
- mimeType: "image/png",
81
- size: 1429845,
82
- filename: "Masala Dosa.png",
83
- },
84
- totalPrice: 234,
85
- quantity: 6,
86
- productSnapshotId: "cm8kuopty0006ji035n7w5iby",
87
- },
88
- {
89
- translations: [
90
- {
91
- locale: "en",
92
- title: "Masala Dosa",
93
- subtitle: "Spice Level: Medium",
94
- },
95
- {
96
- locale: "pl",
97
- title: "null",
98
- subtitle: "Spice Level: Medium",
99
- },
100
- ],
101
- rawData: {
102
- productId: "cm8kudyqq0006ityduhq0yveu",
103
- quantity: 6,
104
- modifierGroups: [
105
- {
106
- id: "cm8kuonhv0002ji032ji4bzmc",
107
- modifiers: [
108
- {
109
- id: "cm8kudyqq000ditydq25s2n2e",
110
- quantity: 1,
111
- },
112
- ],
113
- },
114
- ],
115
- },
116
- unitPrice: 39,
117
- image: {
118
- id: "cm8kuee0m0000l703ocs7snfb",
119
- url: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/Masala%20Dosa-b0tr9uWZqmBTPMUx4x0fzqkM6z5eCw.png",
120
- mimeType: "image/png",
121
- size: 1429845,
122
- filename: "Masala Dosa.png",
123
- },
124
- totalPrice: 234,
125
- quantity: 6,
126
- productSnapshotId: "cm8kuopty0006ji035n7w5iby",
127
- },
128
- ],
129
- shippingMethod: {
130
- id: "cm8kuqmkd000iitydar4a1poy",
131
- title: "Express Delivery",
132
- providerName: "Wolt Courier",
133
- requireDateOfDelivery: true,
134
- shippingZones: [
135
- {
136
- id: "cm8kuqmkd000jitydpdvck2th",
137
- title: "Zone 1",
138
- distanceUpto: 7,
139
- price: 1,
140
- minimumOrderAmount: 60,
141
- eta: "90min",
142
- },
143
- ],
144
- createdAt: "2025-03-22T23:40:23.101Z",
145
- updatedAt: "2025-03-22T23:40:35.319Z",
146
- },
147
- acceptedAt: null,
148
- dispatchedAt: null,
149
- readyForDispatchAt: null,
150
- completedAt: null,
151
- cancelledAt: null,
152
- shippingAddress: {
153
- id: "cm94wbpbm0007itx1akuqh77n",
154
- firstname: "Klaudia",
155
- lastname: "Smoter",
156
- phone: "+48570135862",
157
- addressLineOne: "Stanisława Lema 28",
158
- doorNumber: "54",
159
- addressLineTwo: null,
160
- zipCode: "31-571",
161
- city: "Kraków",
162
- country: "PL",
163
- placeId: "ChIJrQfdh9VaFkcRIvg8O2PqnWM",
164
- deliveryInstructions: "4th floor - Maho",
165
- },
166
- fulfilmentMethod: "delivery",
167
- currency: "PLN",
168
- payment: {
169
- id: "cm94wbpbm0008itx1thsnj7ui",
170
- method: "blik",
171
- provider: "stripe",
172
- status: "succeeded",
173
- shipping: 1,
174
- subtotal: 234,
175
- total: 235,
176
- discount: 0,
177
- currency: "PLN",
178
- },
179
- status: "pending",
180
- },
181
- organization: {
182
- id: "cm8kthfdq0001lg03b59mdy7b",
183
- name: "Madras Bistro",
184
- phone: "+48570135862",
185
- email: "contact@madrasbistro.pl",
186
- createdAt: "2025-03-22T23:05:14.271Z",
187
- legalEntityId: null,
188
- address: {
189
- id: "cm8kthfdr0002lg0350ijialt",
190
- firstname: null,
191
- lastname: null,
192
- phone: null,
193
- addressLineOne: "Plac Bohaterów Getta 2",
194
- doorNumber: null,
195
- addressLineTwo: "3",
196
- zipCode: "33-332",
197
- city: "Kraków",
198
- country: "PL",
199
- placeId: "ChIJf-nsRkRbFkcR21gtObFSSSA",
200
- deliveryInstructions: null,
201
- },
202
- configuration: {
203
- id: "cm8kthfdr0003lg03ghgs262n",
204
- hostname: "null",
205
- countriesShipping: ["us"],
206
- stripeAccountId: "null",
207
- enableHostCheckout: false,
208
- enableHostTracking: false,
209
- isAcceptingOrders: false,
210
- defaultLocale: "en",
211
- supportedLocales: ["en", "pl"],
212
- defaultCurrency: "PLN",
213
- createdAt: "2025-03-22T23:05:14.271Z",
214
- },
215
- logo: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",
216
- logoFile: {
217
- id: "cm8ktmu890005lg0356gwclfk",
218
- url: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",
219
- mimeType: "image/png",
220
- size: 1652289,
221
- filename: "logo.png",
222
- },
223
- },
224
- };
225
- // Fixed the TypeScript error by using proper type assertion
226
- OrderNotificationEmail.PreviewProps = previewProps;
227
- export default OrderNotificationEmail;
228
- export { OrderNotificationEmail };
229
- //# sourceMappingURL=order-notification.email.js.map
1
+ import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{Body as a,Column as l,Container as r,Head as n,Heading as d,Hr as s,Html as c,Img as o,Link as m,Preview as h,Row as u,Section as p,Tailwind as g,Text as y}from"@react-email/components";const b=(e,t="PLN",i="en-US")=>new Intl.NumberFormat(i,{style:"currency",currency:t}).format(e),f=({user:f,organization:v,order:x})=>{var N,w,k,A,q,I,P,L,M,C,z,D,S,j,T,F,O,Z;const B=`New order #${x.referenceId} received`,W=(new Date).toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}),Y=(null===(N=x.payment)||void 0===N?void 0:N.shipping)||0,J=(null===(w=x.payment)||void 0===w?void 0:w.discount)||0,K=(null===(k=x.payment)||void 0===k?void 0:k.total)||0,R=`https://${v.configuration.hostname}/admin/orders/${x.id}`;return t(c,{children:[e(n,{}),e(h,{children:B}),e(g,{children:t(a,{className:"bg-gray-50 font-sans",children:[t(r,{className:"bg-gray-50 p-6 max-w-[600px]",children:[e(p,{className:"mb-6",children:t(u,{children:[e(l,{className:"w-[80%]",children:e(o,{alt:`${v.name} logo`,height:"100",src:null===(A=v.logoFile)||void 0===A?void 0:A.url,className:"rounded-lg"})}),e(l,{align:"right",children:t(u,{align:"right",children:[e(l,{children:e(m,{href:"https://www.instagram.com/madrasbistro/",children:e(o,{alt:"Instagram",className:"mx-[4px]",height:"36",src:"https://react.email/static/instagram-logo.png",width:"36"})})}),e(l,{children:e(m,{href:"https://www.facebook.com/madrasBistro/",children:e(o,{alt:"Facebook",className:"mx-[4px]",height:"36",src:"https://react.email/static/facebook-logo.png",width:"36"})})})]})})]})}),t(p,{children:[e(d,{className:"text-3xl font-bold text-gray-800 mb-0",children:"You have received a new order"}),t(y,{className:"text-gray-600 mb-2 text-lg",children:["Order #",x.referenceId," has been placed and is waiting for your action."]})]}),e(p,{className:"mb-0",children:e(m,{href:R,className:"bg-gray-900 text-sm rounded-md text-white font-medium py-2 px-5 text-center inline-block my-4",children:"View Order Details"})})]}),t(r,{className:"mx-auto max-w-[600px] rounded-xl bg-white px-6",children:[e(p,{className:"mb-6",children:t(u,{children:[t(l,{className:"w-[60%]",children:[e(y,{className:"text-gray-500 mb-0",children:"Customer Information"}),t(y,{className:"font-semibold text-gray-800 my-0",children:[f.firstname," ",f.lastname]}),e(y,{className:"font-semibold text-gray-800 my-0",children:f.email}),e(s,{className:"border-gray-200 mb-2 mt-2"}),e(y,{className:"text-gray-500 mb-0",children:"Delivery Address"}),t(y,{className:"font-semibold text-gray-800 my-0",children:[null===(q=x.shippingAddress)||void 0===q?void 0:q.firstname," ",null===(I=x.shippingAddress)||void 0===I?void 0:I.lastname]}),t(y,{className:"font-semibold text-gray-800 my-0",children:[null===(P=x.shippingAddress)||void 0===P?void 0:P.addressLineOne," ",(null===(L=x.shippingAddress)||void 0===L?void 0:L.doorNumber)&&` / ${null===(M=x.shippingAddress)||void 0===M?void 0:M.doorNumber}`,e("br",{}),null===(C=x.shippingAddress)||void 0===C?void 0:C.city," ",null===(z=x.shippingAddress)||void 0===z?void 0:z.zipCode]}),e(y,{className:"text-gray-500 mb-0",children:"Phone"}),e(y,{className:"font-semibold text-gray-800 my-0",children:null===(D=x.shippingAddress)||void 0===D?void 0:D.phone}),(null===(S=x.shippingAddress)||void 0===S?void 0:S.deliveryInstructions)&&t(i,{children:[e(y,{className:"text-gray-500 mb-0",children:"Delivery Instructions"}),e(y,{className:"font-semibold text-gray-800 my-0",children:x.shippingAddress.deliveryInstructions})]})]}),t(l,{className:"w-[40%] p-0 mt-0",align:"right",valign:"top",children:[t(y,{className:"text-gray-500 mb-0 pt-1",children:["Order Date: ",W]}),t(y,{className:"text-gray-500 mb-0 pt-1",children:["Order ID: ",x.referenceId]}),t(y,{className:"text-gray-500 mb-0 pt-1",children:["Payment: ",null===(j=x.payment)||void 0===j?void 0:j.status]})]})]})}),e(y,{className:"text-gray-500 mb-0",children:"Order Items"}),e(s,{className:"border-gray-200 mb-0"}),e(p,{children:x.items.map((i,a)=>{var l,r;const n=i;return e("table",{width:"100%",cellPadding:0,cellSpacing:0,border:0,className:a===x.items.length-1?"mb-0":"mb-4",children:t("tr",{children:[t("td",{valign:"top",children:[t(y,{className:"font-semibold mb-0",children:[(null===(l=n.translations[0])||void 0===l?void 0:l.title)||"Product"," (",(null===(r=n.translations[0])||void 0===r?void 0:r.subtitle)||"",")"]}),t(y,{className:"text-gray-600 mb-0 mt-0",children:["Quantity: ",n.quantity]})]}),e("td",{align:"right",valign:"top",children:e(y,{className:"font-semibold",children:b(n.unitPrice*n.quantity,v.configuration.defaultCurrency,v.configuration.defaultLocale)})})]})},a)})}),e(s,{className:"border-gray-200 mt-4"}),e(p,{children:t("table",{width:"100%",cellPadding:0,cellSpacing:0,border:0,children:[t("tr",{children:[e("td",{children:e(y,{className:"text-gray-700",children:"Delivery fee"})}),e("td",{align:"right",children:e(y,{className:"text-gray-700",children:b(Y,v.configuration.defaultCurrency,v.configuration.defaultLocale)})})]}),J>0&&t("tr",{children:[e("td",{children:e(y,{className:"text-gray-700",children:"Campaign"})}),e("td",{align:"right",children:t(y,{className:"text-gray-700",children:["-",b(J,v.configuration.defaultCurrency,v.configuration.defaultLocale)]})})]})]})}),e(s,{className:"border-gray-200"}),e(p,{className:"mb-6",children:e("table",{width:"100%",cellPadding:0,cellSpacing:0,border:0,children:t("tr",{children:[e("td",{children:e(y,{className:"text-xl font-bold mb-0",children:"Total:"})}),e("td",{align:"right",children:e(y,{className:"text-xl font-bold mb-0",children:b(K,v.configuration.defaultCurrency,v.configuration.defaultLocale)})})]})})})]}),e(p,{className:"text-center bg-gray-50 py-5",children:t("table",{className:"w-full",children:[e("tr",{className:"w-full",children:e("td",{align:"center",children:(null===(T=v.logoFile)||void 0===T?void 0:T.url)&&e(o,{alt:`${v.name} logo`,height:"100",src:v.logoFile.url,className:"rounded-lg"})})}),e("tr",{className:"w-full",children:t("td",{align:"center",children:[e(y,{className:"my-[8px] text-[16px] font-semibold text-xl pt-2 text-gray-900",children:v.name}),t(y,{className:"my-[8px] text-[16px] leading-[24px] text-gray-500",children:[null===(F=v.address)||void 0===F?void 0:F.addressLineOne,","," ",null===(O=v.address)||void 0===O?void 0:O.zipCode," ",null===(Z=v.address)||void 0===Z?void 0:Z.city]}),e(y,{className:"mb-0 mt-[4px] text-[16px] leading-[24px] text-gray-500",children:v.phone})]})}),e("tr",{children:e("td",{align:"center",children:t(u,{className:"table-cell h-[44px] w-[56px] align-bottom pt-5",children:[e(l,{className:"pr-[8px]",children:e(m,{href:"https://www.facebook.com/madrasBistro/",children:e(o,{alt:"Facebook",height:"36",src:"https://react.email/static/facebook-logo.png",width:"36"})})}),e(l,{children:e(m,{href:"https://www.instagram.com/madrasbistro/",children:e(o,{alt:"Instagram",height:"36",src:"https://react.email/static/instagram-logo.png",width:"36"})})})]})})})]})})]})})]})};f.PreviewProps={user:{id:"VD0OJ52f0mdAnm5YePP6BAW6hdbaCjAJ",name:"Abhishek Shaji",email:"kontakt@abhishek.pl",emailVerified:!0,image:"https://lh3.googleusercontent.com/a/ACg8ocKbkCAMTNvMizjXNxcm1aYtBiWnYpCYmU-7aE2Ft_M_uiHheZ5f=s96-c",createdAt:"2025-03-22T22:54:40.260Z",updatedAt:"2025-03-22T22:54:40.260Z",firstname:"Abhishek",lastname:"Shaji"},order:{id:"cm94wbpbm0000itx1iv9k2mqr",referenceId:"PH6LD6",token:"VAE9TX",expiresAt:"2025-04-07T00:20:09.689Z",items:[{translations:[{locale:"en",title:"Masala Dosa",subtitle:"Spice Level: Medium"},{locale:"pl",title:"null",subtitle:"Spice Level: Medium"}],rawData:{productId:"cm8kudyqq0006ityduhq0yveu",quantity:6,modifierGroups:[{id:"cm8kuonhv0002ji032ji4bzmc",modifiers:[{id:"cm8kudyqq000ditydq25s2n2e",quantity:1}]}]},unitPrice:39,image:{id:"cm8kuee0m0000l703ocs7snfb",url:"https://z3liuyatqnepss3d.public.blob.vercel-storage.com/Masala%20Dosa-b0tr9uWZqmBTPMUx4x0fzqkM6z5eCw.png",mimeType:"image/png",size:1429845,filename:"Masala Dosa.png"},totalPrice:234,quantity:6,productSnapshotId:"cm8kuopty0006ji035n7w5iby"},{translations:[{locale:"en",title:"Masala Dosa",subtitle:"Spice Level: Medium"},{locale:"pl",title:"null",subtitle:"Spice Level: Medium"}],rawData:{productId:"cm8kudyqq0006ityduhq0yveu",quantity:6,modifierGroups:[{id:"cm8kuonhv0002ji032ji4bzmc",modifiers:[{id:"cm8kudyqq000ditydq25s2n2e",quantity:1}]}]},unitPrice:39,image:{id:"cm8kuee0m0000l703ocs7snfb",url:"https://z3liuyatqnepss3d.public.blob.vercel-storage.com/Masala%20Dosa-b0tr9uWZqmBTPMUx4x0fzqkM6z5eCw.png",mimeType:"image/png",size:1429845,filename:"Masala Dosa.png"},totalPrice:234,quantity:6,productSnapshotId:"cm8kuopty0006ji035n7w5iby"}],shippingMethod:{id:"cm8kuqmkd000iitydar4a1poy",title:"Express Delivery",providerName:"Wolt Courier",requireDateOfDelivery:!0,shippingZones:[{id:"cm8kuqmkd000jitydpdvck2th",title:"Zone 1",distanceUpto:7,price:1,minimumOrderAmount:60,eta:"90min"}],createdAt:"2025-03-22T23:40:23.101Z",updatedAt:"2025-03-22T23:40:35.319Z"},acceptedAt:null,dispatchedAt:null,readyForDispatchAt:null,completedAt:null,cancelledAt:null,shippingAddress:{id:"cm94wbpbm0007itx1akuqh77n",firstname:"Klaudia",lastname:"Smoter",phone:"+48570135862",addressLineOne:"Stanisława Lema 28",doorNumber:"54",addressLineTwo:null,zipCode:"31-571",city:"Kraków",country:"PL",placeId:"ChIJrQfdh9VaFkcRIvg8O2PqnWM",deliveryInstructions:"4th floor - Maho"},fulfilmentMethod:"delivery",currency:"PLN",payment:{id:"cm94wbpbm0008itx1thsnj7ui",method:"blik",provider:"stripe",status:"succeeded",shipping:1,subtotal:234,total:235,discount:0,currency:"PLN"},status:"pending"},organization:{id:"cm8kthfdq0001lg03b59mdy7b",name:"Madras Bistro",phone:"+48570135862",email:"contact@madrasbistro.pl",createdAt:"2025-03-22T23:05:14.271Z",legalEntityId:null,address:{id:"cm8kthfdr0002lg0350ijialt",firstname:null,lastname:null,phone:null,addressLineOne:"Plac Bohaterów Getta 2",doorNumber:null,addressLineTwo:"3",zipCode:"33-332",city:"Kraków",country:"PL",placeId:"ChIJf-nsRkRbFkcR21gtObFSSSA",deliveryInstructions:null},configuration:{id:"cm8kthfdr0003lg03ghgs262n",hostname:"null",countriesShipping:["us"],stripeAccountId:"null",enableHostCheckout:!1,enableHostTracking:!1,isAcceptingOrders:!1,defaultLocale:"en",supportedLocales:["en","pl"],defaultCurrency:"PLN",createdAt:"2025-03-22T23:05:14.271Z"},logo:"https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",logoFile:{id:"cm8ktmu890005lg0356gwclfk",url:"https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",mimeType:"image/png",size:1652289,filename:"logo.png"}}};export default f;export{f as OrderNotificationEmail};
@@ -1,3 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- export const fulfilmentMethod = z.enum(["delivery", "pickup"]);
3
- //# sourceMappingURL=fulfilment.schema.js.map
1
+ import{z as o}from"@hono/zod-openapi";export const fulfilmentMethod=o.enum(["delivery","pickup"]);
@@ -1,54 +1 @@
1
- import { __awaiter } from "tslib";
2
- import { createApiRouter } from "../../core/hono/hono";
3
- import { orderRoute } from "./order.route";
4
- import { OrderService } from "./order.service";
5
- export const buildOrderHandler = (prisma, options) => {
6
- const app = createApiRouter();
7
- app.openapi(orderRoute.createOrder, (c) => __awaiter(void 0, void 0, void 0, function* () {
8
- const auth = c.get("auth");
9
- const params = c.req.valid("param");
10
- const body = c.req.valid("json");
11
- const user = yield auth.getCurrentUser();
12
- const service = new OrderService(prisma, options);
13
- const { order, redirectUrl } = yield service.createOrder(params.organizationId, user, body);
14
- return c.json({
15
- order,
16
- redirectUrl,
17
- }, 201);
18
- }));
19
- app.openapi(orderRoute.getOrder, (c) => __awaiter(void 0, void 0, void 0, function* () {
20
- const auth = c.get("auth");
21
- const params = c.req.valid("param");
22
- const user = yield auth.getCurrentUser();
23
- const service = new OrderService(prisma, options);
24
- const order = yield service.getOrder(user, params.organizationId, params.id);
25
- return c.json(order, 200);
26
- }));
27
- app.openapi(orderRoute.getOrders, (c) => __awaiter(void 0, void 0, void 0, function* () {
28
- const auth = c.get("auth");
29
- const params = c.req.valid("param");
30
- const query = c.req.valid("query");
31
- yield auth.isGranted("read");
32
- const service = new OrderService(prisma, options);
33
- const result = yield service.getOrders(params.organizationId, query);
34
- return c.json(result, 200);
35
- }));
36
- app.openapi(orderRoute.updateStatus, (c) => __awaiter(void 0, void 0, void 0, function* () {
37
- const auth = c.get("auth");
38
- const params = c.req.valid("param");
39
- yield auth.isGranted("update");
40
- const service = new OrderService(prisma, options);
41
- const order = yield service.updateStatus(params.organizationId, params.id, params.operation);
42
- return c.json(order, 200);
43
- }));
44
- app.openapi(orderRoute.deleteOrder, (c) => __awaiter(void 0, void 0, void 0, function* () {
45
- const auth = c.get("auth");
46
- const params = c.req.valid("param");
47
- const user = yield auth.isGranted("delete");
48
- const service = new OrderService(prisma, options);
49
- yield service.deleteOrder(params.organizationId, params.id, user.id);
50
- return c.body(null, 204);
51
- }));
52
- return app;
53
- };
54
- //# sourceMappingURL=order.handler.js.map
1
+ import{__awaiter as e}from"tslib";import{createApiRouter as r}from"../../core/hono/hono";import{orderRoute as o}from"./order.route";import{OrderService as d}from"./order.service";export const buildOrderHandler=(i,t)=>{const n=r();return n.openapi(o.createOrder,r=>e(void 0,void 0,void 0,function*(){const e=r.get("auth"),o=r.req.valid("param"),n=r.req.valid("json"),a=yield e.getCurrentUser(),l=new d(i,t),{order:u,redirectUrl:s}=yield l.createOrder(o.organizationId,a,n);return r.json({order:u,redirectUrl:s},201)})),n.openapi(o.getOrder,r=>e(void 0,void 0,void 0,function*(){const e=r.get("auth"),o=r.req.valid("param"),n=yield e.getCurrentUser(),a=new d(i,t),l=yield a.getOrder(n,o.organizationId,o.id);return r.json(l,200)})),n.openapi(o.getOrders,r=>e(void 0,void 0,void 0,function*(){const e=r.get("auth"),o=r.req.valid("param"),n=r.req.valid("query");yield e.isGranted("read");const a=new d(i,t),l=yield a.getOrders(o.organizationId,n);return r.json(l,200)})),n.openapi(o.updateStatus,r=>e(void 0,void 0,void 0,function*(){const e=r.get("auth"),o=r.req.valid("param");yield e.isGranted("update");const n=new d(i,t),a=yield n.updateStatus(o.organizationId,o.id,o.operation);return r.json(a,200)})),n.openapi(o.deleteOrder,r=>e(void 0,void 0,void 0,function*(){const e=r.get("auth"),o=r.req.valid("param"),n=yield e.isGranted("delete"),a=new d(i,t);return yield a.deleteOrder(o.organizationId,o.id,n.id),r.body(null,204)})),n};