@shophost/rest-api 2.0.29 → 2.0.31

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 +110 -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,82 +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
- import { format } from "date-fns";
4
- const ReservationCancellationEmail = ({ user, organization, reservation, }) => {
5
- var _a, _b, _c, _d, _e;
6
- const previewText = `Your reservation with ${organization.name} has been cancelled`;
7
- const formattedDate = format(new Date(reservation.date), "dd.MM.yyyy 'at' HH:mm");
8
- 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: (_a = organization.logoFile) === null || _a === void 0 ? void 0 : _a.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 reservation has been cancelled." })] })] }), _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: "Cancelled reservation details" }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: [reservation.firstname, " ", reservation.lastname] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: ["Reference: ", reservation.referenceId] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: ["Date and Time: ", formattedDate] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: ["Number of Guests: ", reservation.guests] })] }), _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: format(new Date(), "dd.MM.yyyy") }) })] }) }), _jsx(Hr, { className: "border-gray-200 mt-4" }), _jsxs(Section, { className: "mb-6", children: [_jsxs(Text, { className: "text-gray-700", children: ["Your reservation at ", organization.name, " has been cancelled. If you did not request this cancellation or wish to make a new reservation, please contact us at ", organization.phone, "."] }), _jsxs(Text, { className: "text-gray-700", children: ["We hope to welcome you at ", organization.name, " another time."] })] })] }), _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: ((_b = organization.logoFile) === null || _b === void 0 ? void 0 : _b.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: [(_c = organization.address) === null || _c === void 0 ? void 0 : _c.addressLineOne, ",", " ", (_d = organization.address) === null || _d === void 0 ? void 0 : _d.zipCode, " ", (_e = organization.address) === null || _e === void 0 ? void 0 : _e.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" }) }) })] }) }) })] }) })] }) })] }));
9
- };
10
- const previewProps = {
11
- user: {
12
- id: "VD0OJ52f0mdAnm5YePP6BAW6hdbaCjAJ",
13
- name: "Abhishek Shaji",
14
- email: "kontakt@abhishek.pl",
15
- emailVerified: true,
16
- image: "https://lh3.googleusercontent.com/a/ACg8ocKbkCAMTNvMizjXNxcm1aYtBiWnYpCYmU-7aE2Ft_M_uiHheZ5f=s96-c",
17
- createdAt: "2025-03-22T22:54:40.260Z",
18
- updatedAt: "2025-03-22T22:54:40.260Z",
19
- firstname: "Abhishek",
20
- lastname: "Shaji",
21
- },
22
- reservation: {
23
- id: "cm94wbpbm0000itx1iv9k2mqr",
24
- referenceId: "PH6LD6",
25
- firstname: "Abhishek",
26
- lastname: "Shaji",
27
- phone: "+48570135862",
28
- guests: 4,
29
- date: new Date("2025-04-07T19:30:00.000Z"),
30
- createdAt: "2025-03-22T22:54:40.260Z",
31
- acceptedAt: "2025-03-22T23:00:23.456Z",
32
- cancelledAt: "2025-03-23T10:15:45.789Z",
33
- },
34
- organization: {
35
- id: "cm8kthfdq0001lg03b59mdy7b",
36
- name: "Madras Bistro",
37
- phone: "+48570135862",
38
- email: "contact@madrasbistro.pl",
39
- createdAt: "2025-03-22T23:05:14.271Z",
40
- legalEntityId: null,
41
- address: {
42
- id: "cm8kthfdr0002lg0350ijialt",
43
- firstname: null,
44
- lastname: null,
45
- phone: null,
46
- addressLineOne: "Plac Bohaterów Getta 2",
47
- doorNumber: null,
48
- addressLineTwo: "3",
49
- zipCode: "33-332",
50
- city: "Kraków",
51
- country: "PL",
52
- placeId: "ChIJf-nsRkRbFkcR21gtObFSSSA",
53
- deliveryInstructions: null,
54
- },
55
- configuration: {
56
- id: "cm8kthfdr0003lg03ghgs262n",
57
- hostname: "madrasbistro.pl",
58
- countriesShipping: ["us"],
59
- stripeAccountId: "null",
60
- enableHostCheckout: false,
61
- enableHostTracking: false,
62
- isAcceptingOrders: false,
63
- defaultLocale: "en",
64
- supportedLocales: ["en", "pl"],
65
- defaultCurrency: "PLN",
66
- createdAt: "2025-03-22T23:05:14.271Z",
67
- },
68
- logo: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",
69
- logoFile: {
70
- id: "cm8ktmu890005lg0356gwclfk",
71
- url: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",
72
- mimeType: "image/png",
73
- size: 1652289,
74
- filename: "logo.png",
75
- },
76
- },
77
- };
78
- // Fixed the TypeScript error by using proper type assertion
79
- ReservationCancellationEmail.PreviewProps = previewProps;
80
- export default ReservationCancellationEmail;
81
- export { ReservationCancellationEmail };
82
- //# sourceMappingURL=reservation-cancellation.email.js.map
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Body as t,Column as l,Container as r,Head as s,Heading as i,Hr as n,Html as c,Img as o,Link as d,Preview as m,Row as h,Section as g,Tailwind as p,Text as u}from"@react-email/components";import{format as b}from"date-fns";const x=({user:x,organization:f,reservation:y})=>{var w,N,v,k,A;const j=`Your reservation with ${f.name} has been cancelled`,F=b(new Date(y.date),"dd.MM.yyyy 'at' HH:mm");return a(c,{children:[e(s,{}),e(m,{children:j}),e(p,{children:a(t,{className:"bg-gray-50 font-sans",children:[a(r,{className:"bg-gray-50 p-6 max-w-[600px]",children:[e(g,{className:"mb-6",children:a(h,{children:[e(l,{className:"w-[80%]",children:e(o,{alt:`${f.name} logo`,height:"100",src:null===(w=f.logoFile)||void 0===w?void 0:w.url,className:"rounded-lg"})}),e(l,{align:"right",children:a(h,{align:"right",children:[e(l,{children:e(d,{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(d,{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"})})})]})})]})}),a(g,{children:[a(i,{className:"text-3xl font-bold text-gray-800 mb-0",children:["Hi ",x.firstname,","]}),e(u,{className:"text-gray-600 mb-2 text-lg",children:"Your reservation has been cancelled."})]})]}),a(r,{className:"mx-auto max-w-[600px] rounded-xl bg-white px-6",children:[e(g,{className:"mb-6",children:a(h,{children:[a(l,{className:"w-[60%]",children:[e(u,{className:"text-gray-500 mb-0",children:"Cancelled reservation details"}),a(u,{className:"font-semibold text-gray-800 my-0",children:[y.firstname," ",y.lastname]}),a(u,{className:"font-semibold text-gray-800 my-0",children:["Reference: ",y.referenceId]}),a(u,{className:"font-semibold text-gray-800 my-0",children:["Date and Time: ",F]}),a(u,{className:"font-semibold text-gray-800 my-0",children:["Number of Guests: ",y.guests]})]}),e(l,{className:"w-[40%] p-0 mt-0",align:"right",valign:"top",children:e(u,{className:"text-gray-500 mb-0 pt-1",children:b(new Date,"dd.MM.yyyy")})})]})}),e(n,{className:"border-gray-200 mt-4"}),a(g,{className:"mb-6",children:[a(u,{className:"text-gray-700",children:["Your reservation at ",f.name," has been cancelled. If you did not request this cancellation or wish to make a new reservation, please contact us at ",f.phone,"."]}),a(u,{className:"text-gray-700",children:["We hope to welcome you at ",f.name," another time."]})]})]}),e(g,{className:"text-center bg-gray-50 py-5",children:a("table",{className:"w-full",children:[e("tr",{className:"w-full",children:e("td",{align:"center",children:(null===(N=f.logoFile)||void 0===N?void 0:N.url)&&e(o,{alt:`${f.name} logo`,height:"100",src:f.logoFile.url,className:"rounded-lg"})})}),e("tr",{className:"w-full",children:a("td",{align:"center",children:[e(u,{className:"my-[8px] text-[16px] font-semibold text-xl pt-2 text-gray-900",children:f.name}),a(u,{className:"my-[8px] text-[16px] leading-[24px] text-gray-500",children:[null===(v=f.address)||void 0===v?void 0:v.addressLineOne,","," ",null===(k=f.address)||void 0===k?void 0:k.zipCode," ",null===(A=f.address)||void 0===A?void 0:A.city]}),e(u,{className:"mb-0 mt-[4px] text-[16px] leading-[24px] text-gray-500",children:f.phone})]})}),e("tr",{children:e("td",{align:"center",children:a(h,{className:"table-cell h-[44px] w-[56px] align-bottom pt-5",children:[e(l,{className:"pr-[8px]",children:e(d,{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(d,{href:"https://www.instagram.com/madrasbistro/",children:e(o,{alt:"Instagram",height:"36",src:"https://react.email/static/instagram-logo.png",width:"36"})})})]})})})]})})]})})]})},f={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"},reservation:{id:"cm94wbpbm0000itx1iv9k2mqr",referenceId:"PH6LD6",firstname:"Abhishek",lastname:"Shaji",phone:"+48570135862",guests:4,date:new Date("2025-04-07T19:30:00.000Z"),createdAt:"2025-03-22T22:54:40.260Z",acceptedAt:"2025-03-22T23:00:23.456Z",cancelledAt:"2025-03-23T10:15:45.789Z"},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:"madrasbistro.pl",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"}}};x.PreviewProps=f;export default x;export{x as ReservationCancellationEmail};
@@ -1,82 +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
- import { format } from "date-fns";
4
- const ReservationConfirmationEmail = ({ user, organization, reservation, }) => {
5
- var _a, _b, _c, _d, _e;
6
- const previewText = `This is your reservation confirmation from ${organization.name}`;
7
- const formattedDate = format(new Date(reservation.date), "dd.MM.yyyy 'at' HH:mm");
8
- 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: (_a = organization.logoFile) === null || _a === void 0 ? void 0 : _a.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 reservation has been confirmed." })] })] }), _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: "Reservation details" }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: [reservation.firstname, " ", reservation.lastname] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: ["Reference: ", reservation.referenceId] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: ["Date and Time: ", formattedDate] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: ["Number of Guests: ", reservation.guests] }), _jsx(Text, { className: "text-gray-500 mb-0", children: "Phone" }), _jsx(Text, { className: "font-semibold text-gray-800 my-0", children: reservation.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: format(new Date(), "dd.MM.yyyy") }) })] }) }), _jsx(Hr, { className: "border-gray-200 mt-4" }), _jsxs(Section, { className: "mb-6", children: [_jsxs(Text, { className: "text-gray-700", children: ["We're looking forward to welcoming you at ", organization.name, ". If you need to make any changes to your reservation, please contact us directly at ", organization.phone, "."] }), _jsx(Text, { className: "text-gray-700", children: "Please note that we hold your table for 15 minutes from your reservation time." })] })] }), _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: ((_b = organization.logoFile) === null || _b === void 0 ? void 0 : _b.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: [(_c = organization.address) === null || _c === void 0 ? void 0 : _c.addressLineOne, ",", " ", (_d = organization.address) === null || _d === void 0 ? void 0 : _d.zipCode, " ", (_e = organization.address) === null || _e === void 0 ? void 0 : _e.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" }) }) })] }) }) })] }) })] }) })] }));
9
- };
10
- const previewProps = {
11
- user: {
12
- id: "VD0OJ52f0mdAnm5YePP6BAW6hdbaCjAJ",
13
- name: "Abhishek Shaji",
14
- email: "kontakt@abhishek.pl",
15
- emailVerified: true,
16
- image: "https://lh3.googleusercontent.com/a/ACg8ocKbkCAMTNvMizjXNxcm1aYtBiWnYpCYmU-7aE2Ft_M_uiHheZ5f=s96-c",
17
- createdAt: "2025-03-22T22:54:40.260Z",
18
- updatedAt: "2025-03-22T22:54:40.260Z",
19
- firstname: "Abhishek",
20
- lastname: "Shaji",
21
- },
22
- reservation: {
23
- id: "cm94wbpbm0000itx1iv9k2mqr",
24
- referenceId: "PH6LD6",
25
- firstname: "Abhishek",
26
- lastname: "Shaji",
27
- phone: "+48570135862",
28
- guests: 4,
29
- date: new Date("2025-04-07T19:30:00.000Z"),
30
- createdAt: "2025-03-22T22:54:40.260Z",
31
- acceptedAt: "2025-03-22T23:00:23.456Z",
32
- cancelledAt: null,
33
- },
34
- organization: {
35
- id: "cm8kthfdq0001lg03b59mdy7b",
36
- name: "Madras Bistro",
37
- phone: "+48570135862",
38
- email: "contact@madrasbistro.pl",
39
- createdAt: "2025-03-22T23:05:14.271Z",
40
- legalEntityId: null,
41
- address: {
42
- id: "cm8kthfdr0002lg0350ijialt",
43
- firstname: null,
44
- lastname: null,
45
- phone: null,
46
- addressLineOne: "Plac Bohaterów Getta 2",
47
- doorNumber: null,
48
- addressLineTwo: "3",
49
- zipCode: "33-332",
50
- city: "Kraków",
51
- country: "PL",
52
- placeId: "ChIJf-nsRkRbFkcR21gtObFSSSA",
53
- deliveryInstructions: null,
54
- },
55
- configuration: {
56
- id: "cm8kthfdr0003lg03ghgs262n",
57
- hostname: "madrasbistro.pl",
58
- countriesShipping: ["us"],
59
- stripeAccountId: "null",
60
- enableHostCheckout: false,
61
- enableHostTracking: false,
62
- isAcceptingOrders: false,
63
- defaultLocale: "en",
64
- supportedLocales: ["en", "pl"],
65
- defaultCurrency: "PLN",
66
- createdAt: "2025-03-22T23:05:14.271Z",
67
- },
68
- logo: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",
69
- logoFile: {
70
- id: "cm8ktmu890005lg0356gwclfk",
71
- url: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",
72
- mimeType: "image/png",
73
- size: 1652289,
74
- filename: "logo.png",
75
- },
76
- },
77
- };
78
- // Fixed the TypeScript error by using proper type assertion
79
- ReservationConfirmationEmail.PreviewProps = previewProps;
80
- export default ReservationConfirmationEmail;
81
- export { ReservationConfirmationEmail };
82
- //# sourceMappingURL=reservation-confirmation.email.js.map
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Body as t,Column as l,Container as r,Head as s,Heading as i,Hr as n,Html as c,Img as o,Link as d,Preview as m,Row as h,Section as g,Tailwind as p,Text as u}from"@react-email/components";import{format as b}from"date-fns";const x=({user:x,organization:y,reservation:f})=>{var N,w,v,k,A;const j=`This is your reservation confirmation from ${y.name}`,F=b(new Date(f.date),"dd.MM.yyyy 'at' HH:mm");return a(c,{children:[e(s,{}),e(m,{children:j}),e(p,{children:a(t,{className:"bg-gray-50 font-sans",children:[a(r,{className:"bg-gray-50 p-6 max-w-[600px]",children:[e(g,{className:"mb-6",children:a(h,{children:[e(l,{className:"w-[80%]",children:e(o,{alt:`${y.name} logo`,height:"100",src:null===(N=y.logoFile)||void 0===N?void 0:N.url,className:"rounded-lg"})}),e(l,{align:"right",children:a(h,{align:"right",children:[e(l,{children:e(d,{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(d,{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"})})})]})})]})}),a(g,{children:[a(i,{className:"text-3xl font-bold text-gray-800 mb-0",children:["Hi ",x.firstname,","]}),e(u,{className:"text-gray-600 mb-2 text-lg",children:"Your reservation has been confirmed."})]})]}),a(r,{className:"mx-auto max-w-[600px] rounded-xl bg-white px-6",children:[e(g,{className:"mb-6",children:a(h,{children:[a(l,{className:"w-[60%]",children:[e(u,{className:"text-gray-500 mb-0",children:"Reservation details"}),a(u,{className:"font-semibold text-gray-800 my-0",children:[f.firstname," ",f.lastname]}),a(u,{className:"font-semibold text-gray-800 my-0",children:["Reference: ",f.referenceId]}),a(u,{className:"font-semibold text-gray-800 my-0",children:["Date and Time: ",F]}),a(u,{className:"font-semibold text-gray-800 my-0",children:["Number of Guests: ",f.guests]}),e(u,{className:"text-gray-500 mb-0",children:"Phone"}),e(u,{className:"font-semibold text-gray-800 my-0",children:f.phone})]}),e(l,{className:"w-[40%] p-0 mt-0",align:"right",valign:"top",children:e(u,{className:"text-gray-500 mb-0 pt-1",children:b(new Date,"dd.MM.yyyy")})})]})}),e(n,{className:"border-gray-200 mt-4"}),a(g,{className:"mb-6",children:[a(u,{className:"text-gray-700",children:["We're looking forward to welcoming you at ",y.name,". If you need to make any changes to your reservation, please contact us directly at ",y.phone,"."]}),e(u,{className:"text-gray-700",children:"Please note that we hold your table for 15 minutes from your reservation time."})]})]}),e(g,{className:"text-center bg-gray-50 py-5",children:a("table",{className:"w-full",children:[e("tr",{className:"w-full",children:e("td",{align:"center",children:(null===(w=y.logoFile)||void 0===w?void 0:w.url)&&e(o,{alt:`${y.name} logo`,height:"100",src:y.logoFile.url,className:"rounded-lg"})})}),e("tr",{className:"w-full",children:a("td",{align:"center",children:[e(u,{className:"my-[8px] text-[16px] font-semibold text-xl pt-2 text-gray-900",children:y.name}),a(u,{className:"my-[8px] text-[16px] leading-[24px] text-gray-500",children:[null===(v=y.address)||void 0===v?void 0:v.addressLineOne,","," ",null===(k=y.address)||void 0===k?void 0:k.zipCode," ",null===(A=y.address)||void 0===A?void 0:A.city]}),e(u,{className:"mb-0 mt-[4px] text-[16px] leading-[24px] text-gray-500",children:y.phone})]})}),e("tr",{children:e("td",{align:"center",children:a(h,{className:"table-cell h-[44px] w-[56px] align-bottom pt-5",children:[e(l,{className:"pr-[8px]",children:e(d,{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(d,{href:"https://www.instagram.com/madrasbistro/",children:e(o,{alt:"Instagram",height:"36",src:"https://react.email/static/instagram-logo.png",width:"36"})})})]})})})]})})]})})]})},y={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"},reservation:{id:"cm94wbpbm0000itx1iv9k2mqr",referenceId:"PH6LD6",firstname:"Abhishek",lastname:"Shaji",phone:"+48570135862",guests:4,date:new Date("2025-04-07T19:30:00.000Z"),createdAt:"2025-03-22T22:54:40.260Z",acceptedAt:"2025-03-22T23:00:23.456Z",cancelledAt:null},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:"madrasbistro.pl",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"}}};x.PreviewProps=y;export default x;export{x as ReservationConfirmationEmail};
@@ -1,93 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Body, Button, Column, Container, Head, Heading, Hr, Html, Img, Link, Preview, Row, Section, Tailwind, Text, } from "@react-email/components";
3
- import { format } from "date-fns";
4
- const ReservationNotificationEmail = ({ user, member, organization, reservation, }) => {
5
- var _a, _b, _c, _d, _e, _f;
6
- const previewText = `New reservation request for ${organization.name}`;
7
- const formattedDate = format(new Date(reservation.date), "dd.MM.yyyy 'at' HH:mm");
8
- 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: (_a = organization.logoFile) === null || _a === void 0 ? void 0 : _a.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 ", member.firstname, ","] }), _jsx(Text, { className: "text-gray-600 mb-2 text-lg", children: "You have received a new reservation request." })] })] }), _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: "Reservation details" }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: [reservation.firstname, " ", reservation.lastname] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: ["Reference: ", reservation.referenceId] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: ["Date and Time: ", formattedDate] }), _jsxs(Text, { className: "font-semibold text-gray-800 my-0", children: ["Number of Guests: ", reservation.guests] }), _jsx(Text, { className: "text-gray-500 mb-0", children: "Phone" }), _jsx(Text, { className: "font-semibold text-gray-800 my-0", children: reservation.phone }), _jsx(Text, { className: "text-gray-500 mb-0", children: "Email" }), _jsx(Text, { className: "font-semibold text-gray-800 my-0", children: user.email })] }), _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: format(new Date(), "dd.MM.yyyy") }) })] }) }), _jsx(Hr, { className: "border-gray-200 mt-4" }), _jsxs(Section, { className: "mb-6", children: [_jsx(Text, { className: "text-gray-700", children: "Please review and respond to this reservation request as soon as possible." }), _jsx(Button, { href: `https://admin.${(_b = organization.configuration) === null || _b === void 0 ? void 0 : _b.hostname}/admin/reservations/${reservation.id}`, className: "bg-blue-600 rounded py-3 px-5 text-white text-center block mt-4", children: "View Reservation Details" })] })] }), _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: ((_c = organization.logoFile) === null || _c === void 0 ? void 0 : _c.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: [(_d = organization.address) === null || _d === void 0 ? void 0 : _d.addressLineOne, ",", " ", (_e = organization.address) === null || _e === void 0 ? void 0 : _e.zipCode, " ", (_f = organization.address) === null || _f === void 0 ? void 0 : _f.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" }) }) })] }) }) })] }) })] }) })] }));
9
- };
10
- const previewProps = {
11
- user: {
12
- id: "VD0OJ52f0mdAnm5YePP6BAW6hdbaCjAJ",
13
- name: "Abhishek Shaji",
14
- email: "kontakt@abhishek.pl",
15
- emailVerified: true,
16
- image: "https://lh3.googleusercontent.com/a/ACg8ocKbkCAMTNvMizjXNxcm1aYtBiWnYpCYmU-7aE2Ft_M_uiHheZ5f=s96-c",
17
- createdAt: "2025-03-22T22:54:40.260Z",
18
- updatedAt: "2025-03-22T22:54:40.260Z",
19
- firstname: "Abhishek",
20
- lastname: "Shaji",
21
- },
22
- member: {
23
- id: "KL9MN52f0mdOnp8YeQR7CAX5hdbdDkBP",
24
- name: "John Doe",
25
- email: "john@madrasbistro.pl",
26
- emailVerified: true,
27
- image: null,
28
- createdAt: "2025-03-20T10:30:15.123Z",
29
- updatedAt: "2025-03-20T10:30:15.123Z",
30
- firstname: "John",
31
- lastname: "Doe",
32
- },
33
- reservation: {
34
- id: "cm94wbpbm0000itx1iv9k2mqr",
35
- referenceId: "PH6LD6",
36
- firstname: "Abhishek",
37
- lastname: "Shaji",
38
- phone: "+48570135862",
39
- guests: 4,
40
- date: new Date("2025-04-07T19:30:00.000Z"),
41
- createdAt: "2025-03-22T22:54:40.260Z",
42
- acceptedAt: null,
43
- cancelledAt: null,
44
- },
45
- organization: {
46
- id: "cm8kthfdq0001lg03b59mdy7b",
47
- name: "Madras Bistro",
48
- phone: "+48570135862",
49
- email: "contact@madrasbistro.pl",
50
- createdAt: "2025-03-22T23:05:14.271Z",
51
- legalEntityId: null,
52
- address: {
53
- id: "cm8kthfdr0002lg0350ijialt",
54
- firstname: null,
55
- lastname: null,
56
- phone: null,
57
- addressLineOne: "Plac Bohaterów Getta 2",
58
- doorNumber: null,
59
- addressLineTwo: "3",
60
- zipCode: "33-332",
61
- city: "Kraków",
62
- country: "PL",
63
- placeId: "ChIJf-nsRkRbFkcR21gtObFSSSA",
64
- deliveryInstructions: null,
65
- },
66
- configuration: {
67
- id: "cm8kthfdr0003lg03ghgs262n",
68
- hostname: "madrasbistro.pl",
69
- countriesShipping: ["us"],
70
- stripeAccountId: "null",
71
- enableHostCheckout: false,
72
- enableHostTracking: false,
73
- isAcceptingOrders: false,
74
- defaultLocale: "en",
75
- supportedLocales: ["en", "pl"],
76
- defaultCurrency: "PLN",
77
- createdAt: "2025-03-22T23:05:14.271Z",
78
- },
79
- logo: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",
80
- logoFile: {
81
- id: "cm8ktmu890005lg0356gwclfk",
82
- url: "https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",
83
- mimeType: "image/png",
84
- size: 1652289,
85
- filename: "logo.png",
86
- },
87
- },
88
- };
89
- // Fixed the TypeScript error by using proper type assertion
90
- ReservationNotificationEmail.PreviewProps = previewProps;
91
- export default ReservationNotificationEmail;
92
- export { ReservationNotificationEmail };
93
- //# sourceMappingURL=reservation-notification.email.js.map
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Body as t,Button as l,Column as r,Container as s,Head as i,Heading as n,Hr as c,Html as d,Img as o,Link as m,Preview as h,Row as g,Section as p,Tailwind as b,Text as u}from"@react-email/components";import{format as x}from"date-fns";const f=({user:f,member:y,organization:N,reservation:w})=>{var v,k,A,j,F,P;const T=`New reservation request for ${N.name}`,C=x(new Date(w.date),"dd.MM.yyyy 'at' HH:mm");return a(d,{children:[e(i,{}),e(h,{children:T}),e(b,{children:a(t,{className:"bg-gray-50 font-sans",children:[a(s,{className:"bg-gray-50 p-6 max-w-[600px]",children:[e(p,{className:"mb-6",children:a(g,{children:[e(r,{className:"w-[80%]",children:e(o,{alt:`${N.name} logo`,height:"100",src:null===(v=N.logoFile)||void 0===v?void 0:v.url,className:"rounded-lg"})}),e(r,{align:"right",children:a(g,{align:"right",children:[e(r,{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(r,{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"})})})]})})]})}),a(p,{children:[a(n,{className:"text-3xl font-bold text-gray-800 mb-0",children:["Hi ",y.firstname,","]}),e(u,{className:"text-gray-600 mb-2 text-lg",children:"You have received a new reservation request."})]})]}),a(s,{className:"mx-auto max-w-[600px] rounded-xl bg-white px-6",children:[e(p,{className:"mb-6",children:a(g,{children:[a(r,{className:"w-[60%]",children:[e(u,{className:"text-gray-500 mb-0",children:"Reservation details"}),a(u,{className:"font-semibold text-gray-800 my-0",children:[w.firstname," ",w.lastname]}),a(u,{className:"font-semibold text-gray-800 my-0",children:["Reference: ",w.referenceId]}),a(u,{className:"font-semibold text-gray-800 my-0",children:["Date and Time: ",C]}),a(u,{className:"font-semibold text-gray-800 my-0",children:["Number of Guests: ",w.guests]}),e(u,{className:"text-gray-500 mb-0",children:"Phone"}),e(u,{className:"font-semibold text-gray-800 my-0",children:w.phone}),e(u,{className:"text-gray-500 mb-0",children:"Email"}),e(u,{className:"font-semibold text-gray-800 my-0",children:f.email})]}),e(r,{className:"w-[40%] p-0 mt-0",align:"right",valign:"top",children:e(u,{className:"text-gray-500 mb-0 pt-1",children:x(new Date,"dd.MM.yyyy")})})]})}),e(c,{className:"border-gray-200 mt-4"}),a(p,{className:"mb-6",children:[e(u,{className:"text-gray-700",children:"Please review and respond to this reservation request as soon as possible."}),e(l,{href:`https://admin.${null===(k=N.configuration)||void 0===k?void 0:k.hostname}/admin/reservations/${w.id}`,className:"bg-blue-600 rounded py-3 px-5 text-white text-center block mt-4",children:"View Reservation Details"})]})]}),e(p,{className:"text-center bg-gray-50 py-5",children:a("table",{className:"w-full",children:[e("tr",{className:"w-full",children:e("td",{align:"center",children:(null===(A=N.logoFile)||void 0===A?void 0:A.url)&&e(o,{alt:`${N.name} logo`,height:"100",src:N.logoFile.url,className:"rounded-lg"})})}),e("tr",{className:"w-full",children:a("td",{align:"center",children:[e(u,{className:"my-[8px] text-[16px] font-semibold text-xl pt-2 text-gray-900",children:N.name}),a(u,{className:"my-[8px] text-[16px] leading-[24px] text-gray-500",children:[null===(j=N.address)||void 0===j?void 0:j.addressLineOne,","," ",null===(F=N.address)||void 0===F?void 0:F.zipCode," ",null===(P=N.address)||void 0===P?void 0:P.city]}),e(u,{className:"mb-0 mt-[4px] text-[16px] leading-[24px] text-gray-500",children:N.phone})]})}),e("tr",{children:e("td",{align:"center",children:a(g,{className:"table-cell h-[44px] w-[56px] align-bottom pt-5",children:[e(r,{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(r,{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"})})})]})})})]})})]})})]})},y={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"},member:{id:"KL9MN52f0mdOnp8YeQR7CAX5hdbdDkBP",name:"John Doe",email:"john@madrasbistro.pl",emailVerified:!0,image:null,createdAt:"2025-03-20T10:30:15.123Z",updatedAt:"2025-03-20T10:30:15.123Z",firstname:"John",lastname:"Doe"},reservation:{id:"cm94wbpbm0000itx1iv9k2mqr",referenceId:"PH6LD6",firstname:"Abhishek",lastname:"Shaji",phone:"+48570135862",guests:4,date:new Date("2025-04-07T19:30:00.000Z"),createdAt:"2025-03-22T22:54:40.260Z",acceptedAt:null,cancelledAt:null},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:"madrasbistro.pl",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"}}};f.PreviewProps=y;export default f;export{f as ReservationNotificationEmail};
@@ -1,65 +1 @@
1
- import { __awaiter } from "tslib";
2
- import { createApiRouter } from "../../core/hono/hono";
3
- import { reservationRoute } from "./reservation.route";
4
- import { ReservationService } from "./reservation.service";
5
- export const buildReservationHandler = (prisma, resendApiKey) => {
6
- const app = createApiRouter();
7
- app.openapi(reservationRoute.createReservation, (c) => __awaiter(void 0, void 0, void 0, function* () {
8
- const auth = c.get("auth");
9
- const body = c.req.valid("json");
10
- const params = c.req.valid("param");
11
- let user = null;
12
- try {
13
- user = yield auth.getCurrentUser();
14
- }
15
- catch (error) {
16
- // User is not logged in but can still create reservations as a guest
17
- }
18
- const service = new ReservationService(prisma, resendApiKey);
19
- const reservation = yield service.createReservation(params.organizationId, user, body);
20
- return c.json(reservation, 201);
21
- }));
22
- app.openapi(reservationRoute.getReservation, (c) => __awaiter(void 0, void 0, void 0, function* () {
23
- const auth = c.get("auth");
24
- const params = c.req.valid("param");
25
- const user = yield auth.getCurrentUser();
26
- const service = new ReservationService(prisma, resendApiKey);
27
- const reservation = yield service.getReservation(user, params.organizationId, params.reservationId);
28
- return c.json(reservation, 200);
29
- }));
30
- app.openapi(reservationRoute.getReservations, (c) => __awaiter(void 0, void 0, void 0, function* () {
31
- const auth = c.get("auth");
32
- const params = c.req.valid("param");
33
- const query = c.req.valid("query");
34
- yield auth.isGranted("read");
35
- const service = new ReservationService(prisma, resendApiKey);
36
- const reservations = yield service.getReservations(params.organizationId, query);
37
- return c.json(reservations, 200);
38
- }));
39
- app.openapi(reservationRoute.getUserReservations, (c) => __awaiter(void 0, void 0, void 0, function* () {
40
- const auth = c.get("auth");
41
- const params = c.req.valid("param");
42
- yield auth.isGranted("read");
43
- const service = new ReservationService(prisma, resendApiKey);
44
- const reservations = yield service.getUserReservations(params.userId, params.organizationId);
45
- return c.json(reservations, 200);
46
- }));
47
- app.openapi(reservationRoute.updateReservationStatus, (c) => __awaiter(void 0, void 0, void 0, function* () {
48
- const auth = c.get("auth");
49
- const params = c.req.valid("param");
50
- yield auth.isGranted("update");
51
- const service = new ReservationService(prisma, resendApiKey);
52
- const reservation = yield service.updateStatus(params.organizationId, params.reservationId, params.operation);
53
- return c.json(reservation, 200);
54
- }));
55
- app.openapi(reservationRoute.deleteReservation, (c) => __awaiter(void 0, void 0, void 0, function* () {
56
- const auth = c.get("auth");
57
- const params = c.req.valid("param");
58
- yield auth.isGranted("delete");
59
- const service = new ReservationService(prisma, resendApiKey);
60
- yield service.deleteReservation(params.organizationId, params.reservationId);
61
- return c.body(null, 204);
62
- }));
63
- return app;
64
- };
65
- //# sourceMappingURL=reservation.handler.js.map
1
+ import{__awaiter as e}from"tslib";import{createApiRouter as t}from"../../core/hono/hono";import{reservationRoute as o}from"./reservation.route";import{ReservationService as i}from"./reservation.service";export const buildReservationHandler=(n,r)=>{const a=t();return a.openapi(o.createReservation,t=>e(void 0,void 0,void 0,function*(){const e=t.get("auth"),o=t.req.valid("json"),a=t.req.valid("param");let d=null;try{d=yield e.getCurrentUser()}catch(e){}const s=new i(n,r),v=yield s.createReservation(a.organizationId,d,o);return t.json(v,201)})),a.openapi(o.getReservation,t=>e(void 0,void 0,void 0,function*(){const e=t.get("auth"),o=t.req.valid("param"),a=yield e.getCurrentUser(),d=new i(n,r),s=yield d.getReservation(a,o.organizationId,o.reservationId);return t.json(s,200)})),a.openapi(o.getReservations,t=>e(void 0,void 0,void 0,function*(){const e=t.get("auth"),o=t.req.valid("param"),a=t.req.valid("query");yield e.isGranted("read");const d=new i(n,r),s=yield d.getReservations(o.organizationId,a);return t.json(s,200)})),a.openapi(o.getUserReservations,t=>e(void 0,void 0,void 0,function*(){const e=t.get("auth"),o=t.req.valid("param");yield e.isGranted("read");const a=new i(n,r),d=yield a.getUserReservations(o.userId,o.organizationId);return t.json(d,200)})),a.openapi(o.updateReservationStatus,t=>e(void 0,void 0,void 0,function*(){const e=t.get("auth"),o=t.req.valid("param");yield e.isGranted("update");const a=new i(n,r),d=yield a.updateStatus(o.organizationId,o.reservationId,o.operation);return t.json(d,200)})),a.openapi(o.deleteReservation,t=>e(void 0,void 0,void 0,function*(){const e=t.get("auth"),o=t.req.valid("param");yield e.isGranted("delete");const a=new i(n,r);return yield a.deleteReservation(o.organizationId,o.reservationId),t.body(null,204)})),a};
@@ -1,167 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- import { createApiRoute } from "../../core/hono/hono";
3
- import { CreateReservationSchema, ErrorSchema, HeaderSchema, OrganizationParams, PaginationMetaSchema, PaginationQuerySchema, ReservationSchema, } from "../../schemas";
4
- const reservationParams = z.object({
5
- organizationId: z.string().openapi({
6
- description: "Organization ID",
7
- example: "clj1234567890abcdef",
8
- param: {
9
- in: "path",
10
- name: "organizationId",
11
- },
12
- }),
13
- reservationId: z.string().openapi({
14
- description: "Reservation ID",
15
- example: "clj1234567890abcdef",
16
- param: {
17
- in: "path",
18
- name: "reservationId",
19
- },
20
- }),
21
- });
22
- const userReservationParams = z.object({
23
- organizationId: z.string().openapi({
24
- description: "Organization ID",
25
- example: "clj1234567890abcdef",
26
- param: {
27
- in: "path",
28
- name: "organizationId",
29
- },
30
- }),
31
- userId: z.string().openapi({
32
- description: "User ID",
33
- example: "clj1234567890abcdef",
34
- param: {
35
- in: "path",
36
- name: "userId",
37
- },
38
- }),
39
- });
40
- const updateReservationStatusParams = reservationParams.extend({
41
- operation: z.enum(["accept", "cancel"]).openapi({
42
- description: "Operation",
43
- example: "accept",
44
- param: {
45
- in: "path",
46
- name: "operation",
47
- },
48
- }),
49
- });
50
- const createReservationRoute = createApiRoute({
51
- body: CreateReservationSchema,
52
- description: "Create a new reservation",
53
- headers: HeaderSchema,
54
- method: "POST",
55
- operationId: "createReservation",
56
- path: "/:organizationId/reservations",
57
- pathParams: OrganizationParams,
58
- responses: {
59
- 201: ReservationSchema,
60
- 400: ErrorSchema,
61
- 401: ErrorSchema,
62
- 500: ErrorSchema,
63
- },
64
- summary: "Create Reservation",
65
- tags: ["Reservation"],
66
- });
67
- const getReservationRoute = createApiRoute({
68
- description: "Get a specific reservation by ID",
69
- headers: HeaderSchema,
70
- method: "GET",
71
- operationId: "getReservation",
72
- path: "/:organizationId/reservations/:reservationId",
73
- pathParams: reservationParams,
74
- responses: {
75
- 200: ReservationSchema,
76
- 400: ErrorSchema,
77
- 401: ErrorSchema,
78
- 404: ErrorSchema,
79
- 500: ErrorSchema,
80
- },
81
- summary: "Get Reservation",
82
- tags: ["Reservation"],
83
- });
84
- const getReservationsRoute = createApiRoute({
85
- description: "Get all reservations for an organization",
86
- headers: HeaderSchema,
87
- method: "GET",
88
- operationId: "getReservations",
89
- path: "/:organizationId/reservations",
90
- pathParams: OrganizationParams,
91
- query: PaginationQuerySchema,
92
- responses: {
93
- 200: z.object({
94
- list: z.array(ReservationSchema),
95
- meta: PaginationMetaSchema,
96
- }),
97
- 400: ErrorSchema,
98
- 401: ErrorSchema,
99
- 500: ErrorSchema,
100
- },
101
- summary: "Get Reservations",
102
- tags: ["Reservation"],
103
- });
104
- const getUserReservationsRoute = createApiRoute({
105
- description: "Get all reservations for a user",
106
- headers: HeaderSchema,
107
- method: "GET",
108
- operationId: "getUserReservations",
109
- path: "/:organizationId/reservations/user/:userId",
110
- pathParams: userReservationParams,
111
- responses: {
112
- 200: z.array(ReservationSchema),
113
- 400: ErrorSchema,
114
- 401: ErrorSchema,
115
- 404: ErrorSchema,
116
- 500: ErrorSchema,
117
- },
118
- summary: "Get User Reservations",
119
- tags: ["Reservation"],
120
- });
121
- const updateReservationStatusRoute = createApiRoute({
122
- body: z.object({}).optional(),
123
- bodyRequired: false,
124
- description: "Update the status of a reservation",
125
- headers: HeaderSchema,
126
- method: "PATCH",
127
- operationId: "updateReservationStatus",
128
- path: "/:organizationId/reservations/:reservationId/:operation",
129
- pathParams: updateReservationStatusParams,
130
- responses: {
131
- 200: ReservationSchema,
132
- 400: ErrorSchema,
133
- 401: ErrorSchema,
134
- 404: ErrorSchema,
135
- 500: ErrorSchema,
136
- },
137
- summary: "Update Reservation Status",
138
- tags: ["Reservation"],
139
- });
140
- const deleteReservationRoute = createApiRoute({
141
- body: z.object({}).optional(),
142
- bodyRequired: false,
143
- description: "Delete a reservation",
144
- headers: HeaderSchema,
145
- method: "DELETE",
146
- operationId: "deleteReservation",
147
- path: "/:organizationId/reservations/:reservationId",
148
- pathParams: reservationParams,
149
- responses: {
150
- 204: null,
151
- 400: ErrorSchema,
152
- 401: ErrorSchema,
153
- 404: ErrorSchema,
154
- 500: ErrorSchema,
155
- },
156
- summary: "Delete Reservation",
157
- tags: ["Reservation"],
158
- });
159
- export const reservationRoute = {
160
- createReservation: createReservationRoute,
161
- getReservation: getReservationRoute,
162
- getReservations: getReservationsRoute,
163
- getUserReservations: getUserReservationsRoute,
164
- updateReservationStatus: updateReservationStatusRoute,
165
- deleteReservation: deleteReservationRoute,
166
- };
167
- //# sourceMappingURL=reservation.route.js.map
1
+ import{z as e}from"@hono/zod-openapi";import{createApiRoute as a}from"../../core/hono/hono";import{CreateReservationSchema as t,ErrorSchema as r,HeaderSchema as o,OrganizationParams as s,PaginationMetaSchema as n,PaginationQuerySchema as i,ReservationSchema as p}from"../../schemas";const d=e.object({organizationId:e.string().openapi({description:"Organization ID",example:"clj1234567890abcdef",param:{in:"path",name:"organizationId"}}),reservationId:e.string().openapi({description:"Reservation ID",example:"clj1234567890abcdef",param:{in:"path",name:"reservationId"}})}),m=e.object({organizationId:e.string().openapi({description:"Organization ID",example:"clj1234567890abcdef",param:{in:"path",name:"organizationId"}}),userId:e.string().openapi({description:"User ID",example:"clj1234567890abcdef",param:{in:"path",name:"userId"}})}),v=d.extend({operation:e.enum(["accept","cancel"]).openapi({description:"Operation",example:"accept",param:{in:"path",name:"operation"}})}),c=a({body:t,description:"Create a new reservation",headers:o,method:"POST",operationId:"createReservation",path:"/:organizationId/reservations",pathParams:s,responses:{201:p,400:r,401:r,500:r},summary:"Create Reservation",tags:["Reservation"]}),h=a({description:"Get a specific reservation by ID",headers:o,method:"GET",operationId:"getReservation",path:"/:organizationId/reservations/:reservationId",pathParams:d,responses:{200:p,400:r,401:r,404:r,500:r},summary:"Get Reservation",tags:["Reservation"]}),g=a({description:"Get all reservations for an organization",headers:o,method:"GET",operationId:"getReservations",path:"/:organizationId/reservations",pathParams:s,query:i,responses:{200:e.object({list:e.array(p),meta:n}),400:r,401:r,500:r},summary:"Get Reservations",tags:["Reservation"]}),I=a({description:"Get all reservations for a user",headers:o,method:"GET",operationId:"getUserReservations",path:"/:organizationId/reservations/user/:userId",pathParams:m,responses:{200:e.array(p),400:r,401:r,404:r,500:r},summary:"Get User Reservations",tags:["Reservation"]}),R=a({body:e.object({}).optional(),bodyRequired:!1,description:"Update the status of a reservation",headers:o,method:"PATCH",operationId:"updateReservationStatus",path:"/:organizationId/reservations/:reservationId/:operation",pathParams:v,responses:{200:p,400:r,401:r,404:r,500:r},summary:"Update Reservation Status",tags:["Reservation"]}),l=a({body:e.object({}).optional(),bodyRequired:!1,description:"Delete a reservation",headers:o,method:"DELETE",operationId:"deleteReservation",path:"/:organizationId/reservations/:reservationId",pathParams:d,responses:{204:null,400:r,401:r,404:r,500:r},summary:"Delete Reservation",tags:["Reservation"]});export const reservationRoute={createReservation:c,getReservation:h,getReservations:g,getUserReservations:I,updateReservationStatus:R,deleteReservation:l};
@@ -1,51 +1 @@
1
- import { z } from "@hono/zod-openapi";
2
- import { requiredNumber } from "../../schemas/number.schema";
3
- export const ReservationSchema = z
4
- .object({
5
- id: z.string().openapi({
6
- description: "Unique identifier for the order",
7
- example: "clj1234567890abcdef",
8
- }),
9
- firstname: z.string().openapi({
10
- description: "Customer's first name",
11
- example: "John",
12
- }),
13
- lastname: z.string().openapi({
14
- description: "Customer's last name",
15
- example: "Doe",
16
- }),
17
- guests: requiredNumber,
18
- phone: z.string().openapi({
19
- description: "Customer's phone number",
20
- example: "+1234567890",
21
- }),
22
- date: z.coerce.date().openapi({
23
- description: "Reservation date and time",
24
- example: "2023-06-14T16:20:00Z",
25
- }),
26
- referenceId: z.string().openapi({
27
- description: "External reference ID for the order",
28
- example: "ORD-12345",
29
- }),
30
- acceptedAt: z.date().nullable().optional().openapi({
31
- description: "Date when the order was accepted",
32
- example: "2023-06-15T14:30:00Z",
33
- }),
34
- cancelledAt: z.date().nullable().optional().openapi({
35
- description: "Date when the order was cancelled",
36
- example: "2023-06-14T16:20:00Z",
37
- }),
38
- createdAt: z.date().nullable().optional().openapi({
39
- description: "Date when the order was created",
40
- example: "2023-06-14T16:20:00Z",
41
- }),
42
- })
43
- .openapi("Reservation");
44
- export const CreateReservationSchema = ReservationSchema.pick({
45
- firstname: true,
46
- lastname: true,
47
- guests: true,
48
- phone: true,
49
- date: true,
50
- }).openapi("CreateReservation");
51
- //# sourceMappingURL=reservation.schema.js.map
1
+ import{z as e}from"@hono/zod-openapi";import{requiredNumber as a}from"../../schemas/number.schema";export const ReservationSchema=e.object({id:e.string().openapi({description:"Unique identifier for the order",example:"clj1234567890abcdef"}),firstname:e.string().openapi({description:"Customer's first name",example:"John"}),lastname:e.string().openapi({description:"Customer's last name",example:"Doe"}),guests:a,phone:e.string().openapi({description:"Customer's phone number",example:"+1234567890"}),date:e.coerce.date().openapi({description:"Reservation date and time",example:"2023-06-14T16:20:00Z"}),referenceId:e.string().openapi({description:"External reference ID for the order",example:"ORD-12345"}),acceptedAt:e.date().nullable().optional().openapi({description:"Date when the order was accepted",example:"2023-06-15T14:30:00Z"}),cancelledAt:e.date().nullable().optional().openapi({description:"Date when the order was cancelled",example:"2023-06-14T16:20:00Z"}),createdAt:e.date().nullable().optional().openapi({description:"Date when the order was created",example:"2023-06-14T16:20:00Z"})}).openapi("Reservation");export const CreateReservationSchema=ReservationSchema.pick({firstname:!0,lastname:!0,guests:!0,phone:!0,date:!0}).openapi("CreateReservation");