@open-mercato/core 0.4.8-develop-6b37dabfa2 → 0.4.8-develop-84f3678a58

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 (330) hide show
  1. package/agentic/standalone-guide.md +235 -0
  2. package/dist/generated/entities/customer_role/index.js +27 -0
  3. package/dist/generated/entities/customer_role/index.js.map +7 -0
  4. package/dist/generated/entities/customer_role_acl/index.js +19 -0
  5. package/dist/generated/entities/customer_role_acl/index.js.map +7 -0
  6. package/dist/generated/entities/customer_user/index.js +37 -0
  7. package/dist/generated/entities/customer_user/index.js.map +7 -0
  8. package/dist/generated/entities/customer_user_acl/index.js +19 -0
  9. package/dist/generated/entities/customer_user_acl/index.js.map +7 -0
  10. package/dist/generated/entities/customer_user_email_verification/index.js +17 -0
  11. package/dist/generated/entities/customer_user_email_verification/index.js.map +7 -0
  12. package/dist/generated/entities/customer_user_invitation/index.js +33 -0
  13. package/dist/generated/entities/customer_user_invitation/index.js.map +7 -0
  14. package/dist/generated/entities/customer_user_password_reset/index.js +15 -0
  15. package/dist/generated/entities/customer_user_password_reset/index.js.map +7 -0
  16. package/dist/generated/entities/customer_user_role/index.js +13 -0
  17. package/dist/generated/entities/customer_user_role/index.js.map +7 -0
  18. package/dist/generated/entities/customer_user_session/index.js +21 -0
  19. package/dist/generated/entities/customer_user_session/index.js.map +7 -0
  20. package/dist/generated/entities/organization/index.js +2 -0
  21. package/dist/generated/entities/organization/index.js.map +2 -2
  22. package/dist/generated/entities.ids.generated.js +14 -1
  23. package/dist/generated/entities.ids.generated.js.map +2 -2
  24. package/dist/generated/entity-fields-registry.js +18 -0
  25. package/dist/generated/entity-fields-registry.js.map +2 -2
  26. package/dist/modules/auth/services/rbacService.js +3 -9
  27. package/dist/modules/auth/services/rbacService.js.map +2 -2
  28. package/dist/modules/customer_accounts/acl.js +12 -0
  29. package/dist/modules/customer_accounts/acl.js.map +7 -0
  30. package/dist/modules/customer_accounts/api/admin/roles/[id]/acl.js +87 -0
  31. package/dist/modules/customer_accounts/api/admin/roles/[id]/acl.js.map +7 -0
  32. package/dist/modules/customer_accounts/api/admin/roles/[id].js +216 -0
  33. package/dist/modules/customer_accounts/api/admin/roles/[id].js.map +7 -0
  34. package/dist/modules/customer_accounts/api/admin/roles.js +189 -0
  35. package/dist/modules/customer_accounts/api/admin/roles.js.map +7 -0
  36. package/dist/modules/customer_accounts/api/admin/users/[id]/reset-password.js +69 -0
  37. package/dist/modules/customer_accounts/api/admin/users/[id]/reset-password.js.map +7 -0
  38. package/dist/modules/customer_accounts/api/admin/users/[id]/verify-email.js +64 -0
  39. package/dist/modules/customer_accounts/api/admin/users/[id]/verify-email.js.map +7 -0
  40. package/dist/modules/customer_accounts/api/admin/users/[id].js +253 -0
  41. package/dist/modules/customer_accounts/api/admin/users/[id].js.map +7 -0
  42. package/dist/modules/customer_accounts/api/admin/users-invite.js +78 -0
  43. package/dist/modules/customer_accounts/api/admin/users-invite.js.map +7 -0
  44. package/dist/modules/customer_accounts/api/admin/users.js +251 -0
  45. package/dist/modules/customer_accounts/api/admin/users.js.map +7 -0
  46. package/dist/modules/customer_accounts/api/email/verify.js +59 -0
  47. package/dist/modules/customer_accounts/api/email/verify.js.map +7 -0
  48. package/dist/modules/customer_accounts/api/interceptors.js +5 -0
  49. package/dist/modules/customer_accounts/api/interceptors.js.map +7 -0
  50. package/dist/modules/customer_accounts/api/invitations/accept.js +114 -0
  51. package/dist/modules/customer_accounts/api/invitations/accept.js.map +7 -0
  52. package/dist/modules/customer_accounts/api/login.js +143 -0
  53. package/dist/modules/customer_accounts/api/login.js.map +7 -0
  54. package/dist/modules/customer_accounts/api/magic-link/request.js +78 -0
  55. package/dist/modules/customer_accounts/api/magic-link/request.js.map +7 -0
  56. package/dist/modules/customer_accounts/api/magic-link/verify.js +114 -0
  57. package/dist/modules/customer_accounts/api/magic-link/verify.js.map +7 -0
  58. package/dist/modules/customer_accounts/api/password/reset-confirm.js +59 -0
  59. package/dist/modules/customer_accounts/api/password/reset-confirm.js.map +7 -0
  60. package/dist/modules/customer_accounts/api/password/reset-request.js +77 -0
  61. package/dist/modules/customer_accounts/api/password/reset-request.js.map +7 -0
  62. package/dist/modules/customer_accounts/api/portal/events/stream.js +163 -0
  63. package/dist/modules/customer_accounts/api/portal/events/stream.js.map +7 -0
  64. package/dist/modules/customer_accounts/api/portal/feature-check.js +57 -0
  65. package/dist/modules/customer_accounts/api/portal/feature-check.js.map +7 -0
  66. package/dist/modules/customer_accounts/api/portal/logout.js +64 -0
  67. package/dist/modules/customer_accounts/api/portal/logout.js.map +7 -0
  68. package/dist/modules/customer_accounts/api/portal/notifications/[id]/dismiss.js +49 -0
  69. package/dist/modules/customer_accounts/api/portal/notifications/[id]/dismiss.js.map +7 -0
  70. package/dist/modules/customer_accounts/api/portal/notifications/[id]/read.js +49 -0
  71. package/dist/modules/customer_accounts/api/portal/notifications/[id]/read.js.map +7 -0
  72. package/dist/modules/customer_accounts/api/portal/notifications/mark-all-read.js +46 -0
  73. package/dist/modules/customer_accounts/api/portal/notifications/mark-all-read.js.map +7 -0
  74. package/dist/modules/customer_accounts/api/portal/notifications/unread-count.js +42 -0
  75. package/dist/modules/customer_accounts/api/portal/notifications/unread-count.js.map +7 -0
  76. package/dist/modules/customer_accounts/api/portal/notifications.js +105 -0
  77. package/dist/modules/customer_accounts/api/portal/notifications.js.map +7 -0
  78. package/dist/modules/customer_accounts/api/portal/password-change.js +57 -0
  79. package/dist/modules/customer_accounts/api/portal/password-change.js.map +7 -0
  80. package/dist/modules/customer_accounts/api/portal/profile.js +135 -0
  81. package/dist/modules/customer_accounts/api/portal/profile.js.map +7 -0
  82. package/dist/modules/customer_accounts/api/portal/sessions/[id].js +62 -0
  83. package/dist/modules/customer_accounts/api/portal/sessions/[id].js.map +7 -0
  84. package/dist/modules/customer_accounts/api/portal/sessions-refresh.js +75 -0
  85. package/dist/modules/customer_accounts/api/portal/sessions-refresh.js.map +7 -0
  86. package/dist/modules/customer_accounts/api/portal/sessions.js +77 -0
  87. package/dist/modules/customer_accounts/api/portal/sessions.js.map +7 -0
  88. package/dist/modules/customer_accounts/api/portal/users/[id]/roles.js +90 -0
  89. package/dist/modules/customer_accounts/api/portal/users/[id]/roles.js.map +7 -0
  90. package/dist/modules/customer_accounts/api/portal/users/[id].js +71 -0
  91. package/dist/modules/customer_accounts/api/portal/users/[id].js.map +7 -0
  92. package/dist/modules/customer_accounts/api/portal/users-invite.js +92 -0
  93. package/dist/modules/customer_accounts/api/portal/users-invite.js.map +7 -0
  94. package/dist/modules/customer_accounts/api/portal/users.js +79 -0
  95. package/dist/modules/customer_accounts/api/portal/users.js.map +7 -0
  96. package/dist/modules/customer_accounts/api/signup.js +121 -0
  97. package/dist/modules/customer_accounts/api/signup.js.map +7 -0
  98. package/dist/modules/customer_accounts/backend/customer_accounts/[id]/page.js +491 -0
  99. package/dist/modules/customer_accounts/backend/customer_accounts/[id]/page.js.map +7 -0
  100. package/dist/modules/customer_accounts/backend/customer_accounts/[id]/page.meta.js +15 -0
  101. package/dist/modules/customer_accounts/backend/customer_accounts/[id]/page.meta.js.map +7 -0
  102. package/dist/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.js +343 -0
  103. package/dist/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.js.map +7 -0
  104. package/dist/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.meta.js +16 -0
  105. package/dist/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.meta.js.map +7 -0
  106. package/dist/modules/customer_accounts/backend/customer_accounts/roles/create/page.js +180 -0
  107. package/dist/modules/customer_accounts/backend/customer_accounts/roles/create/page.js.map +7 -0
  108. package/dist/modules/customer_accounts/backend/customer_accounts/roles/create/page.meta.js +16 -0
  109. package/dist/modules/customer_accounts/backend/customer_accounts/roles/create/page.meta.js.map +7 -0
  110. package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js +176 -0
  111. package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js.map +7 -0
  112. package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.meta.js +33 -0
  113. package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.meta.js.map +7 -0
  114. package/dist/modules/customer_accounts/backend/page.js +466 -0
  115. package/dist/modules/customer_accounts/backend/page.js.map +7 -0
  116. package/dist/modules/customer_accounts/backend/page.meta.js +35 -0
  117. package/dist/modules/customer_accounts/backend/page.meta.js.map +7 -0
  118. package/dist/modules/customer_accounts/ce.js +26 -0
  119. package/dist/modules/customer_accounts/ce.js.map +7 -0
  120. package/dist/modules/customer_accounts/data/enrichers.js +85 -0
  121. package/dist/modules/customer_accounts/data/enrichers.js.map +7 -0
  122. package/dist/modules/customer_accounts/data/entities.js +377 -0
  123. package/dist/modules/customer_accounts/data/entities.js.map +7 -0
  124. package/dist/modules/customer_accounts/data/extensions.js +8 -0
  125. package/dist/modules/customer_accounts/data/extensions.js.map +7 -0
  126. package/dist/modules/customer_accounts/data/validators.js +111 -0
  127. package/dist/modules/customer_accounts/data/validators.js.map +7 -0
  128. package/dist/modules/customer_accounts/di.js +17 -0
  129. package/dist/modules/customer_accounts/di.js.map +7 -0
  130. package/dist/modules/customer_accounts/events.js +28 -0
  131. package/dist/modules/customer_accounts/events.js.map +7 -0
  132. package/dist/modules/customer_accounts/index.js +15 -0
  133. package/dist/modules/customer_accounts/index.js.map +7 -0
  134. package/dist/modules/customer_accounts/lib/customerAuth.js +71 -0
  135. package/dist/modules/customer_accounts/lib/customerAuth.js.map +7 -0
  136. package/dist/modules/customer_accounts/lib/customerAuthServer.js +29 -0
  137. package/dist/modules/customer_accounts/lib/customerAuthServer.js.map +7 -0
  138. package/dist/modules/customer_accounts/lib/rateLimiter.js +63 -0
  139. package/dist/modules/customer_accounts/lib/rateLimiter.js.map +7 -0
  140. package/dist/modules/customer_accounts/lib/tokenGenerator.js +12 -0
  141. package/dist/modules/customer_accounts/lib/tokenGenerator.js.map +7 -0
  142. package/dist/modules/customer_accounts/migrations/Migration20260313222043.js +49 -0
  143. package/dist/modules/customer_accounts/migrations/Migration20260313222043.js.map +7 -0
  144. package/dist/modules/customer_accounts/notifications.client.js +47 -0
  145. package/dist/modules/customer_accounts/notifications.client.js.map +7 -0
  146. package/dist/modules/customer_accounts/notifications.js +46 -0
  147. package/dist/modules/customer_accounts/notifications.js.map +7 -0
  148. package/dist/modules/customer_accounts/search.js +120 -0
  149. package/dist/modules/customer_accounts/search.js.map +7 -0
  150. package/dist/modules/customer_accounts/services/customerInvitationService.js +87 -0
  151. package/dist/modules/customer_accounts/services/customerInvitationService.js.map +7 -0
  152. package/dist/modules/customer_accounts/services/customerRbacService.js +109 -0
  153. package/dist/modules/customer_accounts/services/customerRbacService.js.map +7 -0
  154. package/dist/modules/customer_accounts/services/customerSessionService.js +75 -0
  155. package/dist/modules/customer_accounts/services/customerSessionService.js.map +7 -0
  156. package/dist/modules/customer_accounts/services/customerTokenService.js +91 -0
  157. package/dist/modules/customer_accounts/services/customerTokenService.js.map +7 -0
  158. package/dist/modules/customer_accounts/services/customerUserService.js +92 -0
  159. package/dist/modules/customer_accounts/services/customerUserService.js.map +7 -0
  160. package/dist/modules/customer_accounts/setup.js +179 -0
  161. package/dist/modules/customer_accounts/setup.js.map +7 -0
  162. package/dist/modules/customer_accounts/subscribers/autoLinkCrm.js +54 -0
  163. package/dist/modules/customer_accounts/subscribers/autoLinkCrm.js.map +7 -0
  164. package/dist/modules/customer_accounts/subscribers/autoLinkCrmReverse.js +68 -0
  165. package/dist/modules/customer_accounts/subscribers/autoLinkCrmReverse.js.map +7 -0
  166. package/dist/modules/customer_accounts/subscribers/notifyStaffOnSignup.js +29 -0
  167. package/dist/modules/customer_accounts/subscribers/notifyStaffOnSignup.js.map +7 -0
  168. package/dist/modules/customer_accounts/translations.js +9 -0
  169. package/dist/modules/customer_accounts/translations.js.map +7 -0
  170. package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js +63 -0
  171. package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js.map +7 -0
  172. package/dist/modules/customer_accounts/widgets/injection/account-status/widget.js +17 -0
  173. package/dist/modules/customer_accounts/widgets/injection/account-status/widget.js.map +7 -0
  174. package/dist/modules/customer_accounts/widgets/injection/company-users/widget.client.js +55 -0
  175. package/dist/modules/customer_accounts/widgets/injection/company-users/widget.client.js.map +7 -0
  176. package/dist/modules/customer_accounts/widgets/injection/company-users/widget.js +17 -0
  177. package/dist/modules/customer_accounts/widgets/injection/company-users/widget.js.map +7 -0
  178. package/dist/modules/customer_accounts/widgets/injection-table.js +26 -0
  179. package/dist/modules/customer_accounts/widgets/injection-table.js.map +7 -0
  180. package/dist/modules/customer_accounts/workers/cleanupExpiredSessions.js +23 -0
  181. package/dist/modules/customer_accounts/workers/cleanupExpiredSessions.js.map +7 -0
  182. package/dist/modules/customer_accounts/workers/cleanupExpiredTokens.js +38 -0
  183. package/dist/modules/customer_accounts/workers/cleanupExpiredTokens.js.map +7 -0
  184. package/dist/modules/directory/api/get/organizations/lookup.js +83 -0
  185. package/dist/modules/directory/api/get/organizations/lookup.js.map +7 -0
  186. package/dist/modules/directory/commands/organizations.js +32 -1
  187. package/dist/modules/directory/commands/organizations.js.map +2 -2
  188. package/dist/modules/directory/data/entities.js +6 -2
  189. package/dist/modules/directory/data/entities.js.map +2 -2
  190. package/dist/modules/directory/data/validators.js +3 -0
  191. package/dist/modules/directory/data/validators.js.map +2 -2
  192. package/dist/modules/directory/migrations/Migration20260314143323.js +15 -0
  193. package/dist/modules/directory/migrations/Migration20260314143323.js.map +7 -0
  194. package/dist/modules/directory/setup.js +36 -0
  195. package/dist/modules/directory/setup.js.map +2 -2
  196. package/dist/modules/payment_gateways/migrations/Migration20260313222043.js +15 -0
  197. package/dist/modules/payment_gateways/migrations/Migration20260313222043.js.map +7 -0
  198. package/dist/modules/portal/frontend/[orgSlug]/portal/dashboard/page.js +131 -0
  199. package/dist/modules/portal/frontend/[orgSlug]/portal/dashboard/page.js.map +7 -0
  200. package/dist/modules/portal/frontend/[orgSlug]/portal/login/page.js +96 -0
  201. package/dist/modules/portal/frontend/[orgSlug]/portal/login/page.js.map +7 -0
  202. package/dist/modules/portal/frontend/[orgSlug]/portal/page.js +94 -0
  203. package/dist/modules/portal/frontend/[orgSlug]/portal/page.js.map +7 -0
  204. package/dist/modules/portal/frontend/[orgSlug]/portal/profile/page.js +89 -0
  205. package/dist/modules/portal/frontend/[orgSlug]/portal/profile/page.js.map +7 -0
  206. package/dist/modules/portal/frontend/[orgSlug]/portal/signup/page.js +104 -0
  207. package/dist/modules/portal/frontend/[orgSlug]/portal/signup/page.js.map +7 -0
  208. package/dist/modules/portal/index.js +11 -0
  209. package/dist/modules/portal/index.js.map +7 -0
  210. package/dist/modules/portal/setup.js +23 -0
  211. package/dist/modules/portal/setup.js.map +7 -0
  212. package/generated/entities/customer_role/index.ts +12 -0
  213. package/generated/entities/customer_role_acl/index.ts +8 -0
  214. package/generated/entities/customer_user/index.ts +17 -0
  215. package/generated/entities/customer_user_acl/index.ts +8 -0
  216. package/generated/entities/customer_user_email_verification/index.ts +7 -0
  217. package/generated/entities/customer_user_invitation/index.ts +15 -0
  218. package/generated/entities/customer_user_password_reset/index.ts +6 -0
  219. package/generated/entities/customer_user_role/index.ts +5 -0
  220. package/generated/entities/customer_user_session/index.ts +9 -0
  221. package/generated/entities/organization/index.ts +1 -0
  222. package/generated/entities.ids.generated.ts +14 -1
  223. package/generated/entity-fields-registry.ts +18 -0
  224. package/package.json +3 -3
  225. package/src/modules/auth/services/rbacService.ts +3 -9
  226. package/src/modules/customer_accounts/AGENTS.md +377 -0
  227. package/src/modules/customer_accounts/acl.ts +8 -0
  228. package/src/modules/customer_accounts/api/admin/roles/[id]/acl.ts +98 -0
  229. package/src/modules/customer_accounts/api/admin/roles/[id].ts +246 -0
  230. package/src/modules/customer_accounts/api/admin/roles.ts +212 -0
  231. package/src/modules/customer_accounts/api/admin/users/[id]/reset-password.ts +78 -0
  232. package/src/modules/customer_accounts/api/admin/users/[id]/verify-email.ts +72 -0
  233. package/src/modules/customer_accounts/api/admin/users/[id].ts +289 -0
  234. package/src/modules/customer_accounts/api/admin/users-invite.ts +86 -0
  235. package/src/modules/customer_accounts/api/admin/users.ts +280 -0
  236. package/src/modules/customer_accounts/api/email/verify.ts +66 -0
  237. package/src/modules/customer_accounts/api/interceptors.ts +3 -0
  238. package/src/modules/customer_accounts/api/invitations/accept.ts +128 -0
  239. package/src/modules/customer_accounts/api/login.ts +163 -0
  240. package/src/modules/customer_accounts/api/magic-link/request.ts +87 -0
  241. package/src/modules/customer_accounts/api/magic-link/verify.ts +132 -0
  242. package/src/modules/customer_accounts/api/password/reset-confirm.ts +69 -0
  243. package/src/modules/customer_accounts/api/password/reset-request.ts +87 -0
  244. package/src/modules/customer_accounts/api/portal/events/stream.ts +209 -0
  245. package/src/modules/customer_accounts/api/portal/feature-check.ts +60 -0
  246. package/src/modules/customer_accounts/api/portal/logout.ts +71 -0
  247. package/src/modules/customer_accounts/api/portal/notifications/[id]/dismiss.ts +54 -0
  248. package/src/modules/customer_accounts/api/portal/notifications/[id]/read.ts +54 -0
  249. package/src/modules/customer_accounts/api/portal/notifications/mark-all-read.ts +49 -0
  250. package/src/modules/customer_accounts/api/portal/notifications/unread-count.ts +45 -0
  251. package/src/modules/customer_accounts/api/portal/notifications.ts +115 -0
  252. package/src/modules/customer_accounts/api/portal/password-change.ts +65 -0
  253. package/src/modules/customer_accounts/api/portal/profile.ts +151 -0
  254. package/src/modules/customer_accounts/api/portal/sessions/[id].ts +70 -0
  255. package/src/modules/customer_accounts/api/portal/sessions-refresh.ts +87 -0
  256. package/src/modules/customer_accounts/api/portal/sessions.ts +84 -0
  257. package/src/modules/customer_accounts/api/portal/users/[id]/roles.ts +106 -0
  258. package/src/modules/customer_accounts/api/portal/users/[id].ts +81 -0
  259. package/src/modules/customer_accounts/api/portal/users-invite.ts +103 -0
  260. package/src/modules/customer_accounts/api/portal/users.ts +86 -0
  261. package/src/modules/customer_accounts/api/signup.ts +136 -0
  262. package/src/modules/customer_accounts/backend/customer_accounts/[id]/page.meta.ts +11 -0
  263. package/src/modules/customer_accounts/backend/customer_accounts/[id]/page.tsx +607 -0
  264. package/src/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.meta.ts +12 -0
  265. package/src/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.tsx +385 -0
  266. package/src/modules/customer_accounts/backend/customer_accounts/roles/create/page.meta.ts +12 -0
  267. package/src/modules/customer_accounts/backend/customer_accounts/roles/create/page.tsx +203 -0
  268. package/src/modules/customer_accounts/backend/customer_accounts/roles/page.meta.ts +31 -0
  269. package/src/modules/customer_accounts/backend/customer_accounts/roles/page.tsx +217 -0
  270. package/src/modules/customer_accounts/backend/page.meta.ts +33 -0
  271. package/src/modules/customer_accounts/backend/page.tsx +535 -0
  272. package/src/modules/customer_accounts/ce.ts +22 -0
  273. package/src/modules/customer_accounts/data/enrichers.ts +117 -0
  274. package/src/modules/customer_accounts/data/entities.ts +302 -0
  275. package/src/modules/customer_accounts/data/extensions.ts +4 -0
  276. package/src/modules/customer_accounts/data/validators.ts +128 -0
  277. package/src/modules/customer_accounts/di.ts +15 -0
  278. package/src/modules/customer_accounts/events.ts +28 -0
  279. package/src/modules/customer_accounts/i18n/de.json +176 -0
  280. package/src/modules/customer_accounts/i18n/en.json +176 -0
  281. package/src/modules/customer_accounts/i18n/es.json +176 -0
  282. package/src/modules/customer_accounts/i18n/pl.json +176 -0
  283. package/src/modules/customer_accounts/index.ts +13 -0
  284. package/src/modules/customer_accounts/lib/customerAuth.ts +85 -0
  285. package/src/modules/customer_accounts/lib/customerAuthServer.ts +54 -0
  286. package/src/modules/customer_accounts/lib/rateLimiter.ts +36 -0
  287. package/src/modules/customer_accounts/lib/tokenGenerator.ts +9 -0
  288. package/src/modules/customer_accounts/migrations/.snapshot-open-mercato.json +1255 -0
  289. package/src/modules/customer_accounts/migrations/Migration20260313222043.ts +62 -0
  290. package/src/modules/customer_accounts/notifications.client.ts +46 -0
  291. package/src/modules/customer_accounts/notifications.ts +44 -0
  292. package/src/modules/customer_accounts/search.ts +134 -0
  293. package/src/modules/customer_accounts/services/customerInvitationService.ts +109 -0
  294. package/src/modules/customer_accounts/services/customerRbacService.ts +144 -0
  295. package/src/modules/customer_accounts/services/customerSessionService.ts +90 -0
  296. package/src/modules/customer_accounts/services/customerTokenService.ts +98 -0
  297. package/src/modules/customer_accounts/services/customerUserService.ts +105 -0
  298. package/src/modules/customer_accounts/setup.ts +212 -0
  299. package/src/modules/customer_accounts/subscribers/autoLinkCrm.ts +65 -0
  300. package/src/modules/customer_accounts/subscribers/autoLinkCrmReverse.ts +78 -0
  301. package/src/modules/customer_accounts/subscribers/notifyStaffOnSignup.ts +32 -0
  302. package/src/modules/customer_accounts/translations.ts +5 -0
  303. package/src/modules/customer_accounts/widgets/injection/account-status/widget.client.tsx +89 -0
  304. package/src/modules/customer_accounts/widgets/injection/account-status/widget.ts +16 -0
  305. package/src/modules/customer_accounts/widgets/injection/company-users/widget.client.tsx +78 -0
  306. package/src/modules/customer_accounts/widgets/injection/company-users/widget.ts +16 -0
  307. package/src/modules/customer_accounts/widgets/injection-table.ts +24 -0
  308. package/src/modules/customer_accounts/workers/cleanupExpiredSessions.ts +33 -0
  309. package/src/modules/customer_accounts/workers/cleanupExpiredTokens.ts +51 -0
  310. package/src/modules/directory/api/get/organizations/lookup.ts +92 -0
  311. package/src/modules/directory/commands/organizations.ts +34 -1
  312. package/src/modules/directory/data/entities.ts +5 -1
  313. package/src/modules/directory/data/validators.ts +4 -0
  314. package/src/modules/directory/migrations/.snapshot-open-mercato.json +20 -1
  315. package/src/modules/directory/migrations/Migration20260314143323.ts +15 -0
  316. package/src/modules/directory/setup.ts +41 -0
  317. package/src/modules/payment_gateways/migrations/.snapshot-open-mercato.json +4 -1
  318. package/src/modules/payment_gateways/migrations/Migration20260313222043.ts +17 -0
  319. package/src/modules/portal/frontend/[orgSlug]/portal/dashboard/page.tsx +158 -0
  320. package/src/modules/portal/frontend/[orgSlug]/portal/login/page.tsx +120 -0
  321. package/src/modules/portal/frontend/[orgSlug]/portal/page.tsx +118 -0
  322. package/src/modules/portal/frontend/[orgSlug]/portal/profile/page.tsx +112 -0
  323. package/src/modules/portal/frontend/[orgSlug]/portal/signup/page.tsx +138 -0
  324. package/src/modules/portal/i18n/de.json +93 -0
  325. package/src/modules/portal/i18n/en.json +93 -0
  326. package/src/modules/portal/i18n/es.json +93 -0
  327. package/src/modules/portal/i18n/pl.json +93 -0
  328. package/src/modules/portal/index.ts +9 -0
  329. package/src/modules/portal/setup.ts +23 -0
  330. package/src/modules/shipping_carriers/migrations/.snapshot-open-mercato.json +226 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/modules/portal/frontend/%5BorgSlug%5D/portal/dashboard/page.tsx"],
4
+ "sourcesContent": ["\"use client\"\nimport React, { useEffect, useMemo, useState, useCallback } from 'react'\nimport { useRouter } from 'next/navigation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { usePortalContext } from '@open-mercato/ui/portal/PortalContext'\nimport { PortalPageHeader } from '@open-mercato/ui/portal/components/PortalPageHeader'\nimport { PortalCard, PortalCardHeader } from '@open-mercato/ui/portal/components/PortalCard'\nimport { PortalEmptyState } from '@open-mercato/ui/portal/components/PortalEmptyState'\nimport { usePortalDashboardWidgets } from '@open-mercato/ui/portal/hooks/usePortalDashboardWidgets'\nimport { InjectionSpot } from '@open-mercato/ui/backend/injection/InjectionSpot'\nimport { PortalInjectionSpots } from '@open-mercato/ui/backend/injection/spotIds'\n\ntype Props = { params: { orgSlug: string } }\n\nconst HIDDEN_WIDGETS_KEY = 'om:portal:dashboard:hidden'\n\nfunction loadHiddenWidgets(): Set<string> {\n try {\n const raw = localStorage.getItem(HIDDEN_WIDGETS_KEY)\n if (!raw) return new Set()\n return new Set(JSON.parse(raw))\n } catch {\n return new Set()\n }\n}\n\nfunction saveHiddenWidgets(hidden: Set<string>) {\n try {\n localStorage.setItem(HIDDEN_WIDGETS_KEY, JSON.stringify(Array.from(hidden)))\n } catch {\n // best effort\n }\n}\n\nfunction WidgetIcon({ className }: { className?: string }) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <rect width=\"7\" height=\"9\" x=\"3\" y=\"3\" rx=\"1\" /><rect width=\"7\" height=\"5\" x=\"14\" y=\"3\" rx=\"1\" /><rect width=\"7\" height=\"5\" x=\"14\" y=\"12\" rx=\"1\" /><rect width=\"7\" height=\"9\" x=\"3\" y=\"16\" rx=\"1\" />\n </svg>\n )\n}\n\nexport default function PortalDashboardPage({ params }: Props) {\n const t = useT()\n const router = useRouter()\n const { auth } = usePortalContext()\n const { user, loading } = auth\n\n const [editing, setEditing] = useState(false)\n const [hiddenWidgets, setHiddenWidgets] = useState<Set<string>>(() => loadHiddenWidgets())\n\n const { widgets: dashboardWidgets, isLoading: widgetsLoading } = usePortalDashboardWidgets('portal:dashboard:sections' as any)\n\n useEffect(() => {\n if (!loading && !user) {\n router.replace(`/${params.orgSlug}/portal/login`)\n }\n }, [loading, user, router, params.orgSlug])\n\n const toggleWidget = useCallback((widgetId: string) => {\n setHiddenWidgets((prev) => {\n const next = new Set(prev)\n if (next.has(widgetId)) {\n next.delete(widgetId)\n } else {\n next.add(widgetId)\n }\n saveHiddenWidgets(next)\n return next\n })\n }, [])\n\n const visibleWidgets = useMemo(\n () => dashboardWidgets.filter((w) => !hiddenWidgets.has(w.metadata.id)),\n [dashboardWidgets, hiddenWidgets],\n )\n\n const injectionContext = useMemo(\n () => ({ orgSlug: params.orgSlug, user, roles: auth.roles, resolvedFeatures: auth.resolvedFeatures }),\n [params.orgSlug, user, auth.roles, auth.resolvedFeatures],\n )\n\n if (loading) {\n return <div className=\"flex items-center justify-center py-20\"><Spinner /></div>\n }\n\n if (!user) return null\n\n return (\n <div className=\"flex flex-col gap-8\">\n <PortalPageHeader\n label={t('portal.dashboard.title', 'Dashboard')}\n title={t('portal.dashboard.welcome', { name: user.displayName })}\n action={\n dashboardWidgets.length > 0 ? (\n <Button\n type=\"button\"\n variant={editing ? 'default' : 'outline'}\n size=\"sm\"\n className=\"rounded-lg text-[13px]\"\n onClick={() => setEditing((prev) => !prev)}\n >\n {editing ? t('portal.dashboard.done', 'Done') : t('portal.dashboard.customize', 'Customize')}\n </Button>\n ) : null\n }\n />\n\n <InjectionSpot spotId={PortalInjectionSpots.pageBefore('dashboard')} context={injectionContext} />\n\n {editing && dashboardWidgets.length > 0 ? (\n <PortalCard>\n <PortalCardHeader\n label={t('portal.dashboard.customize', 'Customize')}\n title={t('portal.dashboard.widgets', 'Dashboard Widgets')}\n />\n <div className=\"flex flex-wrap gap-2\">\n {dashboardWidgets.map((widget) => {\n const isHidden = hiddenWidgets.has(widget.metadata.id)\n return (\n <Button key={widget.metadata.id} type=\"button\" variant={isHidden ? 'outline' : 'default'} size=\"sm\" className=\"rounded-lg text-[13px]\" onClick={() => toggleWidget(widget.metadata.id)}>\n {widget.metadata.title || widget.metadata.id}\n </Button>\n )\n })}\n </div>\n </PortalCard>\n ) : null}\n\n {visibleWidgets.length > 0 ? (\n <div className=\"grid gap-5 md:grid-cols-2 xl:grid-cols-3\">\n {visibleWidgets.map((widget) => {\n const WidgetComponent = widget.Widget\n if (!WidgetComponent) return null\n return (\n <PortalCard key={widget.metadata.id}>\n <PortalCardHeader title={widget.metadata.title || widget.metadata.id} />\n <WidgetComponent context={{ orgSlug: params.orgSlug, user, roles: auth.roles, resolvedFeatures: auth.resolvedFeatures }} />\n </PortalCard>\n )\n })}\n </div>\n ) : null}\n\n {dashboardWidgets.length === 0 && !widgetsLoading ? (\n <PortalEmptyState\n icon={<WidgetIcon className=\"size-5\" />}\n title={t('portal.dashboard.emptyWidgets', 'No dashboard widgets yet')}\n description=\"Modules can inject widgets into this dashboard via the portal:dashboard:sections injection spot.\"\n />\n ) : null}\n\n <InjectionSpot spotId={PortalInjectionSpots.pageAfter('dashboard')} context={injectionContext} />\n </div>\n )\n}\n"],
5
+ "mappings": ";AAsCI,SACE,KADF;AArCJ,SAAgB,WAAW,SAAS,UAAU,mBAAmB;AACjE,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,YAAY,wBAAwB;AAC7C,SAAS,wBAAwB;AACjC,SAAS,iCAAiC;AAC1C,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AAIrC,MAAM,qBAAqB;AAE3B,SAAS,oBAAiC;AACxC,MAAI;AACF,UAAM,MAAM,aAAa,QAAQ,kBAAkB;AACnD,QAAI,CAAC,IAAK,QAAO,oBAAI,IAAI;AACzB,WAAO,IAAI,IAAI,KAAK,MAAM,GAAG,CAAC;AAAA,EAChC,QAAQ;AACN,WAAO,oBAAI,IAAI;AAAA,EACjB;AACF;AAEA,SAAS,kBAAkB,QAAqB;AAC9C,MAAI;AACF,iBAAa,QAAQ,oBAAoB,KAAK,UAAU,MAAM,KAAK,MAAM,CAAC,CAAC;AAAA,EAC7E,QAAQ;AAAA,EAER;AACF;AAEA,SAAS,WAAW,EAAE,UAAU,GAA2B;AACzD,SACE,qBAAC,SAAI,OAAM,8BAA6B,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,OAAM,eAAc,SAAQ,gBAAe,SAAQ,WAC3J;AAAA,wBAAC,UAAK,OAAM,KAAI,QAAO,KAAI,GAAE,KAAI,GAAE,KAAI,IAAG,KAAI;AAAA,IAAE,oBAAC,UAAK,OAAM,KAAI,QAAO,KAAI,GAAE,MAAK,GAAE,KAAI,IAAG,KAAI;AAAA,IAAE,oBAAC,UAAK,OAAM,KAAI,QAAO,KAAI,GAAE,MAAK,GAAE,M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vB,oBAAC,SAAI,WAAU,4CACZ,yBAAe,IAAI,CAAC,WAAW;AAC9B,YAAM,kBAAkB,OAAO;AAC/B,UAAI,CAAC,gBAAiB,QAAO;AAC7B,aACE,qBAAC,cACC;AAAA,4BAAC,oBAAiB,OAAO,OAAO,SAAS,SAAS,OAAO,SAAS,IAAI;AAAA,QACtE,oBAAC,mBAAgB,SAAS,EAAE,SAAS,OAAO,SAAS,MAAM,OAAO,KAAK,OAAO,kBAAkB,KAAK,iBAAiB,GAAG;AAAA,WAF1G,OAAO,SAAS,EAGjC;AAAA,IAEJ,CAAC,GACH,IACE;AAAA,IAEH,iBAAiB,WAAW,KAAK,CAAC,iBACjC;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,oBAAC,cAAW,WAAU,UAAS;AAAA,QACrC,OAAO,EAAE,iCAAiC,0BAA0B;AAAA,QACpE,aAAY;AAAA;AAAA,IACd,IACE;AAAA,IAEJ,oBAAC,iBAAc,QAAQ,qBAAqB,UAAU,WAAW,GAAG,SAAS,kBAAkB;AAAA,KACjG;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,96 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useMemo, useState } from "react";
4
+ import Link from "next/link";
5
+ import { useT } from "@open-mercato/shared/lib/i18n/context";
6
+ import { Input } from "@open-mercato/ui/primitives/input";
7
+ import { Label } from "@open-mercato/ui/primitives/label";
8
+ import { Button } from "@open-mercato/ui/primitives/button";
9
+ import { Notice } from "@open-mercato/ui/primitives/Notice";
10
+ import { Spinner } from "@open-mercato/ui/primitives/spinner";
11
+ import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
12
+ import { usePortalContext } from "@open-mercato/ui/portal/PortalContext";
13
+ import { InjectionSpot } from "@open-mercato/ui/backend/injection/InjectionSpot";
14
+ import { PortalInjectionSpots } from "@open-mercato/ui/backend/injection/spotIds";
15
+ function PortalLoginPage({ params }) {
16
+ const t = useT();
17
+ const orgSlug = params.orgSlug;
18
+ const { tenant } = usePortalContext();
19
+ const [email, setEmail] = useState("");
20
+ const [password, setPassword] = useState("");
21
+ const [error, setError] = useState(null);
22
+ const [submitting, setSubmitting] = useState(false);
23
+ const handleSubmit = useCallback(
24
+ async (event) => {
25
+ event.preventDefault();
26
+ setError(null);
27
+ if (!tenant.tenantId) {
28
+ setError(t("portal.org.invalid", "Organization not found."));
29
+ return;
30
+ }
31
+ setSubmitting(true);
32
+ try {
33
+ const result = await apiCall("/api/customer_accounts/login", {
34
+ method: "POST",
35
+ headers: { "Content-Type": "application/json" },
36
+ body: JSON.stringify({ email, password, tenantId: tenant.tenantId })
37
+ });
38
+ if (result.ok && result.result?.ok) {
39
+ window.location.assign(`/${orgSlug}/portal/dashboard`);
40
+ return;
41
+ }
42
+ if (result.status === 423) {
43
+ setError(t("portal.login.error.locked", "Account locked. Try again later."));
44
+ } else if (result.status === 401) {
45
+ setError(t("portal.login.error.invalidCredentials", "Invalid email or password."));
46
+ } else {
47
+ setError(result.result?.error || t("portal.login.error.generic", "Login failed. Please try again."));
48
+ }
49
+ } catch {
50
+ setError(t("portal.login.error.generic", "Login failed. Please try again."));
51
+ } finally {
52
+ setSubmitting(false);
53
+ }
54
+ },
55
+ [email, password, tenant.tenantId, orgSlug, t]
56
+ );
57
+ const injectionContext = useMemo(
58
+ () => ({ orgSlug }),
59
+ [orgSlug]
60
+ );
61
+ if (tenant.loading) {
62
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx(Spinner, {}) });
63
+ }
64
+ if (tenant.error) {
65
+ return /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-md py-12", children: /* @__PURE__ */ jsx(Notice, { variant: "error", children: t("portal.org.invalid", "Organization not found.") }) });
66
+ }
67
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-sm", children: [
68
+ /* @__PURE__ */ jsxs("div", { className: "mb-8 text-center", children: [
69
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold tracking-tight", children: t("portal.login.title", "Sign In") }),
70
+ /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-sm text-muted-foreground", children: t("portal.login.description", "Enter your credentials to access the portal.") })
71
+ ] }),
72
+ /* @__PURE__ */ jsx(InjectionSpot, { spotId: PortalInjectionSpots.pageBefore("login"), context: injectionContext }),
73
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-4", children: [
74
+ error ? /* @__PURE__ */ jsx(Notice, { variant: "error", children: error }) : null,
75
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
76
+ /* @__PURE__ */ jsx(Label, { htmlFor: "login-email", className: "text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70", children: t("portal.login.email", "Email") }),
77
+ /* @__PURE__ */ jsx(Input, { id: "login-email", type: "email", autoComplete: "email", required: true, placeholder: t("portal.login.email.placeholder", "you@example.com"), value: email, onChange: (e) => setEmail(e.target.value), disabled: submitting, className: "rounded-lg" })
78
+ ] }),
79
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
80
+ /* @__PURE__ */ jsx(Label, { htmlFor: "login-password", className: "text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70", children: t("portal.login.password", "Password") }),
81
+ /* @__PURE__ */ jsx(Input, { id: "login-password", type: "password", autoComplete: "current-password", required: true, placeholder: t("portal.login.password.placeholder", "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"), value: password, onChange: (e) => setPassword(e.target.value), disabled: submitting, className: "rounded-lg" })
82
+ ] }),
83
+ /* @__PURE__ */ jsx(Button, { type: "submit", disabled: submitting, className: "mt-1 w-full rounded-lg", children: submitting ? t("portal.login.submitting", "Signing in...") : t("portal.login.submit", "Sign In") }),
84
+ /* @__PURE__ */ jsxs("p", { className: "text-center text-[13px] text-muted-foreground", children: [
85
+ t("portal.login.noAccount", "Don't have an account?"),
86
+ " ",
87
+ /* @__PURE__ */ jsx(Link, { href: `/${orgSlug}/portal/signup`, className: "font-medium text-foreground underline underline-offset-4 hover:opacity-80", children: t("portal.login.signupLink", "Sign up") })
88
+ ] })
89
+ ] }),
90
+ /* @__PURE__ */ jsx(InjectionSpot, { spotId: PortalInjectionSpots.pageAfter("login"), context: injectionContext })
91
+ ] });
92
+ }
93
+ export {
94
+ PortalLoginPage as default
95
+ };
96
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/modules/portal/frontend/%5BorgSlug%5D/portal/login/page.tsx"],
4
+ "sourcesContent": ["\"use client\"\nimport { useCallback, useMemo, useState } from 'react'\nimport Link from 'next/link'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Notice } from '@open-mercato/ui/primitives/Notice'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { usePortalContext } from '@open-mercato/ui/portal/PortalContext'\nimport { InjectionSpot } from '@open-mercato/ui/backend/injection/InjectionSpot'\nimport { PortalInjectionSpots } from '@open-mercato/ui/backend/injection/spotIds'\n\ntype Props = { params: { orgSlug: string } }\n\nexport default function PortalLoginPage({ params }: Props) {\n const t = useT()\n const orgSlug = params.orgSlug\n const { tenant } = usePortalContext()\n\n const [email, setEmail] = useState('')\n const [password, setPassword] = useState('')\n const [error, setError] = useState<string | null>(null)\n const [submitting, setSubmitting] = useState(false)\n\n const handleSubmit = useCallback(\n async (event: React.FormEvent) => {\n event.preventDefault()\n setError(null)\n\n if (!tenant.tenantId) {\n setError(t('portal.org.invalid', 'Organization not found.'))\n return\n }\n\n setSubmitting(true)\n try {\n const result = await apiCall<{ ok: boolean; error?: string }>('/api/customer_accounts/login', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ email, password, tenantId: tenant.tenantId }),\n })\n\n if (result.ok && result.result?.ok) {\n window.location.assign(`/${orgSlug}/portal/dashboard`)\n return\n }\n\n if (result.status === 423) {\n setError(t('portal.login.error.locked', 'Account locked. Try again later.'))\n } else if (result.status === 401) {\n setError(t('portal.login.error.invalidCredentials', 'Invalid email or password.'))\n } else {\n setError(result.result?.error || t('portal.login.error.generic', 'Login failed. Please try again.'))\n }\n } catch {\n setError(t('portal.login.error.generic', 'Login failed. Please try again.'))\n } finally {\n setSubmitting(false)\n }\n },\n [email, password, tenant.tenantId, orgSlug, t],\n )\n\n const injectionContext = useMemo(\n () => ({ orgSlug }),\n [orgSlug],\n )\n\n if (tenant.loading) {\n return <div className=\"flex items-center justify-center py-20\"><Spinner /></div>\n }\n\n if (tenant.error) {\n return (\n <div className=\"mx-auto w-full max-w-md py-12\">\n <Notice variant=\"error\">{t('portal.org.invalid', 'Organization not found.')}</Notice>\n </div>\n )\n }\n\n return (\n <div className=\"mx-auto w-full max-w-sm\">\n <div className=\"mb-8 text-center\">\n <h1 className=\"text-2xl font-bold tracking-tight\">{t('portal.login.title', 'Sign In')}</h1>\n <p className=\"mt-1.5 text-sm text-muted-foreground\">{t('portal.login.description', 'Enter your credentials to access the portal.')}</p>\n </div>\n\n <InjectionSpot spotId={PortalInjectionSpots.pageBefore('login')} context={injectionContext} />\n\n <form onSubmit={handleSubmit} className=\"flex flex-col gap-4\">\n {error ? <Notice variant=\"error\">{error}</Notice> : null}\n\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor=\"login-email\" className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">{t('portal.login.email', 'Email')}</Label>\n <Input id=\"login-email\" type=\"email\" autoComplete=\"email\" required placeholder={t('portal.login.email.placeholder', 'you@example.com')} value={email} onChange={(e) => setEmail(e.target.value)} disabled={submitting} className=\"rounded-lg\" />\n </div>\n\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor=\"login-password\" className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">{t('portal.login.password', 'Password')}</Label>\n <Input id=\"login-password\" type=\"password\" autoComplete=\"current-password\" required placeholder={t('portal.login.password.placeholder', '\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022')} value={password} onChange={(e) => setPassword(e.target.value)} disabled={submitting} className=\"rounded-lg\" />\n </div>\n\n <Button type=\"submit\" disabled={submitting} className=\"mt-1 w-full rounded-lg\">\n {submitting ? t('portal.login.submitting', 'Signing in...') : t('portal.login.submit', 'Sign In')}\n </Button>\n\n <p className=\"text-center text-[13px] text-muted-foreground\">\n {t('portal.login.noAccount', \"Don't have an account?\")}{' '}\n <Link href={`/${orgSlug}/portal/signup`} className=\"font-medium text-foreground underline underline-offset-4 hover:opacity-80\">\n {t('portal.login.signupLink', 'Sign up')}\n </Link>\n </p>\n </form>\n\n <InjectionSpot spotId={PortalInjectionSpots.pageAfter('login')} context={injectionContext} />\n </div>\n )\n}\n"],
5
+ "mappings": ";AAuEmE,cAa7D,YAb6D;AAtEnE,SAAS,aAAa,SAAS,gBAAgB;AAC/C,OAAO,UAAU;AACjB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AAItB,SAAR,gBAAiC,EAAE,OAAO,GAAU;AACzD,QAAM,IAAI,KAAK;AACf,QAAM,UAAU,OAAO;AACvB,QAAM,EAAE,OAAO,IAAI,iBAAiB;AAEpC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,EAAE;AAC3C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AACtD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAA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AG;AAAA,QACxD,oBAAC,QAAK,MAAM,IAAI,OAAO,kBAAkB,WAAU,6EAChD,YAAE,2BAA2B,SAAS,GACzC;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,iBAAc,QAAQ,qBAAqB,UAAU,OAAO,GAAG,SAAS,kBAAkB;AAAA,KAC7F;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useMemo } from "react";
4
+ import Link from "next/link";
5
+ import { useRouter } from "next/navigation";
6
+ import { useT } from "@open-mercato/shared/lib/i18n/context";
7
+ import { Button } from "@open-mercato/ui/primitives/button";
8
+ import { Spinner } from "@open-mercato/ui/primitives/spinner";
9
+ import { Notice } from "@open-mercato/ui/primitives/Notice";
10
+ import { usePortalContext } from "@open-mercato/ui/portal/PortalContext";
11
+ import { PortalFeatureCard } from "@open-mercato/ui/portal/components/PortalFeatureCard";
12
+ import { InjectionSpot } from "@open-mercato/ui/backend/injection/InjectionSpot";
13
+ import { PortalInjectionSpots } from "@open-mercato/ui/backend/injection/spotIds";
14
+ function ShoppingBagIcon({ className }) {
15
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className, children: [
16
+ /* @__PURE__ */ jsx("path", { d: "M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z" }),
17
+ /* @__PURE__ */ jsx("line", { x1: "3", x2: "21", y1: "6", y2: "6" }),
18
+ /* @__PURE__ */ jsx("path", { d: "M16 10a4 4 0 0 1-8 0" })
19
+ ] });
20
+ }
21
+ function UserIcon({ className }) {
22
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className, children: [
23
+ /* @__PURE__ */ jsx("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
24
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "7", r: "4" })
25
+ ] });
26
+ }
27
+ function ShieldIcon({ className }) {
28
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className, children: /* @__PURE__ */ jsx("path", { d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" }) });
29
+ }
30
+ function PortalLandingPage({ params }) {
31
+ const t = useT();
32
+ const router = useRouter();
33
+ const orgSlug = params.orgSlug;
34
+ const { auth, tenant } = usePortalContext();
35
+ useEffect(() => {
36
+ if (!auth.loading && auth.user) {
37
+ router.replace(`/${orgSlug}/portal/dashboard`);
38
+ }
39
+ }, [auth.loading, auth.user, router, orgSlug]);
40
+ const injectionContext = useMemo(
41
+ () => ({ orgSlug }),
42
+ [orgSlug]
43
+ );
44
+ if (auth.loading || tenant.loading) {
45
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx(Spinner, {}) });
46
+ }
47
+ if (tenant.error) {
48
+ return /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-md py-12", children: /* @__PURE__ */ jsx(Notice, { variant: "error", children: t("portal.org.invalid", "Organization not found.") }) });
49
+ }
50
+ if (auth.user) return null;
51
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
52
+ /* @__PURE__ */ jsx(InjectionSpot, { spotId: PortalInjectionSpots.pageBefore("home"), context: injectionContext }),
53
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col items-center gap-5 py-8 text-center sm:py-16", children: [
54
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-[0.15em] text-muted-foreground/60", children: t("portal.nav.home", "Customer Portal") }),
55
+ /* @__PURE__ */ jsx("h1", { className: "max-w-2xl text-4xl font-bold tracking-tight text-foreground sm:text-5xl lg:text-6xl", children: t("portal.landing.hero.title", "Welcome to your portal") }),
56
+ /* @__PURE__ */ jsx("p", { className: "max-w-lg text-base leading-relaxed text-muted-foreground sm:text-lg", children: t("portal.landing.hero.description", "Access your account, manage orders, and stay up to date.") }),
57
+ /* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center gap-3", children: [
58
+ /* @__PURE__ */ jsx(Button, { asChild: true, size: "lg", className: "rounded-lg px-6 text-[14px]", children: /* @__PURE__ */ jsx(Link, { href: `/${orgSlug}/portal/login`, children: t("portal.landing.cta.login", "Sign In") }) }),
59
+ /* @__PURE__ */ jsx(Button, { asChild: true, variant: "outline", size: "lg", className: "rounded-lg px-6 text-[14px]", children: /* @__PURE__ */ jsx(Link, { href: `/${orgSlug}/portal/signup`, children: t("portal.landing.cta.signup", "Create Account") }) })
60
+ ] })
61
+ ] }),
62
+ /* @__PURE__ */ jsxs("section", { className: "grid gap-4 sm:grid-cols-3", children: [
63
+ /* @__PURE__ */ jsx(
64
+ PortalFeatureCard,
65
+ {
66
+ icon: /* @__PURE__ */ jsx(ShoppingBagIcon, { className: "size-5" }),
67
+ title: t("portal.landing.feature.orders", "Orders & Invoices"),
68
+ description: t("portal.landing.feature.orders.description", "Track your orders, download invoices, and view delivery status in real time.")
69
+ }
70
+ ),
71
+ /* @__PURE__ */ jsx(
72
+ PortalFeatureCard,
73
+ {
74
+ icon: /* @__PURE__ */ jsx(UserIcon, { className: "size-5" }),
75
+ title: t("portal.landing.feature.account", "Account Management"),
76
+ description: t("portal.landing.feature.account.description", "Update your profile, manage team members, and configure your preferences.")
77
+ }
78
+ ),
79
+ /* @__PURE__ */ jsx(
80
+ PortalFeatureCard,
81
+ {
82
+ icon: /* @__PURE__ */ jsx(ShieldIcon, { className: "size-5" }),
83
+ title: t("portal.landing.feature.security", "Secure Access"),
84
+ description: t("portal.landing.feature.security.description", "Role-based permissions, session management, and full audit trail.")
85
+ }
86
+ )
87
+ ] }),
88
+ /* @__PURE__ */ jsx(InjectionSpot, { spotId: PortalInjectionSpots.pageAfter("home"), context: injectionContext })
89
+ ] });
90
+ }
91
+ export {
92
+ PortalLandingPage as default
93
+ };
94
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/modules/portal/frontend/%5BorgSlug%5D/portal/page.tsx"],
4
+ "sourcesContent": ["\"use client\"\nimport { useEffect, useMemo } from 'react'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { Notice } from '@open-mercato/ui/primitives/Notice'\nimport { usePortalContext } from '@open-mercato/ui/portal/PortalContext'\nimport { PortalFeatureCard } from '@open-mercato/ui/portal/components/PortalFeatureCard'\nimport { InjectionSpot } from '@open-mercato/ui/backend/injection/InjectionSpot'\nimport { PortalInjectionSpots } from '@open-mercato/ui/backend/injection/spotIds'\n\ntype Props = { params: { orgSlug: string } }\n\nfunction ShoppingBagIcon({ className }: { className?: string }) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z\" /><line x1=\"3\" x2=\"21\" y1=\"6\" y2=\"6\" /><path d=\"M16 10a4 4 0 0 1-8 0\" />\n </svg>\n )\n}\n\nfunction UserIcon({ className }: { className?: string }) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\" /><circle cx=\"12\" cy=\"7\" r=\"4\" />\n </svg>\n )\n}\n\nfunction ShieldIcon({ className }: { className?: string }) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className={className}>\n <path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n </svg>\n )\n}\n\nexport default function PortalLandingPage({ params }: Props) {\n const t = useT()\n const router = useRouter()\n const orgSlug = params.orgSlug\n const { auth, tenant } = usePortalContext()\n\n // Redirect authenticated users to dashboard\n useEffect(() => {\n if (!auth.loading && auth.user) {\n router.replace(`/${orgSlug}/portal/dashboard`)\n }\n }, [auth.loading, auth.user, router, orgSlug])\n\n const injectionContext = useMemo(\n () => ({ orgSlug }),\n [orgSlug],\n )\n\n if (auth.loading || tenant.loading) {\n return <div className=\"flex items-center justify-center py-20\"><Spinner /></div>\n }\n\n if (tenant.error) {\n return (\n <div className=\"mx-auto w-full max-w-md py-12\">\n <Notice variant=\"error\">{t('portal.org.invalid', 'Organization not found.')}</Notice>\n </div>\n )\n }\n\n // Authenticated user \u2014 redirect is in progress\n if (auth.user) return null\n\n return (\n <>\n <InjectionSpot spotId={PortalInjectionSpots.pageBefore('home')} context={injectionContext} />\n\n <section className=\"flex flex-col items-center gap-5 py-8 text-center sm:py-16\">\n <p className=\"text-[11px] font-semibold uppercase tracking-[0.15em] text-muted-foreground/60\">\n {t('portal.nav.home', 'Customer Portal')}\n </p>\n <h1 className=\"max-w-2xl text-4xl font-bold tracking-tight text-foreground sm:text-5xl lg:text-6xl\">\n {t('portal.landing.hero.title', 'Welcome to your portal')}\n </h1>\n <p className=\"max-w-lg text-base leading-relaxed text-muted-foreground sm:text-lg\">\n {t('portal.landing.hero.description', 'Access your account, manage orders, and stay up to date.')}\n </p>\n <div className=\"mt-2 flex items-center gap-3\">\n <Button asChild size=\"lg\" className=\"rounded-lg px-6 text-[14px]\">\n <Link href={`/${orgSlug}/portal/login`}>{t('portal.landing.cta.login', 'Sign In')}</Link>\n </Button>\n <Button asChild variant=\"outline\" size=\"lg\" className=\"rounded-lg px-6 text-[14px]\">\n <Link href={`/${orgSlug}/portal/signup`}>{t('portal.landing.cta.signup', 'Create Account')}</Link>\n </Button>\n </div>\n </section>\n\n <section className=\"grid gap-4 sm:grid-cols-3\">\n <PortalFeatureCard\n icon={<ShoppingBagIcon className=\"size-5\" />}\n title={t('portal.landing.feature.orders', 'Orders & Invoices')}\n description={t('portal.landing.feature.orders.description', 'Track your orders, download invoices, and view delivery status in real time.')}\n />\n <PortalFeatureCard\n icon={<UserIcon className=\"size-5\" />}\n title={t('portal.landing.feature.account', 'Account Management')}\n description={t('portal.landing.feature.account.description', 'Update your profile, manage team members, and configure your preferences.')}\n />\n <PortalFeatureCard\n icon={<ShieldIcon className=\"size-5\" />}\n title={t('portal.landing.feature.security', 'Secure Access')}\n description={t('portal.landing.feature.security.description', 'Role-based permissions, session management, and full audit trail.')}\n />\n </section>\n\n <InjectionSpot spotId={PortalInjectionSpots.pageAfter('home')} context={injectionContext} />\n </>\n )\n}\n"],
5
+ "mappings": ";AAiBI,SAwDA,UAvDE,KADF;AAhBJ,SAAS,WAAW,eAAe;AACnC,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,eAAe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A;AAAA,MAC5I;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,MAAM,oBAAC,YAAS,WAAU,UAAS;AAAA,UACnC,OAAO,EAAE,kCAAkC,oBAAoB;AAAA,UAC/D,aAAa,EAAE,8CAA8C,2EAA2E;AAAA;AAAA,MAC1I;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,MAAM,oBAAC,cAAW,WAAU,UAAS;AAAA,UACrC,OAAO,EAAE,mCAAmC,eAAe;AAAA,UAC3D,aAAa,EAAE,+CAA+C,mEAAmE;AAAA;AAAA,MACnI;AAAA,OACF;AAAA,IAEA,oBAAC,iBAAc,QAAQ,qBAAqB,UAAU,MAAM,GAAG,SAAS,kBAAkB;AAAA,KAC5F;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,89 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useMemo } from "react";
4
+ import { useRouter } from "next/navigation";
5
+ import { useT } from "@open-mercato/shared/lib/i18n/context";
6
+ import { Badge } from "@open-mercato/ui/primitives/badge";
7
+ import { Spinner } from "@open-mercato/ui/primitives/spinner";
8
+ import { usePortalContext } from "@open-mercato/ui/portal/PortalContext";
9
+ import { PortalPageHeader } from "@open-mercato/ui/portal/components/PortalPageHeader";
10
+ import { PortalCard, PortalCardHeader, PortalStatRow, PortalCardDivider } from "@open-mercato/ui/portal/components/PortalCard";
11
+ import { InjectionSpot } from "@open-mercato/ui/backend/injection/InjectionSpot";
12
+ import { PortalInjectionSpots } from "@open-mercato/ui/backend/injection/spotIds";
13
+ function PortalProfilePage({ params }) {
14
+ const t = useT();
15
+ const router = useRouter();
16
+ const { auth } = usePortalContext();
17
+ const { user, roles, resolvedFeatures, isPortalAdmin, loading } = auth;
18
+ useEffect(() => {
19
+ if (!loading && !user) {
20
+ router.replace(`/${params.orgSlug}/portal/login`);
21
+ }
22
+ }, [loading, user, router, params.orgSlug]);
23
+ const injectionContext = useMemo(
24
+ () => ({ orgSlug: params.orgSlug, user, roles, resolvedFeatures, isPortalAdmin }),
25
+ [params.orgSlug, user, roles, resolvedFeatures, isPortalAdmin]
26
+ );
27
+ if (loading) {
28
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx(Spinner, {}) });
29
+ }
30
+ if (!user) return null;
31
+ const formatDate = (dateString) => {
32
+ if (!dateString) return t("portal.dashboard.never", "Never");
33
+ return new Date(dateString).toLocaleDateString(void 0, {
34
+ year: "numeric",
35
+ month: "short",
36
+ day: "numeric",
37
+ hour: "2-digit",
38
+ minute: "2-digit"
39
+ });
40
+ };
41
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8", children: [
42
+ /* @__PURE__ */ jsx(
43
+ PortalPageHeader,
44
+ {
45
+ label: t("portal.profile.label", "Account"),
46
+ title: t("portal.profile.title", "Profile")
47
+ }
48
+ ),
49
+ /* @__PURE__ */ jsx(InjectionSpot, { spotId: PortalInjectionSpots.pageBefore("profile"), context: injectionContext }),
50
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-5 md:grid-cols-2", children: [
51
+ /* @__PURE__ */ jsxs(PortalCard, { children: [
52
+ /* @__PURE__ */ jsx(PortalCardHeader, { label: t("portal.dashboard.profile", "Profile"), title: user.displayName }),
53
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
54
+ /* @__PURE__ */ jsx(
55
+ PortalStatRow,
56
+ {
57
+ label: t("portal.dashboard.email", "Email"),
58
+ value: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
59
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: user.email }),
60
+ /* @__PURE__ */ jsx(Badge, { variant: user.emailVerified ? "default" : "outline", className: "shrink-0 text-[10px]", children: user.emailVerified ? t("portal.dashboard.emailVerified", "Verified") : t("portal.dashboard.emailNotVerified", "Unverified") })
61
+ ] })
62
+ }
63
+ ),
64
+ /* @__PURE__ */ jsx(PortalCardDivider, {}),
65
+ /* @__PURE__ */ jsx(PortalStatRow, { label: t("portal.dashboard.lastLogin", "Last login"), value: formatDate(user.lastLoginAt) }),
66
+ /* @__PURE__ */ jsx(PortalCardDivider, {}),
67
+ /* @__PURE__ */ jsx(PortalStatRow, { label: t("portal.dashboard.memberSince", "Member since"), value: formatDate(user.createdAt) }),
68
+ isPortalAdmin ? /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ /* @__PURE__ */ jsx(PortalCardDivider, {}),
70
+ /* @__PURE__ */ jsx(PortalStatRow, { label: t("portal.dashboard.roles", "Role"), value: /* @__PURE__ */ jsx(Badge, { className: "text-[10px]", children: t("portal.dashboard.portalAdmin", "Portal Admin") }) })
71
+ ] }) : null
72
+ ] })
73
+ ] }),
74
+ /* @__PURE__ */ jsxs(PortalCard, { children: [
75
+ /* @__PURE__ */ jsx(PortalCardHeader, { label: t("portal.dashboard.roles", "Roles"), title: `${roles.length} assigned` }),
76
+ roles.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: roles.map((role) => /* @__PURE__ */ jsx("span", { className: "inline-flex items-center rounded-lg border px-3 py-1.5 text-[12px] font-medium", children: role.name }, role.id)) }) : /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("portal.dashboard.noRoles", "No roles assigned") })
77
+ ] }),
78
+ /* @__PURE__ */ jsxs(PortalCard, { className: "md:col-span-2", children: [
79
+ /* @__PURE__ */ jsx(PortalCardHeader, { label: t("portal.dashboard.permissions", "Permissions"), title: `${resolvedFeatures.length} features` }),
80
+ resolvedFeatures.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: resolvedFeatures.map((feature) => /* @__PURE__ */ jsx("span", { className: "inline-flex items-center rounded-md border bg-muted/50 px-2 py-1 font-mono text-[11px] text-muted-foreground", children: feature }, feature)) }) : /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("portal.dashboard.noPermissions", "No permissions") })
81
+ ] })
82
+ ] }),
83
+ /* @__PURE__ */ jsx(InjectionSpot, { spotId: PortalInjectionSpots.pageAfter("profile"), context: injectionContext })
84
+ ] });
85
+ }
86
+ export {
87
+ PortalProfilePage as default
88
+ };
89
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/modules/portal/frontend/%5BorgSlug%5D/portal/profile/page.tsx"],
4
+ "sourcesContent": ["\"use client\"\nimport { useEffect, useMemo } from 'react'\nimport { useRouter } from 'next/navigation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { usePortalContext } from '@open-mercato/ui/portal/PortalContext'\nimport { PortalPageHeader } from '@open-mercato/ui/portal/components/PortalPageHeader'\nimport { PortalCard, PortalCardHeader, PortalStatRow, PortalCardDivider } from '@open-mercato/ui/portal/components/PortalCard'\nimport { InjectionSpot } from '@open-mercato/ui/backend/injection/InjectionSpot'\nimport { PortalInjectionSpots } from '@open-mercato/ui/backend/injection/spotIds'\n\ntype Props = { params: { orgSlug: string } }\n\nexport default function PortalProfilePage({ params }: Props) {\n const t = useT()\n const router = useRouter()\n const { auth } = usePortalContext()\n const { user, roles, resolvedFeatures, isPortalAdmin, loading } = auth\n\n useEffect(() => {\n if (!loading && !user) {\n router.replace(`/${params.orgSlug}/portal/login`)\n }\n }, [loading, user, router, params.orgSlug])\n\n const injectionContext = useMemo(\n () => ({ orgSlug: params.orgSlug, user, roles, resolvedFeatures, isPortalAdmin }),\n [params.orgSlug, user, roles, resolvedFeatures, isPortalAdmin],\n )\n\n if (loading) {\n return <div className=\"flex items-center justify-center py-20\"><Spinner /></div>\n }\n\n if (!user) return null\n\n const formatDate = (dateString: string | null) => {\n if (!dateString) return t('portal.dashboard.never', 'Never')\n return new Date(dateString).toLocaleDateString(undefined, {\n year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit',\n })\n }\n\n return (\n <div className=\"flex flex-col gap-8\">\n <PortalPageHeader\n label={t('portal.profile.label', 'Account')}\n title={t('portal.profile.title', 'Profile')}\n />\n\n <InjectionSpot spotId={PortalInjectionSpots.pageBefore('profile')} context={injectionContext} />\n\n <div className=\"grid gap-5 md:grid-cols-2\">\n <PortalCard>\n <PortalCardHeader label={t('portal.dashboard.profile', 'Profile')} title={user.displayName} />\n <div className=\"flex flex-col\">\n <PortalStatRow\n label={t('portal.dashboard.email', 'Email')}\n value={\n <span className=\"flex items-center gap-2\">\n <span className=\"truncate\">{user.email}</span>\n <Badge variant={user.emailVerified ? 'default' : 'outline'} className=\"shrink-0 text-[10px]\">\n {user.emailVerified ? t('portal.dashboard.emailVerified', 'Verified') : t('portal.dashboard.emailNotVerified', 'Unverified')}\n </Badge>\n </span>\n }\n />\n <PortalCardDivider />\n <PortalStatRow label={t('portal.dashboard.lastLogin', 'Last login')} value={formatDate(user.lastLoginAt)} />\n <PortalCardDivider />\n <PortalStatRow label={t('portal.dashboard.memberSince', 'Member since')} value={formatDate(user.createdAt)} />\n {isPortalAdmin ? (\n <>\n <PortalCardDivider />\n <PortalStatRow label={t('portal.dashboard.roles', 'Role')} value={<Badge className=\"text-[10px]\">{t('portal.dashboard.portalAdmin', 'Portal Admin')}</Badge>} />\n </>\n ) : null}\n </div>\n </PortalCard>\n\n <PortalCard>\n <PortalCardHeader label={t('portal.dashboard.roles', 'Roles')} title={`${roles.length} assigned`} />\n {roles.length > 0 ? (\n <div className=\"flex flex-wrap gap-2\">\n {roles.map((role) => (\n <span key={role.id} className=\"inline-flex items-center rounded-lg border px-3 py-1.5 text-[12px] font-medium\">{role.name}</span>\n ))}\n </div>\n ) : (\n <p className=\"text-sm text-muted-foreground\">{t('portal.dashboard.noRoles', 'No roles assigned')}</p>\n )}\n </PortalCard>\n\n <PortalCard className=\"md:col-span-2\">\n <PortalCardHeader label={t('portal.dashboard.permissions', 'Permissions')} title={`${resolvedFeatures.length} features`} />\n {resolvedFeatures.length > 0 ? (\n <div className=\"flex flex-wrap gap-2\">\n {resolvedFeatures.map((feature) => (\n <span key={feature} className=\"inline-flex items-center rounded-md border bg-muted/50 px-2 py-1 font-mono text-[11px] text-muted-foreground\">{feature}</span>\n ))}\n </div>\n ) : (\n <p className=\"text-sm text-muted-foreground\">{t('portal.dashboard.noPermissions', 'No permissions')}</p>\n )}\n </PortalCard>\n </div>\n\n <InjectionSpot spotId={PortalInjectionSpots.pageAfter('profile')} context={injectionContext} />\n </div>\n )\n}\n"],
5
+ "mappings": ";AAgCmE,SAyCrD,UAzCqD,KA4BnD,YA5BmD;AA/BnE,SAAS,WAAW,eAAe;AACnC,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,YAAY,kBAAkB,eAAe,yBAAyB;AAC/E,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AAItB,SAAR,kBAAmC,EAAE,OAAO,GAAU;AAC3D,QAAM,IAAI,KAAK;AACf,QAAM,SAAS,UAAU;AACzB,QAAM,EAAE,KAAK,IAAI,iBAAiB;AAClC,QAAM,EAAE,MAAM,OAAO,kBAAkB,eAAe,QAAQ,IAAI;AAElE,YAAU,MAAM;AACd,QAAI,CAAC,WAAW,CAAC,MAAM;AACrB,aAAO,QAAQ,IAAI,OAAO,OAAO,eAAe;AAAA,IAClD;AAAA,EACF,GAAG,CAAC,SAAS,MAAM,QAAQ,OAAO,OAAO,CAAC;AAE1C,QAAM,mBAAmB;AAAA,IACvB,OAAO,EAAE,SAAS,OAAO,SAAS,MAAM,OAAO,kBAAkB,cAAc;AAAA,IAC/E,CAAC,OAAO,SAAS,MAAM,OAAO,kBAAkB,aAAa;AAAA,EAC/D;AAEA,MAAI,SAAS;AACX,WAAO,oBAAC,SAAI,WAAU,0CAAyC,8BAAC,WAAQ,GAAE;AAAA,EAC5E;AAEA,MAAI,CAAC,KA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ACC,iCACE;AAAA,gCAAC,qBAAkB;AAAA,YACnB,oBAAC,iBAAc,OAAO,EAAE,0BAA0B,MAAM,GAAG,OAAO,oBAAC,SAAM,WAAU,eAAe,YAAE,gCAAgC,cAAc,GAAE,GAAU;AAAA,aAChK,IACE;AAAA,WACN;AAAA,SACF;AAAA,MAEA,qBAAC,cACC;AAAA,4BAAC,oBAAiB,OAAO,EAAE,0BAA0B,OAAO,GAAG,OAAO,GAAG,MAAM,MAAM,aAAa;AAAA,QACjG,MAAM,SAAS,IACd,oBAAC,SAAI,WAAU,wBACZ,gBAAM,IAAI,CAAC,SACV,oBAAC,UAAmB,WAAU,kFAAkF,eAAK,QAA1G,KAAK,EAA0G,CAC3H,GACH,IAEA,oBAAC,OAAE,WAAU,iCAAiC,YAAE,4BAA4B,mBAAmB,GAAE;AAAA,SAErG;AAAA,MAEA,qBAAC,cAAW,WAAU,iBACpB;AAAA,4BAAC,oBAAiB,OAAO,EAAE,gCAAgC,aAAa,GAAG,OAAO,GAAG,iBAAiB,MAAM,aAAa;AAAA,QACxH,iBAAiB,SAAS,IACzB,oBAAC,SAAI,WAAU,wBACZ,2BAAiB,IAAI,CAAC,YACrB,oBAAC,UAAmB,WAAU,gHAAgH,qBAAnI,OAA2I,CACvJ,GACH,IAEA,oBAAC,OAAE,WAAU,iCAAiC,YAAE,kCAAkC,gBAAgB,GAAE;AAAA,SAExG;AAAA,OACF;AAAA,IAEA,oBAAC,iBAAc,QAAQ,qBAAqB,UAAU,SAAS,GAAG,SAAS,kBAAkB;AAAA,KAC/F;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,104 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useMemo, useState } from "react";
4
+ import Link from "next/link";
5
+ import { useT } from "@open-mercato/shared/lib/i18n/context";
6
+ import { Input } from "@open-mercato/ui/primitives/input";
7
+ import { Label } from "@open-mercato/ui/primitives/label";
8
+ import { Button } from "@open-mercato/ui/primitives/button";
9
+ import { Notice } from "@open-mercato/ui/primitives/Notice";
10
+ import { Spinner } from "@open-mercato/ui/primitives/spinner";
11
+ import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
12
+ import { usePortalContext } from "@open-mercato/ui/portal/PortalContext";
13
+ import { InjectionSpot } from "@open-mercato/ui/backend/injection/InjectionSpot";
14
+ import { PortalInjectionSpots } from "@open-mercato/ui/backend/injection/spotIds";
15
+ function PortalSignupPage({ params }) {
16
+ const t = useT();
17
+ const orgSlug = params.orgSlug;
18
+ const { tenant } = usePortalContext();
19
+ const [displayName, setDisplayName] = useState("");
20
+ const [email, setEmail] = useState("");
21
+ const [password, setPassword] = useState("");
22
+ const [error, setError] = useState(null);
23
+ const [success, setSuccess] = useState(false);
24
+ const [submitting, setSubmitting] = useState(false);
25
+ const handleSubmit = useCallback(
26
+ async (event) => {
27
+ event.preventDefault();
28
+ setError(null);
29
+ if (!tenant.tenantId || !tenant.organizationId) {
30
+ setError(t("portal.org.invalid", "Organization not found."));
31
+ return;
32
+ }
33
+ setSubmitting(true);
34
+ try {
35
+ const result = await apiCall("/api/customer_accounts/signup", {
36
+ method: "POST",
37
+ headers: { "Content-Type": "application/json" },
38
+ body: JSON.stringify({ email, password, displayName, tenantId: tenant.tenantId, organizationId: tenant.organizationId })
39
+ });
40
+ if (result.status === 201 && result.result?.ok) {
41
+ setSuccess(true);
42
+ return;
43
+ }
44
+ setError(result.result?.error || t("portal.signup.error.generic", "Signup failed. Please try again."));
45
+ } catch {
46
+ setError(t("portal.signup.error.generic", "Signup failed. Please try again."));
47
+ } finally {
48
+ setSubmitting(false);
49
+ }
50
+ },
51
+ [displayName, email, password, tenant.tenantId, tenant.organizationId, t]
52
+ );
53
+ const injectionContext = useMemo(
54
+ () => ({ orgSlug }),
55
+ [orgSlug]
56
+ );
57
+ if (tenant.loading) {
58
+ return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-20", children: /* @__PURE__ */ jsx(Spinner, {}) });
59
+ }
60
+ if (tenant.error) {
61
+ return /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-md py-12", children: /* @__PURE__ */ jsx(Notice, { variant: "error", children: t("portal.org.invalid", "Organization not found.") }) });
62
+ }
63
+ if (success) {
64
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-sm text-center", children: [
65
+ /* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex size-12 items-center justify-center rounded-full bg-foreground text-background", children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "size-6", children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" }) }) }),
66
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold tracking-tight", children: t("portal.signup.success.title", "Account Created") }),
67
+ /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-sm text-muted-foreground", children: t("portal.signup.success.description", "Your account has been created. You can now sign in.") }),
68
+ /* @__PURE__ */ jsx(Button, { asChild: true, className: "mt-6 w-full rounded-lg", children: /* @__PURE__ */ jsx(Link, { href: `/${orgSlug}/portal/login`, children: t("portal.signup.success.loginLink", "Sign In") }) })
69
+ ] });
70
+ }
71
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-sm", children: [
72
+ /* @__PURE__ */ jsxs("div", { className: "mb-8 text-center", children: [
73
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold tracking-tight", children: t("portal.signup.title", "Create Account") }),
74
+ /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-sm text-muted-foreground", children: t("portal.signup.description", "Sign up for a portal account.") })
75
+ ] }),
76
+ /* @__PURE__ */ jsx(InjectionSpot, { spotId: PortalInjectionSpots.pageBefore("signup"), context: injectionContext }),
77
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-4", children: [
78
+ error ? /* @__PURE__ */ jsx(Notice, { variant: "error", children: error }) : null,
79
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
80
+ /* @__PURE__ */ jsx(Label, { htmlFor: "signup-name", className: "text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70", children: t("portal.signup.displayName", "Full Name") }),
81
+ /* @__PURE__ */ jsx(Input, { id: "signup-name", type: "text", autoComplete: "name", required: true, placeholder: t("portal.signup.displayName.placeholder", "Jane Smith"), value: displayName, onChange: (e) => setDisplayName(e.target.value), disabled: submitting, className: "rounded-lg" })
82
+ ] }),
83
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
84
+ /* @__PURE__ */ jsx(Label, { htmlFor: "signup-email", className: "text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70", children: t("portal.signup.email", "Email") }),
85
+ /* @__PURE__ */ jsx(Input, { id: "signup-email", type: "email", autoComplete: "email", required: true, placeholder: t("portal.signup.email.placeholder", "you@example.com"), value: email, onChange: (e) => setEmail(e.target.value), disabled: submitting, className: "rounded-lg" })
86
+ ] }),
87
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
88
+ /* @__PURE__ */ jsx(Label, { htmlFor: "signup-password", className: "text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70", children: t("portal.signup.password", "Password") }),
89
+ /* @__PURE__ */ jsx(Input, { id: "signup-password", type: "password", autoComplete: "new-password", required: true, placeholder: t("portal.signup.password.placeholder", "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"), value: password, onChange: (e) => setPassword(e.target.value), disabled: submitting, className: "rounded-lg" })
90
+ ] }),
91
+ /* @__PURE__ */ jsx(Button, { type: "submit", disabled: submitting, className: "mt-1 w-full rounded-lg", children: submitting ? t("portal.signup.submitting", "Creating account...") : t("portal.signup.submit", "Create Account") }),
92
+ /* @__PURE__ */ jsxs("p", { className: "text-center text-[13px] text-muted-foreground", children: [
93
+ t("portal.signup.hasAccount", "Already have an account?"),
94
+ " ",
95
+ /* @__PURE__ */ jsx(Link, { href: `/${orgSlug}/portal/login`, className: "font-medium text-foreground underline underline-offset-4 hover:opacity-80", children: t("portal.signup.loginLink", "Sign in") })
96
+ ] })
97
+ ] }),
98
+ /* @__PURE__ */ jsx(InjectionSpot, { spotId: PortalInjectionSpots.pageAfter("signup"), context: injectionContext })
99
+ ] });
100
+ }
101
+ export {
102
+ PortalSignupPage as default
103
+ };
104
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/modules/portal/frontend/%5BorgSlug%5D/portal/signup/page.tsx"],
4
+ "sourcesContent": ["\"use client\"\nimport { useCallback, useMemo, useState } from 'react'\nimport Link from 'next/link'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Notice } from '@open-mercato/ui/primitives/Notice'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { usePortalContext } from '@open-mercato/ui/portal/PortalContext'\nimport { InjectionSpot } from '@open-mercato/ui/backend/injection/InjectionSpot'\nimport { PortalInjectionSpots } from '@open-mercato/ui/backend/injection/spotIds'\n\ntype Props = { params: { orgSlug: string } }\n\nexport default function PortalSignupPage({ params }: Props) {\n const t = useT()\n const orgSlug = params.orgSlug\n const { tenant } = usePortalContext()\n\n const [displayName, setDisplayName] = useState('')\n const [email, setEmail] = useState('')\n const [password, setPassword] = useState('')\n const [error, setError] = useState<string | null>(null)\n const [success, setSuccess] = useState(false)\n const [submitting, setSubmitting] = useState(false)\n\n const handleSubmit = useCallback(\n async (event: React.FormEvent) => {\n event.preventDefault()\n setError(null)\n\n if (!tenant.tenantId || !tenant.organizationId) {\n setError(t('portal.org.invalid', 'Organization not found.'))\n return\n }\n\n setSubmitting(true)\n try {\n const result = await apiCall<{ ok: boolean; error?: string }>('/api/customer_accounts/signup', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ email, password, displayName, tenantId: tenant.tenantId, organizationId: tenant.organizationId }),\n })\n\n if (result.status === 201 && result.result?.ok) {\n setSuccess(true)\n return\n }\n\n setError(result.result?.error || t('portal.signup.error.generic', 'Signup failed. Please try again.'))\n } catch {\n setError(t('portal.signup.error.generic', 'Signup failed. Please try again.'))\n } finally {\n setSubmitting(false)\n }\n },\n [displayName, email, password, tenant.tenantId, tenant.organizationId, t],\n )\n\n const injectionContext = useMemo(\n () => ({ orgSlug }),\n [orgSlug],\n )\n\n if (tenant.loading) {\n return <div className=\"flex items-center justify-center py-20\"><Spinner /></div>\n }\n\n if (tenant.error) {\n return (\n <div className=\"mx-auto w-full max-w-md py-12\">\n <Notice variant=\"error\">{t('portal.org.invalid', 'Organization not found.')}</Notice>\n </div>\n )\n }\n\n if (success) {\n return (\n <div className=\"mx-auto w-full max-w-sm text-center\">\n <div className=\"mx-auto mb-4 flex size-12 items-center justify-center rounded-full bg-foreground text-background\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className=\"size-6\">\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n </div>\n <h1 className=\"text-2xl font-bold tracking-tight\">{t('portal.signup.success.title', 'Account Created')}</h1>\n <p className=\"mt-1.5 text-sm text-muted-foreground\">{t('portal.signup.success.description', 'Your account has been created. You can now sign in.')}</p>\n <Button asChild className=\"mt-6 w-full rounded-lg\">\n <Link href={`/${orgSlug}/portal/login`}>{t('portal.signup.success.loginLink', 'Sign In')}</Link>\n </Button>\n </div>\n )\n }\n\n return (\n <div className=\"mx-auto w-full max-w-sm\">\n <div className=\"mb-8 text-center\">\n <h1 className=\"text-2xl font-bold tracking-tight\">{t('portal.signup.title', 'Create Account')}</h1>\n <p className=\"mt-1.5 text-sm text-muted-foreground\">{t('portal.signup.description', 'Sign up for a portal account.')}</p>\n </div>\n\n <InjectionSpot spotId={PortalInjectionSpots.pageBefore('signup')} context={injectionContext} />\n\n <form onSubmit={handleSubmit} className=\"flex flex-col gap-4\">\n {error ? <Notice variant=\"error\">{error}</Notice> : null}\n\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor=\"signup-name\" className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">{t('portal.signup.displayName', 'Full Name')}</Label>\n <Input id=\"signup-name\" type=\"text\" autoComplete=\"name\" required placeholder={t('portal.signup.displayName.placeholder', 'Jane Smith')} value={displayName} onChange={(e) => setDisplayName(e.target.value)} disabled={submitting} className=\"rounded-lg\" />\n </div>\n\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor=\"signup-email\" className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">{t('portal.signup.email', 'Email')}</Label>\n <Input id=\"signup-email\" type=\"email\" autoComplete=\"email\" required placeholder={t('portal.signup.email.placeholder', 'you@example.com')} value={email} onChange={(e) => setEmail(e.target.value)} disabled={submitting} className=\"rounded-lg\" />\n </div>\n\n <div className=\"flex flex-col gap-1.5\">\n <Label htmlFor=\"signup-password\" className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/70\">{t('portal.signup.password', 'Password')}</Label>\n <Input id=\"signup-password\" type=\"password\" autoComplete=\"new-password\" required placeholder={t('portal.signup.password.placeholder', '\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022')} value={password} onChange={(e) => setPassword(e.target.value)} disabled={submitting} className=\"rounded-lg\" />\n </div>\n\n <Button type=\"submit\" disabled={submitting} className=\"mt-1 w-full rounded-lg\">\n {submitting ? t('portal.signup.submitting', 'Creating account...') : t('portal.signup.submit', 'Create Account')}\n </Button>\n\n <p className=\"text-center text-[13px] text-muted-foreground\">\n {t('portal.signup.hasAccount', 'Already have an account?')}{' '}\n <Link href={`/${orgSlug}/portal/login`} className=\"font-medium text-foreground underline underline-offset-4 hover:opacity-80\">\n {t('portal.signup.loginLink', 'Sign in')}\n </Link>\n </p>\n </form>\n\n <InjectionSpot spotId={PortalInjectionSpots.pageAfter('signup')} context={injectionContext} />\n </div>\n )\n}\n"],
5
+ "mappings": ";AAmEmE,cAa7D,YAb6D;AAlEnE,SAAS,aAAa,SAAS,gBAAgB;AAC/C,OAAO,UAAU;AACjB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AAItB,SAAR,iBAAkC,EAAE,OAAO,GAAU;AAC1D,QAAM,IAAI,KAAK;AACf,QAAM,UAAU,OAAO;AACvB,QAAM,EAAE,OAAO,IAAI,iBAAiB;AAEpC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,EAAE;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,EAAE;AAC3C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AACtD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,eAAe;AAAA,IACnB,OAAO,UAA2B;AAChC,YAAM,eAAe;AACrB,eAAS,IAAI;AAEb,UAAI,CAAC,OAAO,YAAY,CAAC,OAAO,gBAAgB;AAC9C,iBAAS,EAAE,sBAAsB,yBAAyB,CAAC;AAC3D;AAAA,MACF;AAEA,oBAAc,IAAI;AAClB,UAAI;AACF,cAAM,SAAS,MAAM,QAAyC,iCAAiC;AAAA,UAC7F,QAAQ;AAAA,UACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,UAC9C,MA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IAAG,mBAAkB,MAAK,YAAW,cAAa,gBAAe,UAAQ,MAAC,aAAa,EAAE,sCAAsC,kDAAkD,GAAG,OAAO,UAAU,UAAU,CAAC,MAAM,YAAY,EAAE,OAAO,KAAK,GAAG,UAAU,YAAY,WAAU,cAAa;AAAA,SACzS;AAAA,MAEA,oBAAC,UAAO,MAAK,UAAS,UAAU,YAAY,WAAU,0BACnD,uBAAa,EAAE,4BAA4B,qBAAqB,IAAI,EAAE,wBAAwB,gBAAgB,GACjH;AAAA,MAEA,qBAAC,OAAE,WAAU,iDACV;AAAA,UAAE,4BAA4B,0BAA0B;AAAA,QAAG;AAAA,QAC5D,oBAAC,QAAK,MAAM,IAAI,OAAO,iBAAiB,WAAU,6EAC/C,YAAE,2BAA2B,SAAS,GACzC;AAAA,SACF;AAAA,OACF;AAAA,IAEA,oBAAC,iBAAc,QAAQ,qBAAqB,UAAU,QAAQ,GAAG,SAAS,kBAAkB;AAAA,KAC9F;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,11 @@
1
+ const metadata = {
2
+ name: "portal",
3
+ title: "Customer Portal",
4
+ version: "0.1.0",
5
+ description: "Self-service customer portal framework with login, signup, dashboard, sidebar navigation, and extensible widget system.",
6
+ requires: ["customer_accounts"]
7
+ };
8
+ export {
9
+ metadata
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/modules/portal/index.ts"],
4
+ "sourcesContent": ["import type { ModuleInfo } from '@open-mercato/shared/modules/registry'\n\nexport const metadata: ModuleInfo = {\n name: 'portal',\n title: 'Customer Portal',\n version: '0.1.0',\n description: 'Self-service customer portal framework with login, signup, dashboard, sidebar navigation, and extensible widget system.',\n requires: ['customer_accounts'],\n}\n"],
5
+ "mappings": "AAEO,MAAM,WAAuB;AAAA,EAClC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU,CAAC,mBAAmB;AAChC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,23 @@
1
+ import { FeatureToggle } from "@open-mercato/core/modules/feature_toggles/data/entities";
2
+ const setup = {
3
+ async seedDefaults({ em }) {
4
+ const existing = await em.findOne(FeatureToggle, { identifier: "portal_enabled", deletedAt: null });
5
+ if (existing) return;
6
+ const toggle = em.create(FeatureToggle, {
7
+ identifier: "portal_enabled",
8
+ name: "Portal Enabled",
9
+ description: 'Controls whether the customer portal is accessible. When disabled, all portal routes show "Portal not available".',
10
+ category: "portal",
11
+ type: "boolean",
12
+ defaultValue: true
13
+ });
14
+ em.persist(toggle);
15
+ await em.flush();
16
+ }
17
+ };
18
+ var setup_default = setup;
19
+ export {
20
+ setup_default as default,
21
+ setup
22
+ };
23
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/modules/portal/setup.ts"],
4
+ "sourcesContent": ["import type { ModuleSetupConfig } from '@open-mercato/shared/modules/setup'\nimport { FeatureToggle } from '@open-mercato/core/modules/feature_toggles/data/entities'\nimport type { EntityManager } from '@mikro-orm/postgresql'\n\nexport const setup: ModuleSetupConfig = {\n async seedDefaults({ em }: { em: EntityManager }) {\n const existing = await em.findOne(FeatureToggle, { identifier: 'portal_enabled', deletedAt: null })\n if (existing) return\n\n const toggle = em.create(FeatureToggle, {\n identifier: 'portal_enabled',\n name: 'Portal Enabled',\n description: 'Controls whether the customer portal is accessible. When disabled, all portal routes show \"Portal not available\".',\n category: 'portal',\n type: 'boolean',\n defaultValue: true as any,\n })\n em.persist(toggle)\n await em.flush()\n },\n}\n\nexport default setup\n"],
5
+ "mappings": "AACA,SAAS,qBAAqB;AAGvB,MAAM,QAA2B;AAAA,EACtC,MAAM,aAAa,EAAE,GAAG,GAA0B;AAChD,UAAM,WAAW,MAAM,GAAG,QAAQ,eAAe,EAAE,YAAY,kBAAkB,WAAW,KAAK,CAAC;AAClG,QAAI,SAAU;AAEd,UAAM,SAAS,GAAG,OAAO,eAAe;AAAA,MACtC,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,MACV,MAAM;AAAA,MACN,cAAc;AAAA,IAChB,CAAC;AACD,OAAG,QAAQ,MAAM;AACjB,UAAM,GAAG,MAAM;AAAA,EACjB;AACF;AAEA,IAAO,gBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,12 @@
1
+ export const id = 'id'
2
+ export const tenant_id = 'tenant_id'
3
+ export const organization_id = 'organization_id'
4
+ export const name = 'name'
5
+ export const slug = 'slug'
6
+ export const description = 'description'
7
+ export const is_default = 'is_default'
8
+ export const is_system = 'is_system'
9
+ export const customer_assignable = 'customer_assignable'
10
+ export const created_at = 'created_at'
11
+ export const updated_at = 'updated_at'
12
+ export const deleted_at = 'deleted_at'