@fluid-app/portal-sdk 0.1.286 → 0.1.288

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 (881) hide show
  1. package/dist/AddressAutocompleteInput-C_H7gSJt.mjs +2214 -0
  2. package/dist/AddressAutocompleteInput-C_H7gSJt.mjs.map +1 -0
  3. package/dist/AddressAutocompleteInput-tZX9kPwb.cjs +2310 -0
  4. package/dist/AddressAutocompleteInput-tZX9kPwb.cjs.map +1 -0
  5. package/dist/ContactsScreen-BaNFVTVX.cjs +10 -0
  6. package/dist/ContactsScreen-CLLyfNru.mjs +3397 -0
  7. package/dist/ContactsScreen-CLLyfNru.mjs.map +1 -0
  8. package/dist/ContactsScreen-D8M6J3nC.cjs +3405 -0
  9. package/dist/ContactsScreen-D8M6J3nC.cjs.map +1 -0
  10. package/dist/ProfileScreen-BDvruZ90.mjs +1232 -0
  11. package/dist/ProfileScreen-BDvruZ90.mjs.map +1 -0
  12. package/dist/ProfileScreen-BH0A6Y3R.mjs +46 -0
  13. package/dist/ProfileScreen-CT5nLt3E.cjs +1244 -0
  14. package/dist/ProfileScreen-CT5nLt3E.cjs.map +1 -0
  15. package/dist/ProfileScreen-DrTa9Boy.cjs +48 -0
  16. package/dist/ShareablesScreen-BT3H1Omb.cjs +13896 -0
  17. package/dist/ShareablesScreen-BT3H1Omb.cjs.map +1 -0
  18. package/dist/ShareablesScreen-BrsJQqia.mjs +13880 -0
  19. package/dist/ShareablesScreen-BrsJQqia.mjs.map +1 -0
  20. package/dist/ShareablesScreen-IU9JBJzD.mjs +14 -0
  21. package/dist/ShareablesScreen-RxdJqjda.cjs +16 -0
  22. package/dist/ShopScreen-BLo9zSmm.mjs +45 -0
  23. package/dist/ShopScreen-BgiNBkIk.cjs +1295 -0
  24. package/dist/ShopScreen-BgiNBkIk.cjs.map +1 -0
  25. package/dist/ShopScreen-Bjo-5mdC.mjs +1282 -0
  26. package/dist/ShopScreen-Bjo-5mdC.mjs.map +1 -0
  27. package/dist/ShopScreen-BzaTY9cV.cjs +47 -0
  28. package/dist/SubscriptionsScreen-5IsYJnvc.cjs +5791 -0
  29. package/dist/SubscriptionsScreen-5IsYJnvc.cjs.map +1 -0
  30. package/dist/SubscriptionsScreen-B9_Cmmrc.mjs +5723 -0
  31. package/dist/SubscriptionsScreen-B9_Cmmrc.mjs.map +1 -0
  32. package/dist/SubscriptionsScreen-BpiWZf9J.cjs +11 -0
  33. package/dist/UpgradeScreen-DjCkknBC.cjs +6 -0
  34. package/dist/UpgradeScreen-Dqe70qIt.cjs +203 -0
  35. package/dist/UpgradeScreen-Dqe70qIt.cjs.map +1 -0
  36. package/dist/UpgradeScreen-WLq4bFhS.mjs +196 -0
  37. package/dist/UpgradeScreen-WLq4bFhS.mjs.map +1 -0
  38. package/dist/de-B2xuRzqB.mjs +125 -0
  39. package/dist/de-B2xuRzqB.mjs.map +1 -0
  40. package/dist/de-BMzN6pvJ.mjs +37 -0
  41. package/dist/de-BMzN6pvJ.mjs.map +1 -0
  42. package/dist/de-BP_BwSkX.mjs +24 -0
  43. package/dist/de-BP_BwSkX.mjs.map +1 -0
  44. package/dist/de-BcjRy6IX.mjs +74 -0
  45. package/dist/de-BcjRy6IX.mjs.map +1 -0
  46. package/dist/de-CA1BpazO.cjs +43 -0
  47. package/dist/de-CA1BpazO.cjs.map +1 -0
  48. package/dist/de-CQojBku3.cjs +131 -0
  49. package/dist/de-CQojBku3.cjs.map +1 -0
  50. package/dist/de-DLKXYoUC.cjs +80 -0
  51. package/dist/de-DLKXYoUC.cjs.map +1 -0
  52. package/dist/de-DLVI44iM.cjs +12 -0
  53. package/dist/de-DLVI44iM.cjs.map +1 -0
  54. package/dist/de-DZXu_Lma.mjs +6 -0
  55. package/dist/de-DZXu_Lma.mjs.map +1 -0
  56. package/dist/de-d5sXuDlc.cjs +12 -0
  57. package/dist/de-d5sXuDlc.cjs.map +1 -0
  58. package/dist/de-hW77cwjn.cjs +30 -0
  59. package/dist/de-hW77cwjn.cjs.map +1 -0
  60. package/dist/de-ndSZ5ykY.mjs +6 -0
  61. package/dist/de-ndSZ5ykY.mjs.map +1 -0
  62. package/dist/el-3T5wNvmF.cjs +12 -0
  63. package/dist/el-3T5wNvmF.cjs.map +1 -0
  64. package/dist/el-BVROkdqG.cjs +43 -0
  65. package/dist/el-BVROkdqG.cjs.map +1 -0
  66. package/dist/el-C1QZdoK1.cjs +131 -0
  67. package/dist/el-C1QZdoK1.cjs.map +1 -0
  68. package/dist/el-CT5RY-mx.mjs +125 -0
  69. package/dist/el-CT5RY-mx.mjs.map +1 -0
  70. package/dist/el-CWq1GFO2.mjs +37 -0
  71. package/dist/el-CWq1GFO2.mjs.map +1 -0
  72. package/dist/el-ChL3zQdm.mjs +6 -0
  73. package/dist/el-ChL3zQdm.mjs.map +1 -0
  74. package/dist/el-Dji5p2km.cjs +80 -0
  75. package/dist/el-Dji5p2km.cjs.map +1 -0
  76. package/dist/el-DtirnL7N.cjs +12 -0
  77. package/dist/el-DtirnL7N.cjs.map +1 -0
  78. package/dist/el-XW2NR7Vh.mjs +74 -0
  79. package/dist/el-XW2NR7Vh.mjs.map +1 -0
  80. package/dist/el-XwgbXcif.cjs +30 -0
  81. package/dist/el-XwgbXcif.cjs.map +1 -0
  82. package/dist/el-epEJkauy.mjs +6 -0
  83. package/dist/el-epEJkauy.mjs.map +1 -0
  84. package/dist/el-xbVPoQUL.mjs +24 -0
  85. package/dist/el-xbVPoQUL.mjs.map +1 -0
  86. package/dist/es-BSkjqnkF.cjs +12 -0
  87. package/dist/es-BSkjqnkF.cjs.map +1 -0
  88. package/dist/es-BX5djVHQ.cjs +30 -0
  89. package/dist/es-BX5djVHQ.cjs.map +1 -0
  90. package/dist/es-Bh1xngyE.mjs +6 -0
  91. package/dist/es-Bh1xngyE.mjs.map +1 -0
  92. package/dist/es-BjDZEneQ.cjs +80 -0
  93. package/dist/es-BjDZEneQ.cjs.map +1 -0
  94. package/dist/es-C2uchKja.cjs +43 -0
  95. package/dist/es-C2uchKja.cjs.map +1 -0
  96. package/dist/es-C2zfJQck.mjs +37 -0
  97. package/dist/es-C2zfJQck.mjs.map +1 -0
  98. package/dist/es-CWW1uLK3.mjs +6 -0
  99. package/dist/es-CWW1uLK3.mjs.map +1 -0
  100. package/dist/es-CyPr-juY.cjs +131 -0
  101. package/dist/es-CyPr-juY.cjs.map +1 -0
  102. package/dist/es-DYAui4cM.cjs +12 -0
  103. package/dist/es-DYAui4cM.cjs.map +1 -0
  104. package/dist/es-DjcSUa7j.mjs +125 -0
  105. package/dist/es-DjcSUa7j.mjs.map +1 -0
  106. package/dist/es-DnX0XFqD.mjs +74 -0
  107. package/dist/es-DnX0XFqD.mjs.map +1 -0
  108. package/dist/es-O3pQS-dk.mjs +24 -0
  109. package/dist/es-O3pQS-dk.mjs.map +1 -0
  110. package/dist/fr-7IjPHZxW.mjs +74 -0
  111. package/dist/fr-7IjPHZxW.mjs.map +1 -0
  112. package/dist/fr-BiJrmc6t.mjs +125 -0
  113. package/dist/fr-BiJrmc6t.mjs.map +1 -0
  114. package/dist/fr-BzVQUMC0.cjs +131 -0
  115. package/dist/fr-BzVQUMC0.cjs.map +1 -0
  116. package/dist/fr-C-2Pj7D2.cjs +43 -0
  117. package/dist/fr-C-2Pj7D2.cjs.map +1 -0
  118. package/dist/fr-CT47eWK_.mjs +6 -0
  119. package/dist/fr-CT47eWK_.mjs.map +1 -0
  120. package/dist/fr-DYML7Hb_.cjs +12 -0
  121. package/dist/fr-DYML7Hb_.cjs.map +1 -0
  122. package/dist/fr-DfMQoI8H.mjs +6 -0
  123. package/dist/fr-DfMQoI8H.mjs.map +1 -0
  124. package/dist/fr-MJsdTksK.mjs +24 -0
  125. package/dist/fr-MJsdTksK.mjs.map +1 -0
  126. package/dist/fr-XWBehwDw.cjs +30 -0
  127. package/dist/fr-XWBehwDw.cjs.map +1 -0
  128. package/dist/fr-_zhbWJHh.cjs +12 -0
  129. package/dist/fr-_zhbWJHh.cjs.map +1 -0
  130. package/dist/fr-jXtwm66y.mjs +37 -0
  131. package/dist/fr-jXtwm66y.mjs.map +1 -0
  132. package/dist/fr-wYZdZtt7.cjs +80 -0
  133. package/dist/fr-wYZdZtt7.cjs.map +1 -0
  134. package/dist/he-BNgtWUzu.cjs +43 -0
  135. package/dist/he-BNgtWUzu.cjs.map +1 -0
  136. package/dist/he-BcBh-9RB.cjs +12 -0
  137. package/dist/he-BcBh-9RB.cjs.map +1 -0
  138. package/dist/he-C4xGY_O5.cjs +30 -0
  139. package/dist/he-C4xGY_O5.cjs.map +1 -0
  140. package/dist/he-CBny3yj_.cjs +131 -0
  141. package/dist/he-CBny3yj_.cjs.map +1 -0
  142. package/dist/he-Cai6j3oW.mjs +6 -0
  143. package/dist/he-Cai6j3oW.mjs.map +1 -0
  144. package/dist/he-CsOIjabt.mjs +24 -0
  145. package/dist/he-CsOIjabt.mjs.map +1 -0
  146. package/dist/he-Cu_YCy1f.cjs +12 -0
  147. package/dist/he-Cu_YCy1f.cjs.map +1 -0
  148. package/dist/he-D-R8pe0L.mjs +125 -0
  149. package/dist/he-D-R8pe0L.mjs.map +1 -0
  150. package/dist/he-Dv0k0pX-.cjs +80 -0
  151. package/dist/he-Dv0k0pX-.cjs.map +1 -0
  152. package/dist/he-OAQhQxWm.mjs +74 -0
  153. package/dist/he-OAQhQxWm.mjs.map +1 -0
  154. package/dist/he-gcmGB1-C.mjs +6 -0
  155. package/dist/he-gcmGB1-C.mjs.map +1 -0
  156. package/dist/he-z0iIyfGu.mjs +37 -0
  157. package/dist/he-z0iIyfGu.mjs.map +1 -0
  158. package/dist/hu-BLBHZrAu.mjs +37 -0
  159. package/dist/hu-BLBHZrAu.mjs.map +1 -0
  160. package/dist/hu-BR0rOtJC.cjs +43 -0
  161. package/dist/hu-BR0rOtJC.cjs.map +1 -0
  162. package/dist/hu-BTBlTUaQ.cjs +131 -0
  163. package/dist/hu-BTBlTUaQ.cjs.map +1 -0
  164. package/dist/hu-BTvnBj9a.cjs +30 -0
  165. package/dist/hu-BTvnBj9a.cjs.map +1 -0
  166. package/dist/hu-CDvVhWXF.mjs +74 -0
  167. package/dist/hu-CDvVhWXF.mjs.map +1 -0
  168. package/dist/hu-CYFjRrQD.cjs +80 -0
  169. package/dist/hu-CYFjRrQD.cjs.map +1 -0
  170. package/dist/hu-Czc1FPg9.cjs +12 -0
  171. package/dist/hu-Czc1FPg9.cjs.map +1 -0
  172. package/dist/hu-D4fy_GxO.mjs +125 -0
  173. package/dist/hu-D4fy_GxO.mjs.map +1 -0
  174. package/dist/hu-DGyykLlw.mjs +24 -0
  175. package/dist/hu-DGyykLlw.mjs.map +1 -0
  176. package/dist/hu-DS-6XHh5.mjs +6 -0
  177. package/dist/hu-DS-6XHh5.mjs.map +1 -0
  178. package/dist/hu-DqI8hdAt.cjs +12 -0
  179. package/dist/hu-DqI8hdAt.cjs.map +1 -0
  180. package/dist/hu-pswRdooT.mjs +6 -0
  181. package/dist/hu-pswRdooT.mjs.map +1 -0
  182. package/dist/id-4tl2Uj7F.mjs +6 -0
  183. package/dist/id-4tl2Uj7F.mjs.map +1 -0
  184. package/dist/id-52itow18.cjs +43 -0
  185. package/dist/id-52itow18.cjs.map +1 -0
  186. package/dist/id-Bbvk8MDA.mjs +125 -0
  187. package/dist/id-Bbvk8MDA.mjs.map +1 -0
  188. package/dist/id-BxQgqmXd.cjs +131 -0
  189. package/dist/id-BxQgqmXd.cjs.map +1 -0
  190. package/dist/id-C4zO4qio.cjs +30 -0
  191. package/dist/id-C4zO4qio.cjs.map +1 -0
  192. package/dist/id-Cdurf_cc.mjs +24 -0
  193. package/dist/id-Cdurf_cc.mjs.map +1 -0
  194. package/dist/id-DGh6JGZ5.mjs +37 -0
  195. package/dist/id-DGh6JGZ5.mjs.map +1 -0
  196. package/dist/id-DP5zxg41.mjs +74 -0
  197. package/dist/id-DP5zxg41.mjs.map +1 -0
  198. package/dist/id-Dhws7LdN.mjs +6 -0
  199. package/dist/id-Dhws7LdN.mjs.map +1 -0
  200. package/dist/id-DqK8hygJ.cjs +12 -0
  201. package/dist/id-DqK8hygJ.cjs.map +1 -0
  202. package/dist/id-Vw9DQ3V1.cjs +12 -0
  203. package/dist/id-Vw9DQ3V1.cjs.map +1 -0
  204. package/dist/id-tlOQCFLJ.cjs +80 -0
  205. package/dist/id-tlOQCFLJ.cjs.map +1 -0
  206. package/dist/index.cjs +152 -61
  207. package/dist/index.cjs.map +1 -1
  208. package/dist/index.d.cts.map +1 -1
  209. package/dist/index.d.mts.map +1 -1
  210. package/dist/index.mjs +152 -61
  211. package/dist/index.mjs.map +1 -1
  212. package/dist/it--DHBKc26.cjs +12 -0
  213. package/dist/it--DHBKc26.cjs.map +1 -0
  214. package/dist/it-BODMi-FY.cjs +30 -0
  215. package/dist/it-BODMi-FY.cjs.map +1 -0
  216. package/dist/it-C34p5klu.mjs +24 -0
  217. package/dist/it-C34p5klu.mjs.map +1 -0
  218. package/dist/it-CPXF5aFi.cjs +80 -0
  219. package/dist/it-CPXF5aFi.cjs.map +1 -0
  220. package/dist/it-CbZjaErj.cjs +43 -0
  221. package/dist/it-CbZjaErj.cjs.map +1 -0
  222. package/dist/it-CfLSq25e.mjs +37 -0
  223. package/dist/it-CfLSq25e.mjs.map +1 -0
  224. package/dist/it-CpnrX6Qu.cjs +12 -0
  225. package/dist/it-CpnrX6Qu.cjs.map +1 -0
  226. package/dist/it-CqvzV23C.mjs +74 -0
  227. package/dist/it-CqvzV23C.mjs.map +1 -0
  228. package/dist/it-ELWZ1sxy.mjs +125 -0
  229. package/dist/it-ELWZ1sxy.mjs.map +1 -0
  230. package/dist/it-Hj3LCvz1.mjs +6 -0
  231. package/dist/it-Hj3LCvz1.mjs.map +1 -0
  232. package/dist/it-L0NVZqjU.cjs +131 -0
  233. package/dist/it-L0NVZqjU.cjs.map +1 -0
  234. package/dist/it-dsOgAn3r.mjs +6 -0
  235. package/dist/it-dsOgAn3r.mjs.map +1 -0
  236. package/dist/ja-B1DQXHgd.mjs +74 -0
  237. package/dist/ja-B1DQXHgd.mjs.map +1 -0
  238. package/dist/ja-B2NQ5sR-.cjs +80 -0
  239. package/dist/ja-B2NQ5sR-.cjs.map +1 -0
  240. package/dist/ja-BYGHlw8d.cjs +30 -0
  241. package/dist/ja-BYGHlw8d.cjs.map +1 -0
  242. package/dist/ja-BaU2QXo2.cjs +43 -0
  243. package/dist/ja-BaU2QXo2.cjs.map +1 -0
  244. package/dist/ja-BqySbP-W.mjs +6 -0
  245. package/dist/ja-BqySbP-W.mjs.map +1 -0
  246. package/dist/ja-C1QZfTGN.mjs +125 -0
  247. package/dist/ja-C1QZfTGN.mjs.map +1 -0
  248. package/dist/ja-C3C0k99E.cjs +12 -0
  249. package/dist/ja-C3C0k99E.cjs.map +1 -0
  250. package/dist/ja-Cft4ODrl.mjs +24 -0
  251. package/dist/ja-Cft4ODrl.mjs.map +1 -0
  252. package/dist/ja-CuLC8KzH.mjs +6 -0
  253. package/dist/ja-CuLC8KzH.mjs.map +1 -0
  254. package/dist/ja-D5fpLCDT.cjs +131 -0
  255. package/dist/ja-D5fpLCDT.cjs.map +1 -0
  256. package/dist/ja-JVcCjBJ9.cjs +12 -0
  257. package/dist/ja-JVcCjBJ9.cjs.map +1 -0
  258. package/dist/ja-kM5CUvdg.mjs +37 -0
  259. package/dist/ja-kM5CUvdg.mjs.map +1 -0
  260. package/dist/ko-BREsc9Rl.mjs +24 -0
  261. package/dist/ko-BREsc9Rl.mjs.map +1 -0
  262. package/dist/ko-BX4GXxaa.mjs +125 -0
  263. package/dist/ko-BX4GXxaa.mjs.map +1 -0
  264. package/dist/ko-C0Q33hJ9.cjs +80 -0
  265. package/dist/ko-C0Q33hJ9.cjs.map +1 -0
  266. package/dist/ko-Cdb4MyCC.mjs +6 -0
  267. package/dist/ko-Cdb4MyCC.mjs.map +1 -0
  268. package/dist/ko-D2TLG_3_.mjs +37 -0
  269. package/dist/ko-D2TLG_3_.mjs.map +1 -0
  270. package/dist/ko-D64no-WM.cjs +131 -0
  271. package/dist/ko-D64no-WM.cjs.map +1 -0
  272. package/dist/ko-DDBkvKT3.mjs +6 -0
  273. package/dist/ko-DDBkvKT3.mjs.map +1 -0
  274. package/dist/ko-DROYufGO.cjs +12 -0
  275. package/dist/ko-DROYufGO.cjs.map +1 -0
  276. package/dist/ko-HEegPkOi.cjs +30 -0
  277. package/dist/ko-HEegPkOi.cjs.map +1 -0
  278. package/dist/ko-PUpIJgsU.mjs +74 -0
  279. package/dist/ko-PUpIJgsU.mjs.map +1 -0
  280. package/dist/ko-WIfVodYY.cjs +12 -0
  281. package/dist/ko-WIfVodYY.cjs.map +1 -0
  282. package/dist/ko-vQjiRfrX.cjs +43 -0
  283. package/dist/ko-vQjiRfrX.cjs.map +1 -0
  284. package/dist/nl-BdRkpB-f.mjs +74 -0
  285. package/dist/nl-BdRkpB-f.mjs.map +1 -0
  286. package/dist/nl-Byk7MZjq.cjs +12 -0
  287. package/dist/nl-Byk7MZjq.cjs.map +1 -0
  288. package/dist/nl-C5U5y6gr.cjs +12 -0
  289. package/dist/nl-C5U5y6gr.cjs.map +1 -0
  290. package/dist/nl-C8T6RqHI.cjs +131 -0
  291. package/dist/nl-C8T6RqHI.cjs.map +1 -0
  292. package/dist/nl-CxaUAerZ.mjs +24 -0
  293. package/dist/nl-CxaUAerZ.mjs.map +1 -0
  294. package/dist/nl-D0dcnS-5.mjs +6 -0
  295. package/dist/nl-D0dcnS-5.mjs.map +1 -0
  296. package/dist/nl-D5y8p_At.cjs +80 -0
  297. package/dist/nl-D5y8p_At.cjs.map +1 -0
  298. package/dist/nl-DFUHK5ta.mjs +6 -0
  299. package/dist/nl-DFUHK5ta.mjs.map +1 -0
  300. package/dist/nl-DRxCBp_v.cjs +43 -0
  301. package/dist/nl-DRxCBp_v.cjs.map +1 -0
  302. package/dist/nl-Dww7O0AO.mjs +37 -0
  303. package/dist/nl-Dww7O0AO.mjs.map +1 -0
  304. package/dist/nl-ayPagHJ_.cjs +30 -0
  305. package/dist/nl-ayPagHJ_.cjs.map +1 -0
  306. package/dist/nl-mL8uL7cu.mjs +125 -0
  307. package/dist/nl-mL8uL7cu.mjs.map +1 -0
  308. package/dist/pl-AsC20yM9.cjs +43 -0
  309. package/dist/pl-AsC20yM9.cjs.map +1 -0
  310. package/dist/pl-Beb7Fiam.mjs +125 -0
  311. package/dist/pl-Beb7Fiam.mjs.map +1 -0
  312. package/dist/pl-BvfqoRfV.cjs +80 -0
  313. package/dist/pl-BvfqoRfV.cjs.map +1 -0
  314. package/dist/pl-COP9NGch.mjs +6 -0
  315. package/dist/pl-COP9NGch.mjs.map +1 -0
  316. package/dist/pl-CcIcOxXb.mjs +6 -0
  317. package/dist/pl-CcIcOxXb.mjs.map +1 -0
  318. package/dist/pl-CgKBvrJr.mjs +24 -0
  319. package/dist/pl-CgKBvrJr.mjs.map +1 -0
  320. package/dist/pl-DJKAFKNJ.cjs +12 -0
  321. package/dist/pl-DJKAFKNJ.cjs.map +1 -0
  322. package/dist/pl-DZZ1e6TM.cjs +12 -0
  323. package/dist/pl-DZZ1e6TM.cjs.map +1 -0
  324. package/dist/pl-DpVEpGL0.cjs +131 -0
  325. package/dist/pl-DpVEpGL0.cjs.map +1 -0
  326. package/dist/pl-LHrd1s6r.cjs +30 -0
  327. package/dist/pl-LHrd1s6r.cjs.map +1 -0
  328. package/dist/pl-PV9rlOz1.mjs +37 -0
  329. package/dist/pl-PV9rlOz1.mjs.map +1 -0
  330. package/dist/pl-XfyC_jQs.mjs +74 -0
  331. package/dist/pl-XfyC_jQs.mjs.map +1 -0
  332. package/dist/pt-B4hr_uJO.mjs +125 -0
  333. package/dist/pt-B4hr_uJO.mjs.map +1 -0
  334. package/dist/pt-BBFH5zDu.cjs +43 -0
  335. package/dist/pt-BBFH5zDu.cjs.map +1 -0
  336. package/dist/pt-BC56DXTY.mjs +37 -0
  337. package/dist/pt-BC56DXTY.mjs.map +1 -0
  338. package/dist/pt-BrnvgQRs.cjs +12 -0
  339. package/dist/pt-BrnvgQRs.cjs.map +1 -0
  340. package/dist/pt-CSvh02ed.mjs +6 -0
  341. package/dist/pt-CSvh02ed.mjs.map +1 -0
  342. package/dist/pt-CW6UZk1v.cjs +30 -0
  343. package/dist/pt-CW6UZk1v.cjs.map +1 -0
  344. package/dist/pt-CifIYahI.cjs +131 -0
  345. package/dist/pt-CifIYahI.cjs.map +1 -0
  346. package/dist/pt-CpQN7iPy.cjs +12 -0
  347. package/dist/pt-CpQN7iPy.cjs.map +1 -0
  348. package/dist/pt-DG1WQnTO.mjs +24 -0
  349. package/dist/pt-DG1WQnTO.mjs.map +1 -0
  350. package/dist/pt-DLFLkEpR.mjs +74 -0
  351. package/dist/pt-DLFLkEpR.mjs.map +1 -0
  352. package/dist/pt-D_Fxu0mz.mjs +6 -0
  353. package/dist/pt-D_Fxu0mz.mjs.map +1 -0
  354. package/dist/pt-Dx69fLab.cjs +80 -0
  355. package/dist/pt-Dx69fLab.cjs.map +1 -0
  356. package/dist/ro-B6ExafZC.cjs +131 -0
  357. package/dist/ro-B6ExafZC.cjs.map +1 -0
  358. package/dist/ro-BY4QQCns.cjs +30 -0
  359. package/dist/ro-BY4QQCns.cjs.map +1 -0
  360. package/dist/ro-CGOwHLvs.cjs +12 -0
  361. package/dist/ro-CGOwHLvs.cjs.map +1 -0
  362. package/dist/ro-CJJKGRs9.mjs +37 -0
  363. package/dist/ro-CJJKGRs9.mjs.map +1 -0
  364. package/dist/ro-Cu3cJnmT.mjs +74 -0
  365. package/dist/ro-Cu3cJnmT.mjs.map +1 -0
  366. package/dist/ro-D2WH48l8.mjs +6 -0
  367. package/dist/ro-D2WH48l8.mjs.map +1 -0
  368. package/dist/ro-DS3mARiW.cjs +43 -0
  369. package/dist/ro-DS3mARiW.cjs.map +1 -0
  370. package/dist/ro-DStH8jqQ.cjs +80 -0
  371. package/dist/ro-DStH8jqQ.cjs.map +1 -0
  372. package/dist/ro-Dg398PV0.mjs +24 -0
  373. package/dist/ro-Dg398PV0.mjs.map +1 -0
  374. package/dist/ro-DhGoI55Z.mjs +125 -0
  375. package/dist/ro-DhGoI55Z.mjs.map +1 -0
  376. package/dist/ro-dpJtFKiA.cjs +12 -0
  377. package/dist/ro-dpJtFKiA.cjs.map +1 -0
  378. package/dist/ro-lFxvLN7R.mjs +6 -0
  379. package/dist/ro-lFxvLN7R.mjs.map +1 -0
  380. package/dist/ru-9zdAxTCI.cjs +30 -0
  381. package/dist/ru-9zdAxTCI.cjs.map +1 -0
  382. package/dist/ru-BCP_P-Kw.mjs +6 -0
  383. package/dist/ru-BCP_P-Kw.mjs.map +1 -0
  384. package/dist/ru-BymfL4lY.mjs +125 -0
  385. package/dist/ru-BymfL4lY.mjs.map +1 -0
  386. package/dist/ru-C9sTu8KO.mjs +74 -0
  387. package/dist/ru-C9sTu8KO.mjs.map +1 -0
  388. package/dist/ru-CKfstS2M.cjs +43 -0
  389. package/dist/ru-CKfstS2M.cjs.map +1 -0
  390. package/dist/ru-CW4wBDfy.cjs +12 -0
  391. package/dist/ru-CW4wBDfy.cjs.map +1 -0
  392. package/dist/ru-CyoLQlWx.cjs +12 -0
  393. package/dist/ru-CyoLQlWx.cjs.map +1 -0
  394. package/dist/ru-DHNcAvHk.mjs +37 -0
  395. package/dist/ru-DHNcAvHk.mjs.map +1 -0
  396. package/dist/ru-DPs8Axnb.cjs +80 -0
  397. package/dist/ru-DPs8Axnb.cjs.map +1 -0
  398. package/dist/ru-JgTYyWIt.mjs +6 -0
  399. package/dist/ru-JgTYyWIt.mjs.map +1 -0
  400. package/dist/ru-fz-F75f4.cjs +131 -0
  401. package/dist/ru-fz-F75f4.cjs.map +1 -0
  402. package/dist/ru-k8yUinAx.mjs +24 -0
  403. package/dist/ru-k8yUinAx.mjs.map +1 -0
  404. package/dist/th-B83Fh-0G.cjs +12 -0
  405. package/dist/th-B83Fh-0G.cjs.map +1 -0
  406. package/dist/th-BVg0Jjgr.cjs +131 -0
  407. package/dist/th-BVg0Jjgr.cjs.map +1 -0
  408. package/dist/th-BYXBW0X2.cjs +43 -0
  409. package/dist/th-BYXBW0X2.cjs.map +1 -0
  410. package/dist/th-C7VrhPP5.cjs +12 -0
  411. package/dist/th-C7VrhPP5.cjs.map +1 -0
  412. package/dist/th-CZxqRIHs.mjs +6 -0
  413. package/dist/th-CZxqRIHs.mjs.map +1 -0
  414. package/dist/th-CmX6_2CM.mjs +74 -0
  415. package/dist/th-CmX6_2CM.mjs.map +1 -0
  416. package/dist/th-D8Prwe8n.cjs +30 -0
  417. package/dist/th-D8Prwe8n.cjs.map +1 -0
  418. package/dist/th-DkjnkI6P.mjs +6 -0
  419. package/dist/th-DkjnkI6P.mjs.map +1 -0
  420. package/dist/th-KyxBje7z.cjs +80 -0
  421. package/dist/th-KyxBje7z.cjs.map +1 -0
  422. package/dist/th-cad5Cap4.mjs +37 -0
  423. package/dist/th-cad5Cap4.mjs.map +1 -0
  424. package/dist/th-ge5FSv6T.mjs +125 -0
  425. package/dist/th-ge5FSv6T.mjs.map +1 -0
  426. package/dist/th-nYdqpaRn.mjs +24 -0
  427. package/dist/th-nYdqpaRn.mjs.map +1 -0
  428. package/dist/tl-B888TBzV.mjs +37 -0
  429. package/dist/tl-B888TBzV.mjs.map +1 -0
  430. package/dist/tl-Bua5-krl.mjs +24 -0
  431. package/dist/tl-Bua5-krl.mjs.map +1 -0
  432. package/dist/tl-CATDGPeB.cjs +12 -0
  433. package/dist/tl-CATDGPeB.cjs.map +1 -0
  434. package/dist/tl-CKjLSF_S.cjs +131 -0
  435. package/dist/tl-CKjLSF_S.cjs.map +1 -0
  436. package/dist/tl-CT5Bevzy.mjs +6 -0
  437. package/dist/tl-CT5Bevzy.mjs.map +1 -0
  438. package/dist/tl-CsRFJOIR.cjs +80 -0
  439. package/dist/tl-CsRFJOIR.cjs.map +1 -0
  440. package/dist/tl-D4iI7i02.cjs +30 -0
  441. package/dist/tl-D4iI7i02.cjs.map +1 -0
  442. package/dist/tl-DCKUBvuV.mjs +6 -0
  443. package/dist/tl-DCKUBvuV.mjs.map +1 -0
  444. package/dist/tl-DI0F6h6a.mjs +74 -0
  445. package/dist/tl-DI0F6h6a.mjs.map +1 -0
  446. package/dist/tl-DzIwhz3k.cjs +12 -0
  447. package/dist/tl-DzIwhz3k.cjs.map +1 -0
  448. package/dist/tl-icpkJ5RY.mjs +125 -0
  449. package/dist/tl-icpkJ5RY.mjs.map +1 -0
  450. package/dist/tl-lZlSu-sM.cjs +43 -0
  451. package/dist/tl-lZlSu-sM.cjs.map +1 -0
  452. package/dist/tr-9nLGvy6N.mjs +24 -0
  453. package/dist/tr-9nLGvy6N.mjs.map +1 -0
  454. package/dist/tr-B96yy4BZ.mjs +37 -0
  455. package/dist/tr-B96yy4BZ.mjs.map +1 -0
  456. package/dist/tr-BdEGICrX.cjs +80 -0
  457. package/dist/tr-BdEGICrX.cjs.map +1 -0
  458. package/dist/tr-Bsdv5dWu.cjs +12 -0
  459. package/dist/tr-Bsdv5dWu.cjs.map +1 -0
  460. package/dist/tr-Bu5HeGRu.cjs +30 -0
  461. package/dist/tr-Bu5HeGRu.cjs.map +1 -0
  462. package/dist/tr-COlHtN47.mjs +6 -0
  463. package/dist/tr-COlHtN47.mjs.map +1 -0
  464. package/dist/tr-CVK6oefd.cjs +12 -0
  465. package/dist/tr-CVK6oefd.cjs.map +1 -0
  466. package/dist/tr-CifdAA_w.cjs +43 -0
  467. package/dist/tr-CifdAA_w.cjs.map +1 -0
  468. package/dist/tr-D1KVbmGI.mjs +74 -0
  469. package/dist/tr-D1KVbmGI.mjs.map +1 -0
  470. package/dist/tr-DMnXKPnI.cjs +131 -0
  471. package/dist/tr-DMnXKPnI.cjs.map +1 -0
  472. package/dist/tr-DuFbZrRu.mjs +6 -0
  473. package/dist/tr-DuFbZrRu.mjs.map +1 -0
  474. package/dist/tr-QaTfqnit.mjs +125 -0
  475. package/dist/tr-QaTfqnit.mjs.map +1 -0
  476. package/dist/zh_CN-2FPc1yGp.mjs +6 -0
  477. package/dist/zh_CN-2FPc1yGp.mjs.map +1 -0
  478. package/dist/zh_CN-BJnhvkc0.mjs +37 -0
  479. package/dist/zh_CN-BJnhvkc0.mjs.map +1 -0
  480. package/dist/zh_CN-BT8zi4ct.mjs +125 -0
  481. package/dist/zh_CN-BT8zi4ct.mjs.map +1 -0
  482. package/dist/zh_CN-BUDga7b8.cjs +12 -0
  483. package/dist/zh_CN-BUDga7b8.cjs.map +1 -0
  484. package/dist/zh_CN-BWIy2qoV.cjs +43 -0
  485. package/dist/zh_CN-BWIy2qoV.cjs.map +1 -0
  486. package/dist/zh_CN-BrkBDK-m.cjs +131 -0
  487. package/dist/zh_CN-BrkBDK-m.cjs.map +1 -0
  488. package/dist/zh_CN-Bzo7sqbA.cjs +12 -0
  489. package/dist/zh_CN-Bzo7sqbA.cjs.map +1 -0
  490. package/dist/zh_CN-CEwzKvT8.mjs +74 -0
  491. package/dist/zh_CN-CEwzKvT8.mjs.map +1 -0
  492. package/dist/zh_CN-CLqN3qJp.mjs +24 -0
  493. package/dist/zh_CN-CLqN3qJp.mjs.map +1 -0
  494. package/dist/zh_CN-DZFGqn6D.cjs +30 -0
  495. package/dist/zh_CN-DZFGqn6D.cjs.map +1 -0
  496. package/dist/zh_CN-oOeDsP-B.mjs +6 -0
  497. package/dist/zh_CN-oOeDsP-B.mjs.map +1 -0
  498. package/dist/zh_CN-wE1DUfsY.cjs +80 -0
  499. package/dist/zh_CN-wE1DUfsY.cjs.map +1 -0
  500. package/dist/zh_TW-BeBQ0pV1.mjs +74 -0
  501. package/dist/zh_TW-BeBQ0pV1.mjs.map +1 -0
  502. package/dist/zh_TW-Bz5_kUpI.mjs +37 -0
  503. package/dist/zh_TW-Bz5_kUpI.mjs.map +1 -0
  504. package/dist/zh_TW-CZhSh3BU.cjs +80 -0
  505. package/dist/zh_TW-CZhSh3BU.cjs.map +1 -0
  506. package/dist/zh_TW-D-xI7JBs.mjs +6 -0
  507. package/dist/zh_TW-D-xI7JBs.mjs.map +1 -0
  508. package/dist/zh_TW-D86GUR9C.cjs +43 -0
  509. package/dist/zh_TW-D86GUR9C.cjs.map +1 -0
  510. package/dist/zh_TW-DPLNY3Sh.cjs +12 -0
  511. package/dist/zh_TW-DPLNY3Sh.cjs.map +1 -0
  512. package/dist/zh_TW-DQdWK1u9.cjs +12 -0
  513. package/dist/zh_TW-DQdWK1u9.cjs.map +1 -0
  514. package/dist/zh_TW-Dg6LeVzh.mjs +24 -0
  515. package/dist/zh_TW-Dg6LeVzh.mjs.map +1 -0
  516. package/dist/zh_TW-DoDLHILX.cjs +30 -0
  517. package/dist/zh_TW-DoDLHILX.cjs.map +1 -0
  518. package/dist/zh_TW-Dqcoo0F5.mjs +6 -0
  519. package/dist/zh_TW-Dqcoo0F5.mjs.map +1 -0
  520. package/dist/zh_TW-DzFlj-kU.cjs +131 -0
  521. package/dist/zh_TW-DzFlj-kU.cjs.map +1 -0
  522. package/dist/zh_TW-idE0Evam.mjs +125 -0
  523. package/dist/zh_TW-idE0Evam.mjs.map +1 -0
  524. package/package.json +16 -16
  525. package/dist/AddressAutocompleteInput-DiXfEThY.mjs +0 -2214
  526. package/dist/AddressAutocompleteInput-DiXfEThY.mjs.map +0 -1
  527. package/dist/AddressAutocompleteInput-DmsSlPVz.cjs +0 -2310
  528. package/dist/AddressAutocompleteInput-DmsSlPVz.cjs.map +0 -1
  529. package/dist/ContactsScreen-9SzNlWEb.cjs +0 -10
  530. package/dist/ContactsScreen-BIPKKITz.mjs +0 -3397
  531. package/dist/ContactsScreen-BIPKKITz.mjs.map +0 -1
  532. package/dist/ContactsScreen-Comv_f_d.cjs +0 -3405
  533. package/dist/ContactsScreen-Comv_f_d.cjs.map +0 -1
  534. package/dist/ProfileScreen-B4OYJdd1.cjs +0 -1244
  535. package/dist/ProfileScreen-B4OYJdd1.cjs.map +0 -1
  536. package/dist/ProfileScreen-Be3RVQ2L.mjs +0 -1232
  537. package/dist/ProfileScreen-Be3RVQ2L.mjs.map +0 -1
  538. package/dist/ProfileScreen-D9YYYFK-.mjs +0 -46
  539. package/dist/ProfileScreen-j7Eyy4tk.cjs +0 -48
  540. package/dist/ShareablesScreen-CPvylNL7.mjs +0 -13
  541. package/dist/ShareablesScreen-CQZBq1Hl.cjs +0 -13457
  542. package/dist/ShareablesScreen-CQZBq1Hl.cjs.map +0 -1
  543. package/dist/ShareablesScreen-DYOIQwK-.mjs +0 -13441
  544. package/dist/ShareablesScreen-DYOIQwK-.mjs.map +0 -1
  545. package/dist/ShareablesScreen-ljPcmGLg.cjs +0 -15
  546. package/dist/ShopScreen-BEKSgvCp.mjs +0 -45
  547. package/dist/ShopScreen-CU0ynA2v.mjs +0 -1282
  548. package/dist/ShopScreen-CU0ynA2v.mjs.map +0 -1
  549. package/dist/ShopScreen-Cr_XcWdY.cjs +0 -1295
  550. package/dist/ShopScreen-Cr_XcWdY.cjs.map +0 -1
  551. package/dist/ShopScreen-QjSfEvCZ.cjs +0 -47
  552. package/dist/SubscriptionsScreen-Ces1Pv8k.mjs +0 -5723
  553. package/dist/SubscriptionsScreen-Ces1Pv8k.mjs.map +0 -1
  554. package/dist/SubscriptionsScreen-Cu-WeJ7L.cjs +0 -11
  555. package/dist/SubscriptionsScreen-DMqKtptN.cjs +0 -5791
  556. package/dist/SubscriptionsScreen-DMqKtptN.cjs.map +0 -1
  557. package/dist/UpgradeScreen-B4CnkCjg.cjs +0 -203
  558. package/dist/UpgradeScreen-B4CnkCjg.cjs.map +0 -1
  559. package/dist/UpgradeScreen-C9TjaPoJ.mjs +0 -196
  560. package/dist/UpgradeScreen-C9TjaPoJ.mjs.map +0 -1
  561. package/dist/UpgradeScreen-jvHU1at7.cjs +0 -6
  562. package/dist/de-14i_YO8a.mjs +0 -125
  563. package/dist/de-14i_YO8a.mjs.map +0 -1
  564. package/dist/de-8f8CBqQz.mjs +0 -74
  565. package/dist/de-8f8CBqQz.mjs.map +0 -1
  566. package/dist/de-C2d-Wmdy.cjs +0 -80
  567. package/dist/de-C2d-Wmdy.cjs.map +0 -1
  568. package/dist/de-CjPctz3q.cjs +0 -43
  569. package/dist/de-CjPctz3q.cjs.map +0 -1
  570. package/dist/de-DBGj2OFs.cjs +0 -30
  571. package/dist/de-DBGj2OFs.cjs.map +0 -1
  572. package/dist/de-DCq1H3bn.mjs +0 -24
  573. package/dist/de-DCq1H3bn.mjs.map +0 -1
  574. package/dist/de-DbKC3CDA.mjs +0 -37
  575. package/dist/de-DbKC3CDA.mjs.map +0 -1
  576. package/dist/de-MxH9dP_P.cjs +0 -131
  577. package/dist/de-MxH9dP_P.cjs.map +0 -1
  578. package/dist/el-B0l-Q1qT.mjs +0 -37
  579. package/dist/el-B0l-Q1qT.mjs.map +0 -1
  580. package/dist/el-B8bnnoKc.mjs +0 -24
  581. package/dist/el-B8bnnoKc.mjs.map +0 -1
  582. package/dist/el-BGxr23AZ.mjs +0 -74
  583. package/dist/el-BGxr23AZ.mjs.map +0 -1
  584. package/dist/el-BKGArK2f.cjs +0 -80
  585. package/dist/el-BKGArK2f.cjs.map +0 -1
  586. package/dist/el-BdbemgXl.cjs +0 -43
  587. package/dist/el-BdbemgXl.cjs.map +0 -1
  588. package/dist/el-C_EpDLLk.mjs +0 -125
  589. package/dist/el-C_EpDLLk.mjs.map +0 -1
  590. package/dist/el-DJbG54c1.cjs +0 -30
  591. package/dist/el-DJbG54c1.cjs.map +0 -1
  592. package/dist/el-v1A4TFkT.cjs +0 -131
  593. package/dist/el-v1A4TFkT.cjs.map +0 -1
  594. package/dist/es-BMW1EA1c.cjs +0 -30
  595. package/dist/es-BMW1EA1c.cjs.map +0 -1
  596. package/dist/es-BaMIh5FA.mjs +0 -125
  597. package/dist/es-BaMIh5FA.mjs.map +0 -1
  598. package/dist/es-CT2hq6ZJ.mjs +0 -24
  599. package/dist/es-CT2hq6ZJ.mjs.map +0 -1
  600. package/dist/es-C_4clFHt.cjs +0 -80
  601. package/dist/es-C_4clFHt.cjs.map +0 -1
  602. package/dist/es-CiGfOfqA.cjs +0 -43
  603. package/dist/es-CiGfOfqA.cjs.map +0 -1
  604. package/dist/es-CtRMRF22.mjs +0 -37
  605. package/dist/es-CtRMRF22.mjs.map +0 -1
  606. package/dist/es-DwVnFc84.mjs +0 -74
  607. package/dist/es-DwVnFc84.mjs.map +0 -1
  608. package/dist/es-OY_6uXf5.cjs +0 -131
  609. package/dist/es-OY_6uXf5.cjs.map +0 -1
  610. package/dist/fr-6k1dLzPa.cjs +0 -30
  611. package/dist/fr-6k1dLzPa.cjs.map +0 -1
  612. package/dist/fr-BXkj4XVE.cjs +0 -43
  613. package/dist/fr-BXkj4XVE.cjs.map +0 -1
  614. package/dist/fr-BcnTVvSD.mjs +0 -24
  615. package/dist/fr-BcnTVvSD.mjs.map +0 -1
  616. package/dist/fr-C0Oj4xnv.mjs +0 -74
  617. package/dist/fr-C0Oj4xnv.mjs.map +0 -1
  618. package/dist/fr-Ce2tevwP.mjs +0 -125
  619. package/dist/fr-Ce2tevwP.mjs.map +0 -1
  620. package/dist/fr-DSG1yVZR.cjs +0 -80
  621. package/dist/fr-DSG1yVZR.cjs.map +0 -1
  622. package/dist/fr-Zh7yPXbQ.cjs +0 -131
  623. package/dist/fr-Zh7yPXbQ.cjs.map +0 -1
  624. package/dist/fr-kd7QtgdA.mjs +0 -37
  625. package/dist/fr-kd7QtgdA.mjs.map +0 -1
  626. package/dist/he-Alro4HT4.cjs +0 -30
  627. package/dist/he-Alro4HT4.cjs.map +0 -1
  628. package/dist/he-B4cg1J00.mjs +0 -74
  629. package/dist/he-B4cg1J00.mjs.map +0 -1
  630. package/dist/he-Bsinkol5.mjs +0 -125
  631. package/dist/he-Bsinkol5.mjs.map +0 -1
  632. package/dist/he-CTOKIYzG.cjs +0 -80
  633. package/dist/he-CTOKIYzG.cjs.map +0 -1
  634. package/dist/he-CdDmyq0k.cjs +0 -43
  635. package/dist/he-CdDmyq0k.cjs.map +0 -1
  636. package/dist/he-CuuLh6US.cjs +0 -131
  637. package/dist/he-CuuLh6US.cjs.map +0 -1
  638. package/dist/he-CvNcU3F-.mjs +0 -24
  639. package/dist/he-CvNcU3F-.mjs.map +0 -1
  640. package/dist/he-oOy2HM0e.mjs +0 -37
  641. package/dist/he-oOy2HM0e.mjs.map +0 -1
  642. package/dist/hu-B84oEeJZ.mjs +0 -125
  643. package/dist/hu-B84oEeJZ.mjs.map +0 -1
  644. package/dist/hu-BSPTfhWR.cjs +0 -43
  645. package/dist/hu-BSPTfhWR.cjs.map +0 -1
  646. package/dist/hu-CF_ikpEl.cjs +0 -80
  647. package/dist/hu-CF_ikpEl.cjs.map +0 -1
  648. package/dist/hu-CYlsbrG1.mjs +0 -24
  649. package/dist/hu-CYlsbrG1.mjs.map +0 -1
  650. package/dist/hu-D5x1eDHD.cjs +0 -30
  651. package/dist/hu-D5x1eDHD.cjs.map +0 -1
  652. package/dist/hu-Dv5s1IMB.mjs +0 -37
  653. package/dist/hu-Dv5s1IMB.mjs.map +0 -1
  654. package/dist/hu-IZ3Wz8XP.mjs +0 -74
  655. package/dist/hu-IZ3Wz8XP.mjs.map +0 -1
  656. package/dist/hu-Vw6dogZo.cjs +0 -131
  657. package/dist/hu-Vw6dogZo.cjs.map +0 -1
  658. package/dist/id-1z_sYwiV.cjs +0 -131
  659. package/dist/id-1z_sYwiV.cjs.map +0 -1
  660. package/dist/id-C30Gd0ig.mjs +0 -24
  661. package/dist/id-C30Gd0ig.mjs.map +0 -1
  662. package/dist/id-C4q84iQs.mjs +0 -37
  663. package/dist/id-C4q84iQs.mjs.map +0 -1
  664. package/dist/id-CKzznQLP.cjs +0 -80
  665. package/dist/id-CKzznQLP.cjs.map +0 -1
  666. package/dist/id-CXL-L1qX.mjs +0 -125
  667. package/dist/id-CXL-L1qX.mjs.map +0 -1
  668. package/dist/id-DI4Mmfx0.mjs +0 -74
  669. package/dist/id-DI4Mmfx0.mjs.map +0 -1
  670. package/dist/id-Duby505w.cjs +0 -30
  671. package/dist/id-Duby505w.cjs.map +0 -1
  672. package/dist/id-NeJHVkY8.cjs +0 -43
  673. package/dist/id-NeJHVkY8.cjs.map +0 -1
  674. package/dist/it-5pXu8eWE.cjs +0 -43
  675. package/dist/it-5pXu8eWE.cjs.map +0 -1
  676. package/dist/it-BSiMXbIw.cjs +0 -30
  677. package/dist/it-BSiMXbIw.cjs.map +0 -1
  678. package/dist/it-BbNDdOME.mjs +0 -37
  679. package/dist/it-BbNDdOME.mjs.map +0 -1
  680. package/dist/it-CQY4tm5S.cjs +0 -131
  681. package/dist/it-CQY4tm5S.cjs.map +0 -1
  682. package/dist/it-CTPG4nXE.mjs +0 -24
  683. package/dist/it-CTPG4nXE.mjs.map +0 -1
  684. package/dist/it-CnIs_n8L.mjs +0 -74
  685. package/dist/it-CnIs_n8L.mjs.map +0 -1
  686. package/dist/it-CwAg1PPt.mjs +0 -125
  687. package/dist/it-CwAg1PPt.mjs.map +0 -1
  688. package/dist/it-IEJYmwzw.cjs +0 -80
  689. package/dist/it-IEJYmwzw.cjs.map +0 -1
  690. package/dist/ja-B-YZ7YHO.mjs +0 -74
  691. package/dist/ja-B-YZ7YHO.mjs.map +0 -1
  692. package/dist/ja-BBOP6z7P.cjs +0 -131
  693. package/dist/ja-BBOP6z7P.cjs.map +0 -1
  694. package/dist/ja-CDnUJv_3.mjs +0 -37
  695. package/dist/ja-CDnUJv_3.mjs.map +0 -1
  696. package/dist/ja-D5845TL0.mjs +0 -24
  697. package/dist/ja-D5845TL0.mjs.map +0 -1
  698. package/dist/ja-DobSeN1K.cjs +0 -43
  699. package/dist/ja-DobSeN1K.cjs.map +0 -1
  700. package/dist/ja-X6HQT0aD.cjs +0 -80
  701. package/dist/ja-X6HQT0aD.cjs.map +0 -1
  702. package/dist/ja-lCgyxNWH.mjs +0 -125
  703. package/dist/ja-lCgyxNWH.mjs.map +0 -1
  704. package/dist/ja-pSbdkRSW.cjs +0 -30
  705. package/dist/ja-pSbdkRSW.cjs.map +0 -1
  706. package/dist/ko-B3Oa-b5c.mjs +0 -24
  707. package/dist/ko-B3Oa-b5c.mjs.map +0 -1
  708. package/dist/ko-B4GjXpnY.mjs +0 -125
  709. package/dist/ko-B4GjXpnY.mjs.map +0 -1
  710. package/dist/ko-BIi-F1dV.cjs +0 -131
  711. package/dist/ko-BIi-F1dV.cjs.map +0 -1
  712. package/dist/ko-BfySQ1ZI.mjs +0 -74
  713. package/dist/ko-BfySQ1ZI.mjs.map +0 -1
  714. package/dist/ko-C-DvBsfj.cjs +0 -80
  715. package/dist/ko-C-DvBsfj.cjs.map +0 -1
  716. package/dist/ko-CuJFyarb.cjs +0 -43
  717. package/dist/ko-CuJFyarb.cjs.map +0 -1
  718. package/dist/ko-ir7yEsoy.cjs +0 -30
  719. package/dist/ko-ir7yEsoy.cjs.map +0 -1
  720. package/dist/ko-o5PlsiO4.mjs +0 -37
  721. package/dist/ko-o5PlsiO4.mjs.map +0 -1
  722. package/dist/nl-B3aJ9t79.cjs +0 -30
  723. package/dist/nl-B3aJ9t79.cjs.map +0 -1
  724. package/dist/nl-B8i6Eran.mjs +0 -125
  725. package/dist/nl-B8i6Eran.mjs.map +0 -1
  726. package/dist/nl-Casz-6t5.mjs +0 -37
  727. package/dist/nl-Casz-6t5.mjs.map +0 -1
  728. package/dist/nl-D6QZWEm6.mjs +0 -74
  729. package/dist/nl-D6QZWEm6.mjs.map +0 -1
  730. package/dist/nl-DOW7O3Ls.cjs +0 -80
  731. package/dist/nl-DOW7O3Ls.cjs.map +0 -1
  732. package/dist/nl-DlW0bd6G.mjs +0 -24
  733. package/dist/nl-DlW0bd6G.mjs.map +0 -1
  734. package/dist/nl-L3QBBaKe.cjs +0 -131
  735. package/dist/nl-L3QBBaKe.cjs.map +0 -1
  736. package/dist/nl-UaKnUkiF.cjs +0 -43
  737. package/dist/nl-UaKnUkiF.cjs.map +0 -1
  738. package/dist/pl-BTpBOJRd.mjs +0 -74
  739. package/dist/pl-BTpBOJRd.mjs.map +0 -1
  740. package/dist/pl-Bc5PLKWA.cjs +0 -30
  741. package/dist/pl-Bc5PLKWA.cjs.map +0 -1
  742. package/dist/pl-BhYoyqAF.mjs +0 -125
  743. package/dist/pl-BhYoyqAF.mjs.map +0 -1
  744. package/dist/pl-CK-QOBHU.cjs +0 -43
  745. package/dist/pl-CK-QOBHU.cjs.map +0 -1
  746. package/dist/pl-CMFgAXzQ.mjs +0 -24
  747. package/dist/pl-CMFgAXzQ.mjs.map +0 -1
  748. package/dist/pl-CuCpTUw8.cjs +0 -80
  749. package/dist/pl-CuCpTUw8.cjs.map +0 -1
  750. package/dist/pl-Dhgn2yX2.cjs +0 -131
  751. package/dist/pl-Dhgn2yX2.cjs.map +0 -1
  752. package/dist/pl-QhF51ZKE.mjs +0 -37
  753. package/dist/pl-QhF51ZKE.mjs.map +0 -1
  754. package/dist/pt-BLHjWaSa.cjs +0 -43
  755. package/dist/pt-BLHjWaSa.cjs.map +0 -1
  756. package/dist/pt-BNcmRTXF.mjs +0 -125
  757. package/dist/pt-BNcmRTXF.mjs.map +0 -1
  758. package/dist/pt-Bk5lU5Bq.cjs +0 -30
  759. package/dist/pt-Bk5lU5Bq.cjs.map +0 -1
  760. package/dist/pt-Bo9r1x0D.cjs +0 -131
  761. package/dist/pt-Bo9r1x0D.cjs.map +0 -1
  762. package/dist/pt-CRWFsKEU.mjs +0 -37
  763. package/dist/pt-CRWFsKEU.mjs.map +0 -1
  764. package/dist/pt-DK2uIFjk.mjs +0 -24
  765. package/dist/pt-DK2uIFjk.mjs.map +0 -1
  766. package/dist/pt-DidvCPJO.mjs +0 -74
  767. package/dist/pt-DidvCPJO.mjs.map +0 -1
  768. package/dist/pt-gwAOG4ye.cjs +0 -80
  769. package/dist/pt-gwAOG4ye.cjs.map +0 -1
  770. package/dist/ro-0CezOHmT.cjs +0 -80
  771. package/dist/ro-0CezOHmT.cjs.map +0 -1
  772. package/dist/ro-B3zGlIxa.cjs +0 -30
  773. package/dist/ro-B3zGlIxa.cjs.map +0 -1
  774. package/dist/ro-D7ttD6wI.mjs +0 -24
  775. package/dist/ro-D7ttD6wI.mjs.map +0 -1
  776. package/dist/ro-DIuZ_x0Y.mjs +0 -125
  777. package/dist/ro-DIuZ_x0Y.mjs.map +0 -1
  778. package/dist/ro-DPmaLEta.cjs +0 -131
  779. package/dist/ro-DPmaLEta.cjs.map +0 -1
  780. package/dist/ro-DeurRKLx.mjs +0 -37
  781. package/dist/ro-DeurRKLx.mjs.map +0 -1
  782. package/dist/ro-nugOenVq.cjs +0 -43
  783. package/dist/ro-nugOenVq.cjs.map +0 -1
  784. package/dist/ro-uWPaYSks.mjs +0 -74
  785. package/dist/ro-uWPaYSks.mjs.map +0 -1
  786. package/dist/ru-AaRaNSOD.cjs +0 -80
  787. package/dist/ru-AaRaNSOD.cjs.map +0 -1
  788. package/dist/ru-B9QN1Xa3.cjs +0 -30
  789. package/dist/ru-B9QN1Xa3.cjs.map +0 -1
  790. package/dist/ru-C127BOjG.mjs +0 -125
  791. package/dist/ru-C127BOjG.mjs.map +0 -1
  792. package/dist/ru-C72sfdMa.mjs +0 -24
  793. package/dist/ru-C72sfdMa.mjs.map +0 -1
  794. package/dist/ru-CYExV0AV.cjs +0 -131
  795. package/dist/ru-CYExV0AV.cjs.map +0 -1
  796. package/dist/ru-D9P2Trsv.mjs +0 -74
  797. package/dist/ru-D9P2Trsv.mjs.map +0 -1
  798. package/dist/ru-DH4xf5h_.cjs +0 -43
  799. package/dist/ru-DH4xf5h_.cjs.map +0 -1
  800. package/dist/ru-DbmM_yGB.mjs +0 -37
  801. package/dist/ru-DbmM_yGB.mjs.map +0 -1
  802. package/dist/th-BFt4w61B.cjs +0 -30
  803. package/dist/th-BFt4w61B.cjs.map +0 -1
  804. package/dist/th-BG8R3dAP.cjs +0 -43
  805. package/dist/th-BG8R3dAP.cjs.map +0 -1
  806. package/dist/th-BJlArNGG.mjs +0 -24
  807. package/dist/th-BJlArNGG.mjs.map +0 -1
  808. package/dist/th-BavxQWOu.cjs +0 -131
  809. package/dist/th-BavxQWOu.cjs.map +0 -1
  810. package/dist/th-CGTuBtiC.mjs +0 -37
  811. package/dist/th-CGTuBtiC.mjs.map +0 -1
  812. package/dist/th-a1Jy5C_d.cjs +0 -80
  813. package/dist/th-a1Jy5C_d.cjs.map +0 -1
  814. package/dist/th-h90suc6n.mjs +0 -125
  815. package/dist/th-h90suc6n.mjs.map +0 -1
  816. package/dist/th-zwlwoiv6.mjs +0 -74
  817. package/dist/th-zwlwoiv6.mjs.map +0 -1
  818. package/dist/tl-BHwQDhWD.mjs +0 -125
  819. package/dist/tl-BHwQDhWD.mjs.map +0 -1
  820. package/dist/tl-BoIi6HWk.cjs +0 -131
  821. package/dist/tl-BoIi6HWk.cjs.map +0 -1
  822. package/dist/tl-BsGu5Py0.mjs +0 -24
  823. package/dist/tl-BsGu5Py0.mjs.map +0 -1
  824. package/dist/tl-ByorVCxH.cjs +0 -43
  825. package/dist/tl-ByorVCxH.cjs.map +0 -1
  826. package/dist/tl-C2azJUgn.mjs +0 -74
  827. package/dist/tl-C2azJUgn.mjs.map +0 -1
  828. package/dist/tl-Ce-0Cpm6.cjs +0 -30
  829. package/dist/tl-Ce-0Cpm6.cjs.map +0 -1
  830. package/dist/tl-DN6DtBpZ.cjs +0 -80
  831. package/dist/tl-DN6DtBpZ.cjs.map +0 -1
  832. package/dist/tl-DytTStSw.mjs +0 -37
  833. package/dist/tl-DytTStSw.mjs.map +0 -1
  834. package/dist/tr-5RnbIa4c.mjs +0 -24
  835. package/dist/tr-5RnbIa4c.mjs.map +0 -1
  836. package/dist/tr-8c97dqrL.cjs +0 -131
  837. package/dist/tr-8c97dqrL.cjs.map +0 -1
  838. package/dist/tr-BT6N_Wus.mjs +0 -74
  839. package/dist/tr-BT6N_Wus.mjs.map +0 -1
  840. package/dist/tr-BedGdI5d.cjs +0 -80
  841. package/dist/tr-BedGdI5d.cjs.map +0 -1
  842. package/dist/tr-BouBqgCB.mjs +0 -125
  843. package/dist/tr-BouBqgCB.mjs.map +0 -1
  844. package/dist/tr-D6eImzZD.mjs +0 -37
  845. package/dist/tr-D6eImzZD.mjs.map +0 -1
  846. package/dist/tr-DcRheecc.cjs +0 -43
  847. package/dist/tr-DcRheecc.cjs.map +0 -1
  848. package/dist/tr-De6vY4Jr.cjs +0 -30
  849. package/dist/tr-De6vY4Jr.cjs.map +0 -1
  850. package/dist/zh_CN-BQsZQZhr.mjs +0 -74
  851. package/dist/zh_CN-BQsZQZhr.mjs.map +0 -1
  852. package/dist/zh_CN-BokVyKnZ.cjs +0 -80
  853. package/dist/zh_CN-BokVyKnZ.cjs.map +0 -1
  854. package/dist/zh_CN-COIJjtl4.mjs +0 -37
  855. package/dist/zh_CN-COIJjtl4.mjs.map +0 -1
  856. package/dist/zh_CN-Cj5fwlCh.mjs +0 -24
  857. package/dist/zh_CN-Cj5fwlCh.mjs.map +0 -1
  858. package/dist/zh_CN-Cr8k96O_.cjs +0 -131
  859. package/dist/zh_CN-Cr8k96O_.cjs.map +0 -1
  860. package/dist/zh_CN-CtrM9Bt7.mjs +0 -125
  861. package/dist/zh_CN-CtrM9Bt7.mjs.map +0 -1
  862. package/dist/zh_CN-CubDPpC6.cjs +0 -43
  863. package/dist/zh_CN-CubDPpC6.cjs.map +0 -1
  864. package/dist/zh_CN-CyFIfnPm.cjs +0 -30
  865. package/dist/zh_CN-CyFIfnPm.cjs.map +0 -1
  866. package/dist/zh_TW-BQjHIF9g.cjs +0 -80
  867. package/dist/zh_TW-BQjHIF9g.cjs.map +0 -1
  868. package/dist/zh_TW-BrH-zluV.cjs +0 -43
  869. package/dist/zh_TW-BrH-zluV.cjs.map +0 -1
  870. package/dist/zh_TW-Cs0GkiU5.cjs +0 -30
  871. package/dist/zh_TW-Cs0GkiU5.cjs.map +0 -1
  872. package/dist/zh_TW-DB4Om9FX.mjs +0 -37
  873. package/dist/zh_TW-DB4Om9FX.mjs.map +0 -1
  874. package/dist/zh_TW-DdCGAeE-.mjs +0 -125
  875. package/dist/zh_TW-DdCGAeE-.mjs.map +0 -1
  876. package/dist/zh_TW-MAOS8yS2.mjs +0 -74
  877. package/dist/zh_TW-MAOS8yS2.mjs.map +0 -1
  878. package/dist/zh_TW-Q6KxkIVE.mjs +0 -24
  879. package/dist/zh_TW-Q6KxkIVE.mjs.map +0 -1
  880. package/dist/zh_TW-jgCKq0gP.cjs +0 -131
  881. package/dist/zh_TW-jgCKq0gP.cjs.map +0 -1
@@ -0,0 +1,3397 @@
1
+ import { I as __exportAll } from "./portal_tenant_content-DPLnrtOG.mjs";
2
+ import { n as useCountriesApi } from "./countries-api-context-CMh13cfX.mjs";
3
+ import { n as usePortalTenantClient } from "./PortalTenantClientProvider-BF-1Fy27.mjs";
4
+ import { i as createTranslationContext, n as createDomainTranslations, o as useActiveLocale, r as useDomainDict, t as createStaticDictAdapter } from "./static-dict-adapter-OprHuHgs.mjs";
5
+ import { B as DropdownMenuContent, C as SelectContent, Cn as cn, E as SelectValue, F as FormItem, I as FormLabel, L as FormMessage, N as FormControl, P as FormField, Q as DialogContent, S as Select, Sn as useZodForm, T as SelectTrigger, V as DropdownMenuItem, X as Dialog, Y as DropdownMenuTrigger, _ as SheetContent, _n as AlertDialogTitle, an as BreadcrumbLink, b as SheetTitle, cn as BreadcrumbSeparator, d as Spinner, dn as AlertDialogAction, et as DialogFooter, f as fluidToast, fn as AlertDialogCancel, g as Sheet, gn as AlertDialogHeader, hn as AlertDialogFooter, in as BreadcrumbItem, it as DialogTitle, k as Input, mn as AlertDialogDescription, on as BreadcrumbList, pn as AlertDialogContent, rn as Breadcrumb, sn as BreadcrumbPage, tt as DialogHeader, un as AlertDialog, v as SheetFooter, vn as Button, w as SelectItem, y as SheetHeader, z as DropdownMenu } from "./src-Dk1FJOX0.mjs";
6
+ import { t as parseTaskBody } from "./parse-task-body-DNn57dfP.mjs";
7
+ import { n as ScreenHeaderBreadcrumbs, t as ScreenHeaderActions } from "./ScreenHeaderContext-Dn12BZyj.mjs";
8
+ import { r as storeKeys } from "./query-keys-BkMRwfNo.mjs";
9
+ import { a as useEditor, n as Heading, o as Placeholder, r as EditorContent, t as StarterKit } from "./dist-q1wrtxfG.mjs";
10
+ import { n as TextAlign, t as Underline } from "./dist-DtCehmdR.mjs";
11
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
12
+ import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
13
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
14
+ import { AlignCenter, AlignJustify, AlignLeft, AlignRight, Calendar, Check, ChevronLeft, ChevronRight, CircleCheck, Copy, EllipsisVertical, List, ListOrdered, ListTodo, Mail, MapPin, MoreHorizontal, Paperclip, Pencil, Phone, Plus, Search, StickyNote, Trash2, Users, X } from "lucide-react";
15
+ import { FormProvider, useFormContext, useWatch } from "react-hook-form";
16
+ import { z } from "zod";
17
+ //#region ../../platform/api-client-core/src/parse-api-errors.ts
18
+ /**
19
+ * Framework-agnostic API error parsing utilities.
20
+ *
21
+ * Extracts structured field-level errors from API responses and formats
22
+ * them into human-readable messages. Works with ApiError from this package
23
+ * as well as any error object that has `status`, `data`, and optional `message`.
24
+ */
25
+ /**
26
+ * Converts snake_case or camelCase field names to Title Case
27
+ */
28
+ function formatFieldName(field) {
29
+ return field.replace(/_/g, " ").replace(/([A-Z])/g, " $1").split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ").trim();
30
+ }
31
+ /**
32
+ * Type guard to check if an error looks like an API error
33
+ */
34
+ function isApiLikeError(error) {
35
+ if (!error || typeof error !== "object") return false;
36
+ const err = error;
37
+ return typeof err.status === "number" && "data" in err && (typeof err.message === "string" || err.message === void 0);
38
+ }
39
+ /**
40
+ * Extracts field-level errors from API error data
41
+ */
42
+ function extractFieldErrors(data) {
43
+ const errors = [];
44
+ if (!data || typeof data !== "object") return errors;
45
+ const errorObj = data;
46
+ for (const [key, value] of Object.entries(errorObj)) if (Array.isArray(value) && value.length > 0) errors.push({
47
+ field: formatFieldName(key),
48
+ messages: value.map((item) => typeof item === "string" ? item : JSON.stringify(item))
49
+ });
50
+ else if (typeof value === "string" && value.length > 0) errors.push({
51
+ field: formatFieldName(key),
52
+ messages: [value]
53
+ });
54
+ else if (value && typeof value === "object" && !Array.isArray(value)) extractFieldErrors(value).forEach((nestedError) => {
55
+ errors.push({
56
+ field: `${formatFieldName(key)} → ${nestedError.field}`,
57
+ messages: nestedError.messages
58
+ });
59
+ });
60
+ return errors;
61
+ }
62
+ /**
63
+ * Formats field errors into a readable description string
64
+ */
65
+ function formatErrorDescription(errors) {
66
+ if (errors.length === 0) return "";
67
+ if (errors.length === 1) {
68
+ const err = errors[0];
69
+ if (!err) return "";
70
+ const message = err.messages[0] || "is invalid";
71
+ return `${err.field} ${message}`;
72
+ }
73
+ if (errors.length <= 3) return errors.map((e) => `${e.field} ${e.messages[0] || "is invalid"}`).join("\n");
74
+ const shown = errors.slice(0, 3).map((e) => `${e.field} ${e.messages[0] || "is invalid"}`).join("\n");
75
+ const remaining = errors.length - 3;
76
+ return `${shown}\n...and ${remaining} more ${remaining === 1 ? "error" : "errors"}`;
77
+ }
78
+ /**
79
+ * Parses an error and returns a human-readable description string.
80
+ *
81
+ * Handles:
82
+ * - API-like errors with structured field-level data
83
+ * - API-like errors with a top-level message
84
+ * - Standard Error instances
85
+ * - Falls back to the provided fallback string
86
+ *
87
+ * @param error - The error to parse (ApiError, Error, or unknown)
88
+ * @param fallback - Optional fallback description if error cannot be parsed
89
+ * @returns A human-readable error description, or undefined if nothing could be extracted
90
+ */
91
+ function parseApiErrors(error, fallback) {
92
+ if (isApiLikeError(error)) {
93
+ if (error.data) {
94
+ const fieldErrors = extractFieldErrors(error.data);
95
+ if (fieldErrors.length > 0) return formatErrorDescription(fieldErrors);
96
+ }
97
+ if (error.message) return error.message;
98
+ } else if (error instanceof Error) return error.message;
99
+ return fallback;
100
+ }
101
+ //#endregion
102
+ //#region ../../contacts/core/src/translation-api-context.ts
103
+ const { Provider: ContactsProvider, useTranslation } = createTranslationContext("Contacts");
104
+ const ContactsTranslationProvider = ContactsProvider;
105
+ const useContactsTranslation = useTranslation;
106
+ //#endregion
107
+ //#region ../../contacts/ui/src/screens/ContactCreateScreen.tsx
108
+ function ContactCreateScreen({ onNavigateToList, onSubmit, isPending, children }) {
109
+ const { t } = useContactsTranslation();
110
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
111
+ /* @__PURE__ */ jsxs(ScreenHeaderActions, { children: [/* @__PURE__ */ jsx(Button, {
112
+ variant: "outline",
113
+ onClick: onNavigateToList,
114
+ disabled: isPending,
115
+ children: t("cancel")
116
+ }), /* @__PURE__ */ jsx(Button, {
117
+ onClick: onSubmit,
118
+ disabled: isPending,
119
+ children: isPending ? t("adding") : t("add_contact")
120
+ })] }),
121
+ /* @__PURE__ */ jsx(ScreenHeaderBreadcrumbs, { children: /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsxs(BreadcrumbList, {
122
+ className: "text-lg",
123
+ children: [
124
+ /* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsx(BreadcrumbLink, {
125
+ href: "#",
126
+ onClick: (e) => {
127
+ e.preventDefault();
128
+ onNavigateToList();
129
+ },
130
+ children: t("breadcrumb")
131
+ }) }),
132
+ /* @__PURE__ */ jsx(BreadcrumbSeparator, {}),
133
+ /* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsx(BreadcrumbPage, {
134
+ className: "font-semibold",
135
+ children: t("breadcrumb_new")
136
+ }) })
137
+ ]
138
+ }) }) }),
139
+ children
140
+ ] });
141
+ }
142
+ //#endregion
143
+ //#region ../../contacts/core/src/contacts-api-context.ts
144
+ const ContactsApiContext = createContext(null);
145
+ const ContactsApiProvider = ContactsApiContext.Provider;
146
+ function useContactsDomainApi() {
147
+ const api = useContext(ContactsApiContext);
148
+ if (!api) throw new Error("useContactsDomainApi must be used within a ContactsApiProvider");
149
+ return api;
150
+ }
151
+ function useContactsCrud() {
152
+ return useContactsDomainApi().contacts;
153
+ }
154
+ function useNotesApi() {
155
+ return useContactsDomainApi().notes;
156
+ }
157
+ function useTasksApi() {
158
+ return useContactsDomainApi().tasks;
159
+ }
160
+ /** Returns GroupsApi if the provider supplies one, otherwise null. */
161
+ function useGroupsApi() {
162
+ return useContactsDomainApi().groups ?? null;
163
+ }
164
+ //#endregion
165
+ //#region ../../contacts/core/src/query-keys.ts
166
+ const CONTACTS_QUERY_KEYS = {
167
+ all: (prefix) => [prefix],
168
+ list: (prefix) => [...CONTACTS_QUERY_KEYS.all(prefix), "list"],
169
+ detail: (prefix, id) => [
170
+ ...CONTACTS_QUERY_KEYS.all(prefix),
171
+ "detail",
172
+ id
173
+ ]
174
+ };
175
+ const contactsKeys = {
176
+ activities: (contactId) => [
177
+ "portal-contacts",
178
+ "activities",
179
+ contactId
180
+ ],
181
+ tasks: (contactId) => [
182
+ "portal-contacts",
183
+ "tasks",
184
+ contactId
185
+ ],
186
+ notes: (contactId) => [
187
+ "portal-contacts",
188
+ "notes",
189
+ contactId
190
+ ],
191
+ orders: (contactId) => [
192
+ "rep-contacts",
193
+ "orders",
194
+ contactId
195
+ ],
196
+ subscriptionOrders: (contactId) => [
197
+ "rep-contacts",
198
+ "subscription-orders",
199
+ contactId
200
+ ],
201
+ groups: () => ["portal-contacts", "groups"]
202
+ };
203
+ //#endregion
204
+ //#region ../../contacts/core/src/hooks/use-infinite-contacts.ts
205
+ function useInfiniteContacts(params) {
206
+ const api = useContactsCrud();
207
+ return useInfiniteQuery({
208
+ queryKey: [...CONTACTS_QUERY_KEYS.list("contacts"), params],
209
+ queryFn: ({ pageParam }) => api.listContacts({
210
+ ...params,
211
+ page: pageParam
212
+ }),
213
+ getNextPageParam: (lastPage) => {
214
+ const currentPage = lastPage.meta.current_page;
215
+ if (currentPage == null) return void 0;
216
+ if (lastPage.meta.next_cursor) return currentPage + 1;
217
+ if (lastPage.meta.total_pages != null && currentPage < lastPage.meta.total_pages) return currentPage + 1;
218
+ },
219
+ initialPageParam: 1
220
+ });
221
+ }
222
+ //#endregion
223
+ //#region ../../contacts/ui/src/portal/hooks/groups/use-groups.ts
224
+ function useGroups() {
225
+ const api = useGroupsApi();
226
+ return useQuery({
227
+ queryKey: contactsKeys.groups(),
228
+ queryFn: () => api.listGroups(),
229
+ enabled: !!api,
230
+ select: (data) => data.groups
231
+ });
232
+ }
233
+ //#endregion
234
+ //#region ../../contacts/ui/src/portal/components/contacts/rep-layout/utils.ts
235
+ function getDisplayName(contact) {
236
+ if (contact.full_name && contact.full_name.trim().length > 0) return contact.full_name;
237
+ const parts = [contact.first_name, contact.last_name].filter(Boolean);
238
+ if (parts.length > 0) return parts.join(" ");
239
+ if (contact.email) return contact.email;
240
+ return "Contact";
241
+ }
242
+ function getInitials(name) {
243
+ const parts = name.trim().split(/\s+/);
244
+ return ((parts[0]?.[0] ?? "") + (parts.length > 1 ? parts[parts.length - 1]?.[0] ?? "" : "")).toUpperCase() || "?";
245
+ }
246
+ /** Lowercase relative label derived from `contact.updated_at`.
247
+ * Returns null if the timestamp is missing or unparseable. Lowercase on
248
+ * purpose so callers can compose phrases like "Last updated 3 days ago"
249
+ * without an awkward "Last updated Today". */
250
+ function getRelativeUpdated(contact) {
251
+ const updated = typeof contact.updated_at === "string" ? contact.updated_at : null;
252
+ if (!updated) return null;
253
+ const date = new Date(updated);
254
+ if (Number.isNaN(date.getTime())) return null;
255
+ const diffMs = Date.now() - date.getTime();
256
+ const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
257
+ if (diffDays <= 0) return "today";
258
+ if (diffDays === 1) return "yesterday";
259
+ if (diffDays < 7) return `${diffDays} days ago`;
260
+ if (diffDays < 30) {
261
+ const weeks = Math.floor(diffDays / 7);
262
+ return weeks === 1 ? "1 week ago" : `${weeks} weeks ago`;
263
+ }
264
+ if (diffDays < 365) {
265
+ const months = Math.floor(diffDays / 30);
266
+ return months === 1 ? "1 month ago" : `${months} months ago`;
267
+ }
268
+ const years = Math.floor(diffDays / 365);
269
+ return years === 1 ? "1 year ago" : `${years} years ago`;
270
+ }
271
+ //#endregion
272
+ //#region ../../contacts/ui/src/portal/components/contacts/rep-layout/ContactsSidebarRow.tsx
273
+ function ContactsSidebarRow({ contact, isSelected, onSelect }) {
274
+ const name = getDisplayName(contact);
275
+ const id = String(contact.id);
276
+ const secondary = contact.email ?? contact.status?.trim() ?? null;
277
+ return /* @__PURE__ */ jsxs("button", {
278
+ type: "button",
279
+ onClick: () => onSelect(id),
280
+ "aria-current": isSelected ? "true" : void 0,
281
+ className: cn("group flex w-full items-center gap-3.5 rounded-xl px-3 py-3 text-left transition-colors", isSelected ? "bg-muted" : "hover:bg-muted/60"),
282
+ children: [
283
+ /* @__PURE__ */ jsx("div", {
284
+ className: cn("text-muted-foreground relative flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-xl text-base font-semibold transition-colors", isSelected ? "bg-background" : "bg-muted"),
285
+ children: contact.avatar_url ? /* @__PURE__ */ jsx("img", {
286
+ alt: name,
287
+ src: contact.avatar_url,
288
+ className: "size-12 object-cover"
289
+ }) : /* @__PURE__ */ jsx("span", {
290
+ "aria-hidden": "true",
291
+ children: getInitials(name)
292
+ })
293
+ }),
294
+ /* @__PURE__ */ jsxs("div", {
295
+ className: "min-w-0 flex-1",
296
+ children: [/* @__PURE__ */ jsx("span", {
297
+ className: "text-foreground block truncate text-sm font-semibold tracking-tight",
298
+ children: name
299
+ }), secondary && /* @__PURE__ */ jsx("span", {
300
+ className: "text-muted-foreground mt-0.5 block truncate text-sm",
301
+ children: secondary
302
+ })]
303
+ }),
304
+ /* @__PURE__ */ jsx(ChevronRight, {
305
+ className: cn("size-4 shrink-0 transition-all", isSelected ? "text-foreground" : "text-muted-foreground/60 opacity-0 group-hover:translate-x-0.5 group-hover:opacity-100"),
306
+ "aria-hidden": "true"
307
+ })
308
+ ]
309
+ });
310
+ }
311
+ //#endregion
312
+ //#region ../../contacts/ui/src/portal/components/contacts/rep-layout/ContactsSidebar.tsx
313
+ const DEBOUNCE_MS = 200;
314
+ function useBuiltInFilters() {
315
+ const { t } = useContactsTranslation();
316
+ return useMemo(() => [
317
+ {
318
+ id: "all",
319
+ label: t("filter_all"),
320
+ value: { kind: "all" }
321
+ },
322
+ {
323
+ id: "status:lead",
324
+ label: t("filter_leads"),
325
+ value: {
326
+ kind: "status",
327
+ status: "lead"
328
+ }
329
+ },
330
+ {
331
+ id: "status:customer",
332
+ label: t("filter_customers"),
333
+ value: {
334
+ kind: "status",
335
+ status: "customer"
336
+ }
337
+ }
338
+ ], [t]);
339
+ }
340
+ function filterId(value) {
341
+ if (value.kind === "all") return "all";
342
+ if (value.kind === "status") return `status:${value.status}`;
343
+ return `group:${value.tag}`;
344
+ }
345
+ function ContactsSidebar({ selectedContactId, onSelect, onAdd }) {
346
+ const { t } = useContactsTranslation();
347
+ const builtInFilters = useBuiltInFilters();
348
+ const [searchInput, setSearchInput] = useState("");
349
+ const [debouncedSearch, setDebouncedSearch] = useState("");
350
+ const [filter, setFilter] = useState({ kind: "all" });
351
+ useEffect(() => {
352
+ const handle = window.setTimeout(() => {
353
+ setDebouncedSearch(searchInput.trim());
354
+ }, DEBOUNCE_MS);
355
+ return () => window.clearTimeout(handle);
356
+ }, [searchInput]);
357
+ const { data: groups = [] } = useGroups();
358
+ const { data, isLoading, isFetchingNextPage, hasNextPage, fetchNextPage, isError } = useInfiniteContacts(useMemo(() => ({
359
+ search_query: debouncedSearch || void 0,
360
+ tags: filter.kind === "group" ? [filter.tag] : void 0,
361
+ sort_by: "full_name",
362
+ sort_direction: "asc",
363
+ per_page: 50
364
+ }), [debouncedSearch, filter]));
365
+ const contacts = useMemo(() => data?.pages.flatMap((page) => page.contacts ?? []) ?? [], [data]);
366
+ const visibleContacts = useMemo(() => {
367
+ if (filter.kind === "status") return contacts.filter((c) => c.status === filter.status);
368
+ return contacts;
369
+ }, [contacts, filter]);
370
+ const sentinelRef = useRef(null);
371
+ const hasAutoSelectedRef = useRef(false);
372
+ useEffect(() => {
373
+ if (hasAutoSelectedRef.current) return;
374
+ if (selectedContactId) {
375
+ hasAutoSelectedRef.current = true;
376
+ return;
377
+ }
378
+ if (isLoading || visibleContacts.length === 0) return;
379
+ if (!(typeof window === "undefined" || window.matchMedia("(min-width: 768px)").matches)) {
380
+ hasAutoSelectedRef.current = true;
381
+ return;
382
+ }
383
+ const first = visibleContacts[0];
384
+ if (first) {
385
+ hasAutoSelectedRef.current = true;
386
+ onSelect(String(first.id));
387
+ }
388
+ }, [
389
+ selectedContactId,
390
+ isLoading,
391
+ visibleContacts,
392
+ onSelect
393
+ ]);
394
+ useEffect(() => {
395
+ const sentinel = sentinelRef.current;
396
+ if (!sentinel || !hasNextPage) return;
397
+ const observer = new IntersectionObserver((entries) => {
398
+ if (entries[0]?.isIntersecting && !isFetchingNextPage) fetchNextPage();
399
+ });
400
+ observer.observe(sentinel);
401
+ return () => observer.disconnect();
402
+ }, [
403
+ hasNextPage,
404
+ isFetchingNextPage,
405
+ fetchNextPage
406
+ ]);
407
+ const activeFilterId = filterId(filter);
408
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
409
+ /* @__PURE__ */ jsx("div", {
410
+ className: "border-border/50 border-b px-6 py-3",
411
+ children: /* @__PURE__ */ jsxs("div", {
412
+ className: "flex items-center gap-3",
413
+ children: [/* @__PURE__ */ jsxs("div", {
414
+ className: "bg-muted focus-within:ring-foreground/20 flex min-w-0 flex-1 items-center gap-2 rounded-lg px-3 py-1.5 transition focus-within:ring-2",
415
+ children: [/* @__PURE__ */ jsx(Search, {
416
+ className: "text-muted-foreground size-3.5 shrink-0",
417
+ "aria-hidden": "true"
418
+ }), /* @__PURE__ */ jsx(Input, {
419
+ value: searchInput,
420
+ onChange: (e) => setSearchInput(e.target.value),
421
+ placeholder: t("search_placeholder"),
422
+ type: "search",
423
+ className: "placeholder:text-muted-foreground/80 h-auto flex-1 border-0 bg-transparent p-0 text-xs font-medium shadow-none focus-visible:ring-0",
424
+ "aria-label": t("search_placeholder")
425
+ })]
426
+ }), /* @__PURE__ */ jsxs("button", {
427
+ type: "button",
428
+ onClick: onAdd,
429
+ className: "bg-primary text-primary-foreground hover:bg-primary/90 inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-semibold transition-colors",
430
+ children: [/* @__PURE__ */ jsx(Plus, {
431
+ className: "size-3.5",
432
+ "aria-hidden": "true"
433
+ }), t("add")]
434
+ })]
435
+ })
436
+ }),
437
+ /* @__PURE__ */ jsx(FilterPills, {
438
+ activeId: activeFilterId,
439
+ builtInFilters,
440
+ groups: groups.map((g) => g.name),
441
+ onChange: setFilter
442
+ }),
443
+ /* @__PURE__ */ jsx("div", {
444
+ className: "flex-1 overflow-y-auto px-3 pb-8",
445
+ children: isError ? /* @__PURE__ */ jsx("div", {
446
+ className: "text-muted-foreground px-4 py-8 text-center text-sm",
447
+ children: t("error_loading_list")
448
+ }) : isLoading ? /* @__PURE__ */ jsx(SidebarSkeleton, {}) : visibleContacts.length === 0 ? /* @__PURE__ */ jsxs("div", {
449
+ className: "space-y-2",
450
+ children: [hasNextPage || isFetchingNextPage ? /* @__PURE__ */ jsx("div", {
451
+ className: "text-muted-foreground px-4 py-8 text-center text-sm",
452
+ children: t("searching")
453
+ }) : /* @__PURE__ */ jsx("div", {
454
+ className: "text-muted-foreground px-4 py-8 text-center text-sm",
455
+ children: debouncedSearch ? t("no_contacts_search", { term: debouncedSearch }) : filter.kind === "all" ? t("no_contacts_yet") : t("no_contacts_filter")
456
+ }), hasNextPage && /* @__PURE__ */ jsx("div", {
457
+ ref: sentinelRef,
458
+ "aria-hidden": "true",
459
+ className: "h-4"
460
+ })]
461
+ }) : /* @__PURE__ */ jsxs("div", {
462
+ className: "space-y-1",
463
+ children: [
464
+ visibleContacts.map((contact) => /* @__PURE__ */ jsx(ContactsSidebarRow, {
465
+ contact,
466
+ isSelected: String(contact.id) === selectedContactId,
467
+ onSelect
468
+ }, contact.id)),
469
+ /* @__PURE__ */ jsx("div", {
470
+ ref: sentinelRef,
471
+ "aria-hidden": "true",
472
+ className: "h-4"
473
+ }),
474
+ isFetchingNextPage && /* @__PURE__ */ jsx("div", {
475
+ className: "text-muted-foreground py-3 text-center text-xs",
476
+ children: t("loading_more")
477
+ })
478
+ ]
479
+ })
480
+ })
481
+ ] });
482
+ }
483
+ function FilterPills({ activeId, builtInFilters, groups, onChange }) {
484
+ return /* @__PURE__ */ jsx("div", {
485
+ className: "overflow-x-auto pt-4 pb-4 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
486
+ children: /* @__PURE__ */ jsx("div", {
487
+ className: "flex gap-1.5 px-6",
488
+ children: useMemo(() => [...builtInFilters, ...groups.map((tag) => ({
489
+ id: `group:${tag}`,
490
+ label: tag,
491
+ value: {
492
+ kind: "group",
493
+ tag
494
+ }
495
+ }))], [builtInFilters, groups]).map(({ id, label, value }) => {
496
+ const isActive = id === activeId;
497
+ return /* @__PURE__ */ jsx("button", {
498
+ type: "button",
499
+ onClick: () => onChange(value),
500
+ "aria-pressed": isActive,
501
+ className: cn("shrink-0 rounded-full px-4 py-1.5 text-sm font-semibold capitalize transition-colors", isActive ? "bg-primary text-primary-foreground" : "border-border/50 bg-muted text-foreground hover:bg-muted/70 border"),
502
+ children: label
503
+ }, id);
504
+ })
505
+ })
506
+ });
507
+ }
508
+ function SidebarSkeleton() {
509
+ return /* @__PURE__ */ jsx("div", {
510
+ className: "space-y-1.5 px-1",
511
+ children: [
512
+ 0,
513
+ 1,
514
+ 2,
515
+ 3,
516
+ 4
517
+ ].map((i) => /* @__PURE__ */ jsxs("div", {
518
+ className: "flex items-center gap-3 rounded-xl px-3 py-3",
519
+ "aria-hidden": "true",
520
+ children: [/* @__PURE__ */ jsx("div", { className: "bg-muted size-12 shrink-0 animate-pulse rounded-xl" }), /* @__PURE__ */ jsxs("div", {
521
+ className: "flex-1 space-y-2",
522
+ children: [/* @__PURE__ */ jsx("div", { className: "bg-muted h-3.5 w-3/5 animate-pulse rounded" }), /* @__PURE__ */ jsx("div", { className: "bg-muted h-3 w-4/5 animate-pulse rounded" })]
523
+ })]
524
+ }, i))
525
+ });
526
+ }
527
+ //#endregion
528
+ //#region ../../contacts/ui/src/shared/components/contacts/contactDetailsForm.tsx
529
+ const DEFAULT_COUNTRIES = [];
530
+ const statusOptions = [
531
+ {
532
+ name: "New",
533
+ value: "new"
534
+ },
535
+ {
536
+ name: "Active",
537
+ value: "active"
538
+ },
539
+ {
540
+ name: "Inactive",
541
+ value: "inactive"
542
+ },
543
+ {
544
+ name: "Cold",
545
+ value: "cold"
546
+ },
547
+ {
548
+ name: "Lead",
549
+ value: "lead"
550
+ },
551
+ {
552
+ name: "Customer",
553
+ value: "customer"
554
+ }
555
+ ];
556
+ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAvatarPicker }) => {
557
+ const { control, watch, setValue } = useFormContext();
558
+ const currentStatus = useWatch({
559
+ control,
560
+ name: "status"
561
+ });
562
+ const avatarUrl = watch("avatar_url") ?? null;
563
+ const effectiveStatusOptions = useMemo(() => {
564
+ if (currentStatus && typeof currentStatus === "string" && !statusOptions.some((o) => o.value === currentStatus)) return [{
565
+ name: currentStatus.charAt(0).toUpperCase() + currentStatus.slice(1).replace(/_/g, " "),
566
+ value: currentStatus
567
+ }, ...statusOptions];
568
+ return statusOptions;
569
+ }, [currentStatus]);
570
+ const initials = [watch("first_name")?.[0] ?? "", watch("last_name")?.[0] ?? ""].filter(Boolean).join("").toUpperCase() || "?";
571
+ return /* @__PURE__ */ jsxs("div", {
572
+ className: cn("space-y-6", className),
573
+ children: [renderAvatarPicker && /* @__PURE__ */ jsxs("div", {
574
+ className: "flex flex-col items-center gap-3",
575
+ children: [/* @__PURE__ */ jsx("div", {
576
+ className: "border-border bg-background relative h-20 w-20 shrink-0 overflow-hidden rounded-full border-2",
577
+ children: avatarUrl ? /* @__PURE__ */ jsx("img", {
578
+ src: avatarUrl,
579
+ alt: "",
580
+ className: "h-full w-full object-cover"
581
+ }) : /* @__PURE__ */ jsx("div", {
582
+ className: "text-muted-foreground flex h-full w-full items-center justify-center text-lg font-semibold",
583
+ children: initials
584
+ })
585
+ }), renderAvatarPicker({
586
+ value: avatarUrl,
587
+ onChange: (url) => setValue("avatar_url", url ?? "", { shouldDirty: true })
588
+ })]
589
+ }), /* @__PURE__ */ jsxs("div", {
590
+ className: "grid grid-cols-1 gap-6 lg:grid-cols-2",
591
+ children: [
592
+ /* @__PURE__ */ jsx(FormField, {
593
+ control,
594
+ name: "first_name",
595
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
596
+ /* @__PURE__ */ jsx(FormLabel, {
597
+ className: "font-inter text-foreground font-medium",
598
+ children: "First Name"
599
+ }),
600
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
601
+ placeholder: "Enter first name",
602
+ ...field,
603
+ value: field.value ?? "",
604
+ className: "ring-input"
605
+ }) }),
606
+ /* @__PURE__ */ jsx(FormMessage, {})
607
+ ] })
608
+ }),
609
+ /* @__PURE__ */ jsx(FormField, {
610
+ control,
611
+ name: "last_name",
612
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
613
+ /* @__PURE__ */ jsx(FormLabel, {
614
+ className: "font-inter text-foreground font-medium",
615
+ children: "Last Name"
616
+ }),
617
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
618
+ placeholder: "Enter last name",
619
+ ...field,
620
+ value: field.value ?? "",
621
+ className: "ring-input"
622
+ }) }),
623
+ /* @__PURE__ */ jsx(FormMessage, {})
624
+ ] })
625
+ }),
626
+ /* @__PURE__ */ jsx(FormField, {
627
+ control,
628
+ name: "email",
629
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
630
+ /* @__PURE__ */ jsx(FormLabel, {
631
+ className: "font-inter text-foreground font-medium",
632
+ children: "Email"
633
+ }),
634
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
635
+ placeholder: "Enter email address",
636
+ type: "email",
637
+ ...field,
638
+ value: field.value ?? "",
639
+ className: "ring-input"
640
+ }) }),
641
+ /* @__PURE__ */ jsx(FormMessage, {})
642
+ ] })
643
+ }),
644
+ /* @__PURE__ */ jsx(FormField, {
645
+ control,
646
+ name: "phone",
647
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
648
+ /* @__PURE__ */ jsx(FormLabel, {
649
+ className: "font-inter text-foreground font-medium",
650
+ children: "Phone"
651
+ }),
652
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
653
+ placeholder: "Enter phone number",
654
+ ...field,
655
+ value: field.value ?? "",
656
+ className: "ring-input"
657
+ }) }),
658
+ /* @__PURE__ */ jsx(FormMessage, {})
659
+ ] })
660
+ }),
661
+ /* @__PURE__ */ jsx(FormField, {
662
+ control,
663
+ name: "status",
664
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
665
+ /* @__PURE__ */ jsx(FormLabel, {
666
+ className: "font-inter text-foreground font-medium",
667
+ children: "Status"
668
+ }),
669
+ /* @__PURE__ */ jsxs(Select, {
670
+ value: field.value ?? "",
671
+ onValueChange: field.onChange,
672
+ children: [/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, {
673
+ className: "w-full",
674
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select status" })
675
+ }) }), /* @__PURE__ */ jsx(SelectContent, {
676
+ position: "popper",
677
+ sideOffset: 4,
678
+ children: effectiveStatusOptions.map((opt) => /* @__PURE__ */ jsx(SelectItem, {
679
+ value: opt.value,
680
+ children: opt.name
681
+ }, opt.value))
682
+ })]
683
+ }),
684
+ /* @__PURE__ */ jsx(FormMessage, {})
685
+ ] })
686
+ }),
687
+ /* @__PURE__ */ jsx(FormField, {
688
+ control,
689
+ name: "address",
690
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, {
691
+ className: "lg:col-span-2",
692
+ children: [
693
+ /* @__PURE__ */ jsx(FormLabel, {
694
+ className: "font-inter text-foreground font-medium",
695
+ children: "Full Address"
696
+ }),
697
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
698
+ placeholder: "Enter street address",
699
+ ...field,
700
+ value: field.value ?? "",
701
+ className: "ring-input"
702
+ }) }),
703
+ /* @__PURE__ */ jsx(FormMessage, {})
704
+ ]
705
+ })
706
+ }),
707
+ /* @__PURE__ */ jsx(FormField, {
708
+ control,
709
+ name: "city",
710
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
711
+ /* @__PURE__ */ jsx(FormLabel, {
712
+ className: "font-inter text-foreground font-medium",
713
+ children: "City"
714
+ }),
715
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
716
+ placeholder: "Enter city",
717
+ ...field,
718
+ value: field.value ?? "",
719
+ className: "ring-input"
720
+ }) }),
721
+ /* @__PURE__ */ jsx(FormMessage, {})
722
+ ] })
723
+ }),
724
+ /* @__PURE__ */ jsx(FormField, {
725
+ control,
726
+ name: "state",
727
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
728
+ /* @__PURE__ */ jsx(FormLabel, {
729
+ className: "font-inter text-foreground font-medium",
730
+ children: "State/Province"
731
+ }),
732
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
733
+ placeholder: "Enter state or province",
734
+ ...field,
735
+ value: field.value ?? "",
736
+ className: "ring-input"
737
+ }) }),
738
+ /* @__PURE__ */ jsx(FormMessage, {})
739
+ ] })
740
+ }),
741
+ /* @__PURE__ */ jsx(FormField, {
742
+ control,
743
+ name: "postal_code",
744
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
745
+ /* @__PURE__ */ jsx(FormLabel, {
746
+ className: "font-inter text-foreground font-medium",
747
+ children: "Postal Code"
748
+ }),
749
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
750
+ placeholder: "Enter postal code",
751
+ ...field,
752
+ value: field.value ?? "",
753
+ className: "ring-input"
754
+ }) }),
755
+ /* @__PURE__ */ jsx(FormMessage, {})
756
+ ] })
757
+ }),
758
+ /* @__PURE__ */ jsx(FormField, {
759
+ control,
760
+ name: "country_code",
761
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
762
+ /* @__PURE__ */ jsx(FormLabel, {
763
+ className: "font-inter text-foreground font-medium",
764
+ children: "Country"
765
+ }),
766
+ /* @__PURE__ */ jsxs(Select, {
767
+ value: field.value ?? "",
768
+ onValueChange: field.onChange,
769
+ children: [/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, {
770
+ className: "w-full",
771
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select country" })
772
+ }) }), /* @__PURE__ */ jsx(SelectContent, {
773
+ position: "popper",
774
+ sideOffset: 4,
775
+ children: countries.map((opt) => /* @__PURE__ */ jsx(SelectItem, {
776
+ value: opt.value,
777
+ children: opt.name
778
+ }, opt.value))
779
+ })]
780
+ }),
781
+ /* @__PURE__ */ jsx(FormMessage, {})
782
+ ] })
783
+ })
784
+ ]
785
+ })]
786
+ });
787
+ };
788
+ //#endregion
789
+ //#region ../../contacts/ui/src/shared/hooks/useContactDetail.ts
790
+ function useContactDetail(contactId, queryKeyPrefix = "contacts") {
791
+ const api = useContactsCrud();
792
+ return useQuery({
793
+ queryKey: CONTACTS_QUERY_KEYS.detail(queryKeyPrefix, contactId),
794
+ queryFn: () => api.getContact(contactId),
795
+ enabled: !!contactId
796
+ });
797
+ }
798
+ //#endregion
799
+ //#region ../../contacts/ui/src/shared/hooks/useUpdateContactMutation.ts
800
+ function useUpdateContactMutation(contactId, queryKeyPrefix = "contacts", options) {
801
+ const queryClient = useQueryClient();
802
+ const api = useContactsCrud();
803
+ return useMutation({
804
+ mutationFn: ({ id, data }) => api.updateContact(id, data),
805
+ onSuccess: () => {
806
+ fluidToast({
807
+ title: "Contact updated successfully",
808
+ type: "success"
809
+ });
810
+ queryClient.invalidateQueries({ queryKey: CONTACTS_QUERY_KEYS.all(queryKeyPrefix) });
811
+ options?.onSuccess?.();
812
+ },
813
+ onError: (error) => {
814
+ fluidToast({
815
+ title: "Failed to save contact",
816
+ type: "error",
817
+ description: parseApiErrors(error)
818
+ });
819
+ options?.onError?.(error);
820
+ }
821
+ });
822
+ }
823
+ //#endregion
824
+ //#region ../../contacts/ui/src/shared/hooks/useDeleteContactMutation.ts
825
+ function useDeleteContactMutation(queryKeyPrefix = "contacts", options) {
826
+ const queryClient = useQueryClient();
827
+ const api = useContactsCrud();
828
+ return useMutation({
829
+ mutationFn: (contactId) => api.deleteContact(contactId),
830
+ onSuccess: () => {
831
+ fluidToast({
832
+ title: "Contact deleted successfully",
833
+ type: "success"
834
+ });
835
+ queryClient.invalidateQueries({ queryKey: CONTACTS_QUERY_KEYS.all(queryKeyPrefix) });
836
+ options?.onSuccess?.();
837
+ },
838
+ onError: (error) => {
839
+ fluidToast({
840
+ title: "Failed to delete contact",
841
+ type: "error",
842
+ description: parseApiErrors(error)
843
+ });
844
+ options?.onError?.(error);
845
+ }
846
+ });
847
+ }
848
+ //#endregion
849
+ //#region ../../contacts/ui/src/shared/schemas/contactFormSchema.ts
850
+ /**
851
+ * Form schema for creating a contact.
852
+ * Matches CompanyContactCreate / ContactCreate from the OpenAPI spec.
853
+ *
854
+ * @see CompanyContactCreate in company_contacts.d.ts
855
+ * @see ContactCreate in users_contacts.d.ts
856
+ */
857
+ const createContactFormSchema = z.object({
858
+ first_name: z.string().min(1, { message: "First name is required" }),
859
+ last_name: z.string().min(1, { message: "Last name is required" }),
860
+ status: z.string().nullable().optional(),
861
+ email: z.string().email().or(z.literal("")).nullable().optional(),
862
+ phone: z.string().nullable().optional(),
863
+ address: z.string().nullable().optional(),
864
+ city: z.string().nullable().optional(),
865
+ state: z.string().nullable().optional(),
866
+ postal_code: z.string().nullable().optional(),
867
+ country_code: z.coerce.string().nullable().optional(),
868
+ language_code: z.coerce.string().nullable().optional(),
869
+ affiliate: z.record(z.string(), z.unknown()).nullable().optional(),
870
+ metadata: z.record(z.string(), z.unknown()).optional()
871
+ });
872
+ /**
873
+ * Form schema for editing a contact.
874
+ * Same fields as create plus id. Uses .passthrough() so extra fields
875
+ * from the Contact read model (full_name, avatar_url, etc.) don't
876
+ * cause validation failures.
877
+ *
878
+ * @see CompanyContactUpdate in company_contacts.d.ts
879
+ */
880
+ const editContactFormSchema = createContactFormSchema.passthrough();
881
+ //#endregion
882
+ //#region ../../contacts/ui/src/shared/hooks/useContactDetailPage.ts
883
+ const mutableKeys = Object.keys(createContactFormSchema.shape);
884
+ function useContactDetailPage(contactId, options) {
885
+ const queryKeyPrefix = options?.queryKeyPrefix ?? "contacts";
886
+ const { data, isLoading } = useContactDetail(contactId, queryKeyPrefix);
887
+ const { data: countries } = useQuery({
888
+ queryKey: ["countries"],
889
+ queryFn: options?.getCountries ?? (() => Promise.resolve([])),
890
+ enabled: !!options?.getCountries
891
+ });
892
+ const countryOptions = useMemo(() => [...countries?.map((c) => ({
893
+ name: c.name,
894
+ value: c.iso ?? c.id.toString()
895
+ })) ?? []].sort((a, b) => a.name.localeCompare(b.name)), [countries]);
896
+ const contact = data?.contact;
897
+ const methods = useZodForm(editContactFormSchema, {
898
+ values: useMemo(() => {
899
+ if (!contact) return void 0;
900
+ return {
901
+ ...contact,
902
+ country_code: contact.country?.iso ?? contact.country_id?.toString() ?? null
903
+ };
904
+ }, [contact]),
905
+ mode: "onBlur"
906
+ });
907
+ const updateMutation = useUpdateContactMutation(contactId, queryKeyPrefix, { onSuccess: () => {
908
+ methods.reset(methods.getValues());
909
+ options?.onSaveSuccess?.();
910
+ } });
911
+ const deleteMutation = useDeleteContactMutation(queryKeyPrefix, { onSuccess: () => {
912
+ options?.onDeleteSuccess?.();
913
+ } });
914
+ const onSave = useCallback(() => {
915
+ methods.handleSubmit((formData) => {
916
+ const payload = {};
917
+ for (const key of mutableKeys) if (key in formData) payload[key] = formData[key];
918
+ updateMutation.mutate({
919
+ id: contactId,
920
+ data: payload
921
+ });
922
+ }, (errors) => {
923
+ fluidToast({
924
+ title: "Please fix the form errors before saving",
925
+ description: Object.entries(errors).map(([field, err]) => {
926
+ const msg = typeof err?.message === "string" ? err.message : "invalid";
927
+ return `${field.replace(/_/g, " ")}: ${msg}`;
928
+ }).join(", ") || void 0,
929
+ type: "error"
930
+ });
931
+ })();
932
+ }, [
933
+ methods,
934
+ updateMutation,
935
+ contactId
936
+ ]);
937
+ const onDelete = useCallback(() => {
938
+ deleteMutation.mutate(contactId);
939
+ }, [deleteMutation, contactId]);
940
+ return {
941
+ contact,
942
+ isLoading,
943
+ methods,
944
+ countryOptions,
945
+ isDirty: methods.formState.isDirty,
946
+ isSubmitting: updateMutation.isPending,
947
+ isDeleting: deleteMutation.isPending,
948
+ onSave,
949
+ onDelete
950
+ };
951
+ }
952
+ //#endregion
953
+ //#region ../../contacts/ui/src/portal/hooks/contacts/use-contact-tasks.ts
954
+ function useContactTasks(contactId) {
955
+ const api = useTasksApi();
956
+ return useQuery({
957
+ queryKey: contactsKeys.tasks(contactId),
958
+ queryFn: () => api.listTasks(contactId),
959
+ enabled: !!contactId,
960
+ select: (data) => data.tasks
961
+ });
962
+ }
963
+ //#endregion
964
+ //#region ../../contacts/ui/src/portal/hooks/notes/use-contact-notes.ts
965
+ function useContactNotes(contactId) {
966
+ const api = useNotesApi();
967
+ return useQuery({
968
+ queryKey: contactsKeys.notes(contactId),
969
+ queryFn: () => api.listNotes(contactId),
970
+ enabled: !!contactId,
971
+ select: (data) => data.notes
972
+ });
973
+ }
974
+ //#endregion
975
+ //#region ../../contacts/ui/src/shared/components/contacts/statusBadge.tsx
976
+ const statusStyles = {
977
+ new: "border-[var(--status-new-border)] bg-[var(--status-new)] text-[var(--status-new-foreground)]",
978
+ active: "border-[var(--status-active-border)] bg-[var(--status-active)] text-[var(--status-active-foreground)]",
979
+ inactive: "border-border bg-muted text-muted-foreground",
980
+ lead: "border-[var(--status-lead-border)] bg-[var(--status-lead)] text-[var(--status-lead-foreground)]",
981
+ customer: "border-[var(--status-customer-border)] bg-[var(--status-customer)] text-[var(--status-customer-foreground)]",
982
+ success: "border-[var(--badge-success-border)] bg-[var(--badge-success)] text-[var(--badge-success-foreground)]",
983
+ warning: "border-[var(--badge-warning-border)] bg-[var(--badge-warning)] text-[var(--badge-warning-foreground)]",
984
+ danger: "border-[var(--badge-danger-border)] bg-[var(--badge-danger)] text-[var(--badge-danger-foreground)]",
985
+ info: "border-[var(--badge-info-border)] bg-[var(--badge-info)] text-[var(--badge-info-foreground)]",
986
+ neutral: "border-border bg-muted text-muted-foreground",
987
+ notice: "border-[var(--badge-notice-border)] bg-[var(--badge-notice)] text-[var(--badge-notice-foreground)]",
988
+ accent: "border-[var(--badge-accent-border)] bg-[var(--badge-accent)] text-[var(--badge-accent-foreground)]"
989
+ };
990
+ const defaultStyle = "border-border bg-muted text-muted-foreground";
991
+ function getStatusStyle(status) {
992
+ return statusStyles[status] ?? defaultStyle;
993
+ }
994
+ function StatusBadge({ status, label, className }) {
995
+ return /* @__PURE__ */ jsx("span", {
996
+ className: cn("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold capitalize", getStatusStyle(status), className),
997
+ children: label ?? status
998
+ });
999
+ }
1000
+ //#endregion
1001
+ //#region ../../contacts/ui/src/portal/components/contacts/rep-layout/ContactDetailHero.tsx
1002
+ function ContactDetailHero({ contact, tasksCount, notesCount }) {
1003
+ const { t } = useContactsTranslation();
1004
+ const name = getDisplayName(contact);
1005
+ const status = contact.status?.trim();
1006
+ const lastUpdated = getRelativeUpdated(contact);
1007
+ return /* @__PURE__ */ jsxs("div", {
1008
+ className: "flex flex-col gap-6 md:flex-row md:items-center md:justify-between md:gap-8",
1009
+ children: [/* @__PURE__ */ jsxs("div", {
1010
+ className: "flex flex-col items-start gap-4 md:flex-row md:items-center md:gap-5",
1011
+ children: [/* @__PURE__ */ jsx("div", {
1012
+ className: "bg-muted relative flex size-20 shrink-0 items-center justify-center overflow-hidden rounded-2xl md:size-24",
1013
+ children: contact.avatar_url ? /* @__PURE__ */ jsx("img", {
1014
+ alt: name,
1015
+ src: contact.avatar_url,
1016
+ className: "size-full object-cover"
1017
+ }) : /* @__PURE__ */ jsx("span", {
1018
+ "aria-hidden": "true",
1019
+ className: "text-muted-foreground text-2xl font-bold tracking-tight md:text-3xl",
1020
+ children: getInitials(name)
1021
+ })
1022
+ }), /* @__PURE__ */ jsxs("div", {
1023
+ className: "min-w-0 flex-1",
1024
+ children: [/* @__PURE__ */ jsx("h2", {
1025
+ className: "text-foreground text-2xl leading-tight font-bold tracking-tight md:text-3xl",
1026
+ children: name
1027
+ }), /* @__PURE__ */ jsxs("div", {
1028
+ className: "mt-2.5 flex flex-wrap items-center gap-2",
1029
+ children: [
1030
+ status && /* @__PURE__ */ jsx(StatusBadge, { status }),
1031
+ status && lastUpdated && /* @__PURE__ */ jsx("span", {
1032
+ "aria-hidden": "true",
1033
+ className: "text-muted-foreground/40 text-sm",
1034
+ children: "·"
1035
+ }),
1036
+ lastUpdated && /* @__PURE__ */ jsx("span", {
1037
+ className: "text-muted-foreground text-sm",
1038
+ children: t("last_updated", { date: lastUpdated })
1039
+ })
1040
+ ]
1041
+ })]
1042
+ })]
1043
+ }), /* @__PURE__ */ jsxs("div", {
1044
+ className: "flex shrink-0 items-center gap-6 md:gap-8",
1045
+ children: [
1046
+ /* @__PURE__ */ jsx(Stat, {
1047
+ label: t("tab_tasks"),
1048
+ value: tasksCount,
1049
+ icon: ListTodo
1050
+ }),
1051
+ /* @__PURE__ */ jsx("div", {
1052
+ className: "bg-border h-10 w-px",
1053
+ "aria-hidden": "true"
1054
+ }),
1055
+ /* @__PURE__ */ jsx(Stat, {
1056
+ label: t("tab_notes"),
1057
+ value: notesCount,
1058
+ icon: StickyNote
1059
+ })
1060
+ ]
1061
+ })]
1062
+ });
1063
+ }
1064
+ function Stat({ label, value, icon: Icon }) {
1065
+ return /* @__PURE__ */ jsxs("div", {
1066
+ className: "flex flex-col items-start gap-1",
1067
+ children: [/* @__PURE__ */ jsxs("div", {
1068
+ className: "text-muted-foreground flex items-center gap-1.5",
1069
+ children: [/* @__PURE__ */ jsx(Icon, {
1070
+ className: "size-3.5",
1071
+ "aria-hidden": true
1072
+ }), /* @__PURE__ */ jsx("span", {
1073
+ className: "text-xs font-medium",
1074
+ children: label
1075
+ })]
1076
+ }), /* @__PURE__ */ jsx("span", {
1077
+ className: "text-foreground text-2xl font-bold tracking-tight tabular-nums",
1078
+ children: value
1079
+ })]
1080
+ });
1081
+ }
1082
+ //#endregion
1083
+ //#region ../../contacts/ui/src/portal/components/contacts/rep-layout/ContactInfoRow.tsx
1084
+ function buildAddressLine(contact) {
1085
+ const parts = [
1086
+ contact.address,
1087
+ contact.city,
1088
+ contact.state,
1089
+ contact.postal_code
1090
+ ].filter((part) => Boolean(part?.trim()));
1091
+ if (parts.length === 0) return null;
1092
+ return parts.join(", ");
1093
+ }
1094
+ function ContactInfoRow({ contact, onEditEmpty }) {
1095
+ const { t } = useContactsTranslation();
1096
+ const address = buildAddressLine(contact);
1097
+ return /* @__PURE__ */ jsxs("div", {
1098
+ className: "border-border/50 divide-border/50 mt-6 divide-y overflow-hidden rounded-2xl border",
1099
+ children: [
1100
+ /* @__PURE__ */ jsx(InfoRow, {
1101
+ icon: Mail,
1102
+ label: t("label_email"),
1103
+ value: contact.email,
1104
+ href: contact.email ? `mailto:${contact.email}` : void 0,
1105
+ onEditEmpty
1106
+ }),
1107
+ /* @__PURE__ */ jsx(InfoRow, {
1108
+ icon: Phone,
1109
+ label: t("label_phone"),
1110
+ value: contact.phone,
1111
+ href: contact.phone ? `tel:${contact.phone}` : void 0,
1112
+ onEditEmpty
1113
+ }),
1114
+ /* @__PURE__ */ jsx(InfoRow, {
1115
+ icon: MapPin,
1116
+ label: t("label_address"),
1117
+ value: address,
1118
+ href: address ? `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(address)}` : void 0,
1119
+ external: true,
1120
+ onEditEmpty
1121
+ })
1122
+ ]
1123
+ });
1124
+ }
1125
+ function InfoRow({ icon: Icon, label, value, href, external = false, onEditEmpty }) {
1126
+ const { t } = useContactsTranslation();
1127
+ const trimmed = value?.trim();
1128
+ const isEmpty = !trimmed;
1129
+ const [copied, setCopied] = useState(false);
1130
+ const handleCopy = () => {
1131
+ if (!trimmed) return;
1132
+ if (typeof navigator === "undefined" || !navigator.clipboard) return;
1133
+ navigator.clipboard.writeText(trimmed).then(() => {
1134
+ setCopied(true);
1135
+ window.setTimeout(() => setCopied(false), 1500);
1136
+ }).catch(() => {});
1137
+ };
1138
+ if (isEmpty) {
1139
+ const addText = t("add_field", { field: label });
1140
+ if (!onEditEmpty) return /* @__PURE__ */ jsxs("div", {
1141
+ className: "flex items-center gap-3 px-4 py-2.5 md:px-5",
1142
+ children: [
1143
+ /* @__PURE__ */ jsx("div", {
1144
+ className: "border-border/50 text-muted-foreground/50 flex size-9 shrink-0 items-center justify-center rounded-full border-2 border-dashed",
1145
+ children: /* @__PURE__ */ jsx(Icon, {
1146
+ className: "size-4",
1147
+ "aria-hidden": true
1148
+ })
1149
+ }),
1150
+ /* @__PURE__ */ jsxs("div", {
1151
+ className: "min-w-0 flex-1",
1152
+ children: [/* @__PURE__ */ jsx("div", {
1153
+ className: "text-muted-foreground text-xs font-medium",
1154
+ children: label
1155
+ }), /* @__PURE__ */ jsx("div", {
1156
+ className: "text-muted-foreground/70 truncate text-sm italic",
1157
+ children: addText
1158
+ })]
1159
+ }),
1160
+ /* @__PURE__ */ jsx(Plus, {
1161
+ className: "text-muted-foreground/40 size-4 shrink-0",
1162
+ "aria-hidden": true
1163
+ })
1164
+ ]
1165
+ });
1166
+ return /* @__PURE__ */ jsxs("button", {
1167
+ type: "button",
1168
+ onClick: onEditEmpty,
1169
+ "aria-label": addText,
1170
+ className: "hover:bg-muted/60 group flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors md:px-5",
1171
+ children: [
1172
+ /* @__PURE__ */ jsx("div", {
1173
+ className: "border-border/50 text-muted-foreground/50 group-hover:border-foreground/30 group-hover:text-muted-foreground flex size-9 shrink-0 items-center justify-center rounded-full border-2 border-dashed transition-colors",
1174
+ children: /* @__PURE__ */ jsx(Icon, {
1175
+ className: "size-4",
1176
+ "aria-hidden": true
1177
+ })
1178
+ }),
1179
+ /* @__PURE__ */ jsxs("div", {
1180
+ className: "min-w-0 flex-1",
1181
+ children: [/* @__PURE__ */ jsx("div", {
1182
+ className: "text-muted-foreground text-xs font-medium",
1183
+ children: label
1184
+ }), /* @__PURE__ */ jsx("div", {
1185
+ className: "text-muted-foreground/70 group-hover:text-muted-foreground truncate text-sm italic transition-colors",
1186
+ children: addText
1187
+ })]
1188
+ }),
1189
+ /* @__PURE__ */ jsx(Plus, {
1190
+ className: "text-muted-foreground/40 group-hover:text-foreground size-4 shrink-0 transition-colors",
1191
+ "aria-hidden": true
1192
+ })
1193
+ ]
1194
+ });
1195
+ }
1196
+ return /* @__PURE__ */ jsxs("div", {
1197
+ className: "hover:bg-muted/60 group flex items-center transition-colors",
1198
+ children: [/* @__PURE__ */ jsxs("a", {
1199
+ href,
1200
+ ...external ? {
1201
+ target: "_blank",
1202
+ rel: "noopener noreferrer"
1203
+ } : {},
1204
+ className: "flex min-w-0 flex-1 items-center gap-3 px-4 py-2.5 md:px-5",
1205
+ children: [/* @__PURE__ */ jsx("div", {
1206
+ className: "bg-muted text-muted-foreground group-hover:bg-muted/70 group-hover:text-foreground flex size-9 shrink-0 items-center justify-center rounded-full transition-colors",
1207
+ children: /* @__PURE__ */ jsx(Icon, {
1208
+ className: "size-4",
1209
+ "aria-hidden": true
1210
+ })
1211
+ }), /* @__PURE__ */ jsxs("div", {
1212
+ className: "min-w-0 flex-1",
1213
+ children: [/* @__PURE__ */ jsx("div", {
1214
+ className: "text-muted-foreground text-xs font-medium",
1215
+ children: label
1216
+ }), /* @__PURE__ */ jsx("div", {
1217
+ className: "text-foreground truncate text-sm font-semibold",
1218
+ children: trimmed
1219
+ })]
1220
+ })]
1221
+ }), /* @__PURE__ */ jsx("button", {
1222
+ type: "button",
1223
+ onClick: handleCopy,
1224
+ "aria-label": copied ? t("copied_field", { field: label }) : t("copy_field", { field: label }),
1225
+ className: "text-muted-foreground hover:bg-muted hover:text-foreground mr-3 flex size-8 shrink-0 items-center justify-center rounded-md transition-colors",
1226
+ children: copied ? /* @__PURE__ */ jsx(Check, {
1227
+ className: "text-primary size-3.5",
1228
+ "aria-hidden": true
1229
+ }) : /* @__PURE__ */ jsx(Copy, {
1230
+ className: "size-3.5",
1231
+ "aria-hidden": true
1232
+ })
1233
+ })]
1234
+ });
1235
+ }
1236
+ //#endregion
1237
+ //#region ../../contacts/core/src/iso-date.ts
1238
+ /**
1239
+ * Format a date as YYYY-MM-DD in the renderer's local timezone, optionally
1240
+ * shifted by `offsetDays`. Use this for due-date inputs where "today" must
1241
+ * resolve to the user's local calendar date — never `toISOString().slice(0, 10)`,
1242
+ * which returns the UTC date and silently rolls over a day for users east/west
1243
+ * of UTC at the wrong hours.
1244
+ */
1245
+ function isoDate(offsetDays, now = /* @__PURE__ */ new Date()) {
1246
+ const d = new Date(now);
1247
+ d.setDate(d.getDate() + offsetDays);
1248
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
1249
+ }
1250
+ /**
1251
+ * Return a Date pinned to local midnight of the calendar day represented by
1252
+ * `input`. Use this whenever you need to compare two due dates by calendar day
1253
+ * (overdue / today / tomorrow / future).
1254
+ *
1255
+ * Why not just `new Date(input)`? `new Date("YYYY-MM-DD")` parses the string
1256
+ * as UTC midnight, which lands on the *previous* calendar day in any UTC−
1257
+ * timezone — a task due "May 1" then reads as April 30 for a user in the
1258
+ * Americas, classifying it as "Overdue" all day. Parse the date components
1259
+ * directly so the calendar-day intent of the string is preserved.
1260
+ */
1261
+ function startOfLocalDay(input) {
1262
+ if (typeof input === "string") {
1263
+ const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(input);
1264
+ if (match?.[1] && match[2] && match[3]) return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
1265
+ }
1266
+ const d = typeof input === "string" ? new Date(input) : input;
1267
+ return new Date(d.getFullYear(), d.getMonth(), d.getDate());
1268
+ }
1269
+ //#endregion
1270
+ //#region ../../contacts/ui/src/portal/hooks/contacts/use-toggle-task-completion.ts
1271
+ function useToggleTaskCompletion(contactId) {
1272
+ const queryClient = useQueryClient();
1273
+ const api = useTasksApi();
1274
+ return useMutation({
1275
+ mutationFn: ({ taskId, isCompleted }) => api.updateTask(taskId, contactId, { completed_at: isCompleted ? null : (/* @__PURE__ */ new Date()).toISOString() }),
1276
+ onSuccess: () => {
1277
+ queryClient.invalidateQueries({ queryKey: contactsKeys.tasks(contactId) });
1278
+ },
1279
+ onError: (error) => {
1280
+ fluidToast({
1281
+ title: "Failed to update task",
1282
+ type: "error",
1283
+ description: parseApiErrors(error)
1284
+ });
1285
+ }
1286
+ });
1287
+ }
1288
+ //#endregion
1289
+ //#region ../../contacts/ui/src/portal/hooks/contacts/use-delete-contact-task.ts
1290
+ function useDeleteContactTask(contactId, options) {
1291
+ const queryClient = useQueryClient();
1292
+ const api = useTasksApi();
1293
+ return useMutation({
1294
+ mutationFn: (taskId) => api.deleteTask(taskId, contactId),
1295
+ onSuccess: () => {
1296
+ fluidToast({
1297
+ title: "Task deleted",
1298
+ type: "success"
1299
+ });
1300
+ queryClient.invalidateQueries({ queryKey: contactsKeys.tasks(contactId) });
1301
+ options?.onSuccess?.();
1302
+ },
1303
+ onError: (error) => {
1304
+ fluidToast({
1305
+ title: "Failed to delete task",
1306
+ type: "error",
1307
+ description: parseApiErrors(error)
1308
+ });
1309
+ }
1310
+ });
1311
+ }
1312
+ //#endregion
1313
+ //#region ../../contacts/ui/src/portal/hooks/contacts/use-update-contact-task.ts
1314
+ function useUpdateContactTask(contactId, options) {
1315
+ const queryClient = useQueryClient();
1316
+ const api = useTasksApi();
1317
+ return useMutation({
1318
+ mutationFn: ({ taskId, input }) => api.updateTask(taskId, contactId, input),
1319
+ onSuccess: () => {
1320
+ fluidToast({
1321
+ title: "Task updated",
1322
+ type: "success"
1323
+ });
1324
+ queryClient.invalidateQueries({ queryKey: contactsKeys.tasks(contactId) });
1325
+ options?.onSuccess?.();
1326
+ },
1327
+ onError: (error) => {
1328
+ fluidToast({
1329
+ title: "Failed to update task",
1330
+ type: "error",
1331
+ description: parseApiErrors(error)
1332
+ });
1333
+ }
1334
+ });
1335
+ }
1336
+ //#endregion
1337
+ //#region ../../contacts/ui/src/portal/utils/format-date.ts
1338
+ function formatDateForDisplay(dateStr) {
1339
+ return new Date(dateStr).toLocaleDateString("en-US", {
1340
+ month: "short",
1341
+ day: "numeric",
1342
+ year: "numeric"
1343
+ });
1344
+ }
1345
+ //#endregion
1346
+ //#region ../../contacts/ui/src/portal/components/editor/note-task-editor.tsx
1347
+ function extractTitleAndBody(editor) {
1348
+ if (!editor) return {
1349
+ title: "",
1350
+ body: ""
1351
+ };
1352
+ const doc = editor.state.doc;
1353
+ let title = "";
1354
+ const bodyParts = [];
1355
+ doc.forEach((node) => {
1356
+ if (node.type.name === "heading" && !title) title = node.textContent.trim();
1357
+ else {
1358
+ const text = node.textContent.trim();
1359
+ if (text) bodyParts.push(text);
1360
+ }
1361
+ });
1362
+ return {
1363
+ title,
1364
+ body: bodyParts.join("\n")
1365
+ };
1366
+ }
1367
+ function extractBodyOnly(editor) {
1368
+ if (!editor) return "";
1369
+ const parts = [];
1370
+ editor.state.doc.forEach((node) => {
1371
+ const text = node.textContent.trim();
1372
+ if (text) parts.push(text);
1373
+ });
1374
+ return parts.join("\n");
1375
+ }
1376
+ function NoteTaskEditor({ titlePlaceholder = "New Note", bodyPlaceholder = "Start writing...", onChange, className, initialTitle, initialBody, showDueDate = false, initialDueDate, showTitle = true, editorClassName }) {
1377
+ const [dueDate, setDueDate] = useState(initialDueDate);
1378
+ const dueDateRef = useRef(initialDueDate);
1379
+ const dateInputRef = useRef(null);
1380
+ useEffect(() => {
1381
+ dueDateRef.current = dueDate;
1382
+ }, [dueDate]);
1383
+ const initialContent = showTitle ? initialTitle || initialBody ? `<h1>${initialTitle ?? ""}</h1>${initialBody ?? ""}` : void 0 : initialBody || void 0;
1384
+ const editor = useEditor({
1385
+ extensions: [
1386
+ StarterKit.configure({
1387
+ heading: showTitle ? false : { levels: [] },
1388
+ bulletList: {
1389
+ keepMarks: true,
1390
+ keepAttributes: false
1391
+ },
1392
+ orderedList: {
1393
+ keepMarks: true,
1394
+ keepAttributes: false
1395
+ }
1396
+ }),
1397
+ ...showTitle ? [Heading.configure({ levels: [1] })] : [],
1398
+ Placeholder.configure({ placeholder: ({ node }) => {
1399
+ if (node.type.name === "heading") return titlePlaceholder;
1400
+ return bodyPlaceholder;
1401
+ } }),
1402
+ TextAlign.configure({
1403
+ types: showTitle ? ["heading", "paragraph"] : ["paragraph"],
1404
+ alignments: [
1405
+ "left",
1406
+ "center",
1407
+ "right",
1408
+ "justify"
1409
+ ]
1410
+ }),
1411
+ Underline
1412
+ ],
1413
+ content: initialContent ?? (showTitle ? {
1414
+ type: "doc",
1415
+ content: [{
1416
+ type: "heading",
1417
+ attrs: { level: 1 }
1418
+ }]
1419
+ } : void 0),
1420
+ onUpdate: ({ editor }) => {
1421
+ if (showTitle) {
1422
+ const { title, body } = extractTitleAndBody(editor);
1423
+ onChange?.({
1424
+ title,
1425
+ body,
1426
+ dueDate: dueDateRef.current
1427
+ });
1428
+ } else {
1429
+ const body = extractBodyOnly(editor);
1430
+ onChange?.({
1431
+ title: "",
1432
+ body,
1433
+ dueDate: dueDateRef.current
1434
+ });
1435
+ }
1436
+ }
1437
+ });
1438
+ const fireOnChange = () => {
1439
+ if (!editor || !onChange) return;
1440
+ if (showTitle) {
1441
+ const { title, body } = extractTitleAndBody(editor);
1442
+ onChange({
1443
+ title,
1444
+ body,
1445
+ dueDate
1446
+ });
1447
+ } else onChange({
1448
+ title: "",
1449
+ body: extractBodyOnly(editor),
1450
+ dueDate
1451
+ });
1452
+ };
1453
+ useEffect(() => {
1454
+ fireOnChange();
1455
+ }, [editor]);
1456
+ useEffect(() => {
1457
+ fireOnChange();
1458
+ }, [dueDate]);
1459
+ const buttonBase = "flex h-7 w-7 items-center justify-center rounded text-xs transition-colors";
1460
+ const buttonActive = "bg-muted text-primary";
1461
+ const buttonInactive = "text-muted-foreground hover:bg-muted/50";
1462
+ const toolbarSeparator = /* @__PURE__ */ jsx("div", { className: "bg-border mx-1 h-5 w-px" });
1463
+ return /* @__PURE__ */ jsxs("div", {
1464
+ className: cn("border-border/50 flex flex-col overflow-hidden rounded-lg border", className),
1465
+ children: [
1466
+ /* @__PURE__ */ jsxs("div", {
1467
+ className: "border-border/50 bg-muted/50 flex items-center gap-0.5 border-b px-2 py-1.5",
1468
+ children: [
1469
+ /* @__PURE__ */ jsx("button", {
1470
+ type: "button",
1471
+ onClick: () => editor?.chain().focus().toggleBold().run(),
1472
+ disabled: !editor?.can().chain().focus().toggleBold().run(),
1473
+ className: cn(buttonBase, "font-bold", editor?.isActive("bold") ? buttonActive : buttonInactive),
1474
+ title: "Bold",
1475
+ children: "B"
1476
+ }),
1477
+ /* @__PURE__ */ jsx("button", {
1478
+ type: "button",
1479
+ onClick: () => editor?.chain().focus().toggleItalic().run(),
1480
+ disabled: !editor?.can().chain().focus().toggleItalic().run(),
1481
+ className: cn(buttonBase, "italic", editor?.isActive("italic") ? buttonActive : buttonInactive),
1482
+ title: "Italic",
1483
+ children: "I"
1484
+ }),
1485
+ /* @__PURE__ */ jsx("button", {
1486
+ type: "button",
1487
+ onClick: () => editor?.chain().focus().toggleUnderline().run(),
1488
+ disabled: !editor?.can().chain().focus().toggleUnderline().run(),
1489
+ className: cn(buttonBase, "underline", editor?.isActive("underline") ? buttonActive : buttonInactive),
1490
+ title: "Underline",
1491
+ children: "U"
1492
+ }),
1493
+ toolbarSeparator,
1494
+ /* @__PURE__ */ jsx("button", {
1495
+ type: "button",
1496
+ onClick: () => editor?.chain().focus().setTextAlign("left").run(),
1497
+ className: cn(buttonBase, editor?.isActive({ textAlign: "left" }) ? buttonActive : buttonInactive),
1498
+ title: "Align left",
1499
+ children: /* @__PURE__ */ jsx(AlignLeft, { className: "h-3.5 w-3.5" })
1500
+ }),
1501
+ /* @__PURE__ */ jsx("button", {
1502
+ type: "button",
1503
+ onClick: () => editor?.chain().focus().setTextAlign("center").run(),
1504
+ className: cn(buttonBase, editor?.isActive({ textAlign: "center" }) ? buttonActive : buttonInactive),
1505
+ title: "Align center",
1506
+ children: /* @__PURE__ */ jsx(AlignCenter, { className: "h-3.5 w-3.5" })
1507
+ }),
1508
+ /* @__PURE__ */ jsx("button", {
1509
+ type: "button",
1510
+ onClick: () => editor?.chain().focus().setTextAlign("right").run(),
1511
+ className: cn(buttonBase, editor?.isActive({ textAlign: "right" }) ? buttonActive : buttonInactive),
1512
+ title: "Align right",
1513
+ children: /* @__PURE__ */ jsx(AlignRight, { className: "h-3.5 w-3.5" })
1514
+ }),
1515
+ /* @__PURE__ */ jsx("button", {
1516
+ type: "button",
1517
+ onClick: () => editor?.chain().focus().setTextAlign("justify").run(),
1518
+ className: cn(buttonBase, editor?.isActive({ textAlign: "justify" }) ? buttonActive : buttonInactive),
1519
+ title: "Justify",
1520
+ children: /* @__PURE__ */ jsx(AlignJustify, { className: "h-3.5 w-3.5" })
1521
+ }),
1522
+ toolbarSeparator,
1523
+ /* @__PURE__ */ jsx("button", {
1524
+ type: "button",
1525
+ onClick: () => editor?.chain().focus().toggleBulletList().run(),
1526
+ className: cn(buttonBase, editor?.isActive("bulletList") ? buttonActive : buttonInactive),
1527
+ title: "Bullet list",
1528
+ children: /* @__PURE__ */ jsx(List, { className: "h-3.5 w-3.5" })
1529
+ }),
1530
+ /* @__PURE__ */ jsx("button", {
1531
+ type: "button",
1532
+ onClick: () => editor?.chain().focus().toggleOrderedList().run(),
1533
+ className: cn(buttonBase, editor?.isActive("orderedList") ? buttonActive : buttonInactive),
1534
+ title: "Ordered list",
1535
+ children: /* @__PURE__ */ jsx(ListOrdered, { className: "h-3.5 w-3.5" })
1536
+ }),
1537
+ showDueDate && /* @__PURE__ */ jsxs(Fragment$1, { children: [toolbarSeparator, dueDate ? /* @__PURE__ */ jsxs("div", {
1538
+ className: "bg-primary/10 flex items-center gap-1 rounded px-2 py-1",
1539
+ children: [
1540
+ /* @__PURE__ */ jsx(Calendar, { className: "text-primary h-3.5 w-3.5" }),
1541
+ /* @__PURE__ */ jsx("span", {
1542
+ className: "text-primary text-xs font-medium",
1543
+ children: formatDateForDisplay(dueDate)
1544
+ }),
1545
+ /* @__PURE__ */ jsx("button", {
1546
+ type: "button",
1547
+ onClick: () => setDueDate(void 0),
1548
+ className: "text-primary/60 hover:text-primary ml-1",
1549
+ title: "Remove due date",
1550
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
1551
+ })
1552
+ ]
1553
+ }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
1554
+ type: "button",
1555
+ onClick: () => dateInputRef.current?.showPicker(),
1556
+ className: "text-muted-foreground hover:bg-muted hover:text-foreground flex h-7 cursor-pointer items-center gap-1 rounded px-2 text-xs font-medium transition-colors",
1557
+ children: [/* @__PURE__ */ jsx(Calendar, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ jsx("span", { children: "Due date" })]
1558
+ }), /* @__PURE__ */ jsx("input", {
1559
+ ref: dateInputRef,
1560
+ type: "date",
1561
+ className: "invisible absolute h-0 w-0",
1562
+ onChange: (e) => {
1563
+ if (e.target.value) setDueDate((/* @__PURE__ */ new Date(e.target.value + "T00:00:00")).toISOString());
1564
+ }
1565
+ })] })] })
1566
+ ]
1567
+ }),
1568
+ /* @__PURE__ */ jsx(EditorContent, {
1569
+ editor,
1570
+ className: editorClassName ?? "min-h-[60vh] flex-1 overflow-y-auto p-4"
1571
+ }),
1572
+ /* @__PURE__ */ jsx("style", { children: `
1573
+ .ProseMirror {
1574
+ outline: none;
1575
+ }
1576
+
1577
+ .ProseMirror h1 {
1578
+ font-size: 1.5rem;
1579
+ font-weight: 600;
1580
+ line-height: 1.3;
1581
+ margin-bottom: 0.5rem;
1582
+ }
1583
+
1584
+ .ProseMirror h1.is-empty::before,
1585
+ .ProseMirror p.is-empty::before {
1586
+ color: var(--color-muted-foreground);
1587
+ content: attr(data-placeholder);
1588
+ float: left;
1589
+ height: 0;
1590
+ pointer-events: none;
1591
+ }
1592
+
1593
+ .ProseMirror ul {
1594
+ list-style-type: disc;
1595
+ padding-left: 1.5rem;
1596
+ margin: 0.5rem 0;
1597
+ }
1598
+
1599
+ .ProseMirror ol {
1600
+ list-style-type: decimal;
1601
+ padding-left: 1.5rem;
1602
+ margin: 0.5rem 0;
1603
+ }
1604
+
1605
+ .ProseMirror li {
1606
+ margin: 0.25rem 0;
1607
+ display: list-item;
1608
+ }
1609
+
1610
+ .ProseMirror li > p {
1611
+ margin: 0;
1612
+ }
1613
+ ` })
1614
+ ]
1615
+ });
1616
+ }
1617
+ //#endregion
1618
+ //#region ../../contacts/ui/src/portal/components/editor/note-task-modal.tsx
1619
+ function NoteTaskModal({ open, onOpenChange, mode, type, initialTitle = "", initialBody = "", initialDueDate, showDueDate = false, onSave, isPending = false, isCompleted, onToggleComplete, isTogglePending = false }) {
1620
+ const [title, setTitle] = useState(initialTitle);
1621
+ const [body, setBody] = useState(initialBody);
1622
+ const dateInputRef = useRef(null);
1623
+ const [dueDate, setDueDate] = useState(initialDueDate);
1624
+ const typeLabel = type === "note" ? "Note" : "Task";
1625
+ const sheetTitle = mode === "edit" ? `Edit ${typeLabel}` : `New ${typeLabel}`;
1626
+ const requiresBody = type === "note";
1627
+ const canSave = !!title.trim() && (!requiresBody || !!body.trim()) && !isPending;
1628
+ const handleSave = () => {
1629
+ if (!canSave) return;
1630
+ onSave({
1631
+ title: title.trim(),
1632
+ body,
1633
+ dueDate
1634
+ });
1635
+ };
1636
+ return /* @__PURE__ */ jsx(Sheet, {
1637
+ open,
1638
+ onOpenChange,
1639
+ children: /* @__PURE__ */ jsxs(SheetContent, {
1640
+ className: "flex w-full flex-col sm:max-w-lg",
1641
+ children: [
1642
+ /* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: sheetTitle }) }),
1643
+ /* @__PURE__ */ jsxs("div", {
1644
+ className: "flex min-h-0 flex-1 flex-col gap-3",
1645
+ children: [
1646
+ /* @__PURE__ */ jsx(Input, {
1647
+ placeholder: `${typeLabel} title`,
1648
+ value: title,
1649
+ onChange: (e) => setTitle(e.target.value),
1650
+ autoFocus: true
1651
+ }),
1652
+ /* @__PURE__ */ jsx(NoteTaskEditor, {
1653
+ showTitle: false,
1654
+ bodyPlaceholder: "Start writing...",
1655
+ initialBody,
1656
+ editorClassName: "min-h-[200px] flex-1 overflow-y-auto p-4",
1657
+ onChange: (content) => {
1658
+ setBody(content.body);
1659
+ }
1660
+ }),
1661
+ showDueDate && /* @__PURE__ */ jsx("div", {
1662
+ className: "flex items-center gap-2",
1663
+ children: dueDate ? /* @__PURE__ */ jsxs("div", {
1664
+ className: "bg-primary/10 inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5",
1665
+ children: [
1666
+ /* @__PURE__ */ jsx(Calendar, { className: "text-primary h-3.5 w-3.5" }),
1667
+ /* @__PURE__ */ jsxs("span", {
1668
+ className: "text-primary text-sm font-medium",
1669
+ children: ["Due ", formatDateForDisplay(dueDate)]
1670
+ }),
1671
+ /* @__PURE__ */ jsx("button", {
1672
+ type: "button",
1673
+ onClick: () => setDueDate(void 0),
1674
+ className: "text-primary/60 hover:text-primary ml-1",
1675
+ title: "Remove due date",
1676
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
1677
+ })
1678
+ ]
1679
+ }) : /* @__PURE__ */ jsxs("div", {
1680
+ className: "relative",
1681
+ children: [/* @__PURE__ */ jsxs("button", {
1682
+ type: "button",
1683
+ onClick: () => dateInputRef.current?.showPicker(),
1684
+ className: "text-muted-foreground hover:text-foreground hover:bg-muted inline-flex cursor-pointer items-center gap-1.5 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors",
1685
+ children: [/* @__PURE__ */ jsx(Calendar, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ jsx("span", { children: "Add due date" })]
1686
+ }), /* @__PURE__ */ jsx("input", {
1687
+ ref: dateInputRef,
1688
+ type: "date",
1689
+ className: "invisible absolute h-0 w-0",
1690
+ onChange: (e) => {
1691
+ if (e.target.value) setDueDate((/* @__PURE__ */ new Date(e.target.value + "T00:00:00")).toISOString());
1692
+ }
1693
+ })]
1694
+ })
1695
+ })
1696
+ ]
1697
+ }),
1698
+ /* @__PURE__ */ jsxs(SheetFooter, {
1699
+ className: "flex-row justify-end gap-2 border-t pt-4",
1700
+ children: [
1701
+ mode === "edit" && onToggleComplete && /* @__PURE__ */ jsx(Button, {
1702
+ variant: "outline",
1703
+ onClick: onToggleComplete,
1704
+ disabled: isTogglePending,
1705
+ className: "mr-auto",
1706
+ children: isCompleted ? "Mark Incomplete" : "Mark Complete"
1707
+ }),
1708
+ /* @__PURE__ */ jsx(Button, {
1709
+ variant: "outline",
1710
+ onClick: () => onOpenChange(false),
1711
+ children: "Cancel"
1712
+ }),
1713
+ /* @__PURE__ */ jsx(Button, {
1714
+ onClick: handleSave,
1715
+ disabled: !canSave,
1716
+ children: isPending ? "Saving..." : "Save"
1717
+ })
1718
+ ]
1719
+ })
1720
+ ]
1721
+ })
1722
+ });
1723
+ }
1724
+ //#endregion
1725
+ //#region ../../contacts/ui/src/portal/components/tasks/task-list.tsx
1726
+ function formatDueDate$1(dateStr) {
1727
+ return new Date(dateStr).toLocaleDateString("en-US", {
1728
+ month: "short",
1729
+ day: "numeric",
1730
+ year: "numeric"
1731
+ });
1732
+ }
1733
+ function formatRelativeTime(dateStr, t) {
1734
+ const date = new Date(dateStr);
1735
+ const diffMs = (/* @__PURE__ */ new Date()).getTime() - date.getTime();
1736
+ const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
1737
+ if (diffDays === 0) return date.toLocaleTimeString("en-US", {
1738
+ hour: "numeric",
1739
+ minute: "2-digit"
1740
+ });
1741
+ if (diffDays === 1) return t("task_yesterday");
1742
+ return diffDays === 1 ? t("task_days_ago_one") : t("task_days_ago_other", { count: diffDays });
1743
+ }
1744
+ function classifyDue(dueAt, isCompleted, t) {
1745
+ if (isCompleted) return {
1746
+ label: t("task_due", { date: formatDueDate$1(dueAt) }),
1747
+ tone: "done"
1748
+ };
1749
+ const due = startOfLocalDay(dueAt);
1750
+ const today = startOfLocalDay(/* @__PURE__ */ new Date());
1751
+ const tomorrow = new Date(today);
1752
+ tomorrow.setDate(today.getDate() + 1);
1753
+ const dueTime = due.getTime();
1754
+ if (dueTime < today.getTime()) return {
1755
+ label: t("task_overdue_due", { date: formatDueDate$1(dueAt) }),
1756
+ tone: "overdue"
1757
+ };
1758
+ if (dueTime === today.getTime()) return {
1759
+ label: t("quick_today"),
1760
+ tone: "today"
1761
+ };
1762
+ if (dueTime === tomorrow.getTime()) return {
1763
+ label: t("quick_tomorrow"),
1764
+ tone: "tomorrow"
1765
+ };
1766
+ return {
1767
+ label: formatDueDate$1(dueAt),
1768
+ tone: "future"
1769
+ };
1770
+ }
1771
+ const DUE_TONE_CLASS = {
1772
+ overdue: "bg-destructive/10 text-destructive",
1773
+ today: "bg-primary/10 text-primary",
1774
+ tomorrow: "bg-primary/10 text-primary",
1775
+ future: "bg-muted text-muted-foreground",
1776
+ done: "bg-muted text-muted-foreground"
1777
+ };
1778
+ function TaskCard({ task, toggleCompletion, onEdit, onDeleteClick }) {
1779
+ const { t } = useContactsTranslation();
1780
+ const isCompleted = !!task.completed_at;
1781
+ const { title, body: bodyText } = parseTaskBody(task.body ?? "");
1782
+ const timestamp = task.created_at ? formatRelativeTime(task.created_at, t) : "";
1783
+ const due = task.due_at ? classifyDue(task.due_at, isCompleted, t) : null;
1784
+ return /* @__PURE__ */ jsxs("div", {
1785
+ role: "button",
1786
+ tabIndex: 0,
1787
+ onClick: () => onEdit(task),
1788
+ onKeyDown: (e) => {
1789
+ if (e.key === "Enter" || e.key === " ") {
1790
+ e.preventDefault();
1791
+ onEdit(task);
1792
+ }
1793
+ },
1794
+ className: "group border-border/50 hover:border-foreground/20 hover:bg-muted/40 relative cursor-pointer rounded-xl border p-4 transition-all hover:shadow-sm",
1795
+ children: [/* @__PURE__ */ jsxs("div", {
1796
+ className: "flex items-start gap-3",
1797
+ children: [/* @__PURE__ */ jsx("button", {
1798
+ type: "button",
1799
+ onClick: (e) => {
1800
+ e.stopPropagation();
1801
+ toggleCompletion.mutate({
1802
+ taskId: task.id,
1803
+ isCompleted
1804
+ });
1805
+ },
1806
+ disabled: toggleCompletion.isPending,
1807
+ className: "mt-0.5 shrink-0 transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50",
1808
+ "aria-label": isCompleted ? t("mark_as_open") : t("mark_as_completed"),
1809
+ children: isCompleted ? /* @__PURE__ */ jsx(CircleCheck, {
1810
+ className: "text-primary size-5",
1811
+ "aria-hidden": "true"
1812
+ }) : /* @__PURE__ */ jsx("div", { className: "border-muted-foreground/40 group-hover:border-primary size-5 rounded-full border-2 transition-colors" })
1813
+ }), /* @__PURE__ */ jsxs("div", {
1814
+ className: "min-w-0 flex-1",
1815
+ children: [
1816
+ /* @__PURE__ */ jsx("h4", {
1817
+ className: cn("text-foreground line-clamp-2 text-sm leading-snug font-semibold", isCompleted && "text-muted-foreground line-through"),
1818
+ children: title
1819
+ }),
1820
+ bodyText && /* @__PURE__ */ jsx("p", {
1821
+ className: cn("text-muted-foreground mt-1 line-clamp-2 text-xs leading-relaxed", isCompleted && "line-through"),
1822
+ children: bodyText
1823
+ }),
1824
+ (due || timestamp) && /* @__PURE__ */ jsxs("div", {
1825
+ className: "mt-2.5 flex flex-wrap items-center gap-1.5",
1826
+ children: [due && /* @__PURE__ */ jsxs("span", {
1827
+ className: cn("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium", DUE_TONE_CLASS[due.tone]),
1828
+ children: [/* @__PURE__ */ jsx(Calendar, {
1829
+ className: "size-3",
1830
+ "aria-hidden": "true"
1831
+ }), due.label]
1832
+ }), timestamp && /* @__PURE__ */ jsx("span", {
1833
+ className: "text-muted-foreground/60 text-xs",
1834
+ children: timestamp
1835
+ })]
1836
+ })
1837
+ ]
1838
+ })]
1839
+ }), /* @__PURE__ */ jsx("div", {
1840
+ className: "absolute top-3 right-3 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100",
1841
+ children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
1842
+ asChild: true,
1843
+ children: /* @__PURE__ */ jsx(Button, {
1844
+ variant: "ghost",
1845
+ size: "icon-xs",
1846
+ onClick: (e) => e.stopPropagation(),
1847
+ "aria-label": t("task_actions"),
1848
+ children: /* @__PURE__ */ jsx(EllipsisVertical, { className: "size-4" })
1849
+ })
1850
+ }), /* @__PURE__ */ jsx(DropdownMenuContent, {
1851
+ align: "end",
1852
+ children: /* @__PURE__ */ jsx(DropdownMenuItem, {
1853
+ className: "text-destructive",
1854
+ onClick: (e) => {
1855
+ e.stopPropagation();
1856
+ onDeleteClick(task);
1857
+ },
1858
+ children: t("delete")
1859
+ })
1860
+ })] })
1861
+ })]
1862
+ });
1863
+ }
1864
+ function TaskList({ tasks, isLoading, contactId }) {
1865
+ const { t } = useContactsTranslation();
1866
+ const [taskToDelete, setTaskToDelete] = useState(null);
1867
+ const [editingTask, setEditingTask] = useState(null);
1868
+ const toggleCompletion = useToggleTaskCompletion(contactId);
1869
+ const deleteTask = useDeleteContactTask(contactId, { onSuccess: () => setTaskToDelete(null) });
1870
+ const updateTask = useUpdateContactTask(contactId, { onSuccess: () => setEditingTask(null) });
1871
+ const handleSave = (data) => {
1872
+ if (!editingTask) return;
1873
+ const taskBody = data.body ? `${data.title}\n\n${data.body}` : data.title;
1874
+ updateTask.mutate({
1875
+ taskId: editingTask.id,
1876
+ input: {
1877
+ body: taskBody,
1878
+ due_at: data.dueDate ?? null
1879
+ }
1880
+ });
1881
+ };
1882
+ const editingParsed = editingTask ? parseTaskBody(editingTask.body ?? "") : null;
1883
+ const handleModalOpenChange = (open) => {
1884
+ if (!open) setEditingTask(null);
1885
+ };
1886
+ if (isLoading) return /* @__PURE__ */ jsx("div", {
1887
+ className: "flex flex-col gap-3",
1888
+ children: [
1889
+ 1,
1890
+ 2,
1891
+ 3
1892
+ ].map((i) => /* @__PURE__ */ jsx("div", { className: "border-border/50 bg-muted/50 h-32 animate-pulse rounded-xl border" }, i))
1893
+ });
1894
+ if (tasks.length === 0) return /* @__PURE__ */ jsx(Fragment$1, {});
1895
+ return /* @__PURE__ */ jsxs("div", {
1896
+ className: "space-y-4",
1897
+ children: [
1898
+ /* @__PURE__ */ jsx("div", {
1899
+ className: "flex flex-col gap-3",
1900
+ children: tasks.map((task) => /* @__PURE__ */ jsx(TaskCard, {
1901
+ task,
1902
+ toggleCompletion,
1903
+ onEdit: setEditingTask,
1904
+ onDeleteClick: setTaskToDelete
1905
+ }, task.id))
1906
+ }),
1907
+ /* @__PURE__ */ jsx(NoteTaskModal, {
1908
+ open: editingTask !== null,
1909
+ onOpenChange: handleModalOpenChange,
1910
+ mode: "edit",
1911
+ type: "task",
1912
+ initialTitle: editingParsed?.title ?? "",
1913
+ initialBody: editingParsed?.body ?? "",
1914
+ initialDueDate: editingTask?.due_at ?? void 0,
1915
+ showDueDate: true,
1916
+ onSave: handleSave,
1917
+ isPending: updateTask.isPending,
1918
+ isCompleted: editingTask ? !!editingTask.completed_at : void 0,
1919
+ onToggleComplete: editingTask ? () => toggleCompletion.mutate({
1920
+ taskId: editingTask.id,
1921
+ isCompleted: !!editingTask.completed_at
1922
+ }, { onSuccess: () => setEditingTask(null) }) : void 0,
1923
+ isTogglePending: toggleCompletion.isPending
1924
+ }, editingTask?.id ?? "edit"),
1925
+ /* @__PURE__ */ jsx(AlertDialog, {
1926
+ open: taskToDelete !== null,
1927
+ onOpenChange: (open) => {
1928
+ if (!open) setTaskToDelete(null);
1929
+ },
1930
+ children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: t("delete_task_title") }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: t("delete_task_confirm") })] }), /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [/* @__PURE__ */ jsx(AlertDialogCancel, { children: t("cancel") }), /* @__PURE__ */ jsx(AlertDialogAction, {
1931
+ variant: "destructive",
1932
+ onClick: () => {
1933
+ if (taskToDelete) deleteTask.mutate(taskToDelete.id);
1934
+ },
1935
+ children: t("delete")
1936
+ })] })] })
1937
+ })
1938
+ ]
1939
+ });
1940
+ }
1941
+ //#endregion
1942
+ //#region ../../contacts/ui/src/portal/hooks/contacts/use-create-contact-task.ts
1943
+ function useCreateContactTask(contactId, options) {
1944
+ const queryClient = useQueryClient();
1945
+ const api = useTasksApi();
1946
+ return useMutation({
1947
+ mutationFn: (input) => api.createTask(contactId, input),
1948
+ onSuccess: () => {
1949
+ fluidToast({
1950
+ title: "Task created",
1951
+ type: "success"
1952
+ });
1953
+ queryClient.invalidateQueries({ queryKey: contactsKeys.tasks(contactId) });
1954
+ options?.onSuccess?.();
1955
+ },
1956
+ onError: (error) => {
1957
+ fluidToast({
1958
+ title: "Failed to create task",
1959
+ type: "error",
1960
+ description: parseApiErrors(error)
1961
+ });
1962
+ }
1963
+ });
1964
+ }
1965
+ //#endregion
1966
+ //#region ../../contacts/ui/src/portal/components/tasks/inline-task-composer.tsx
1967
+ const QUICK_DATES = [
1968
+ {
1969
+ key: "today",
1970
+ offsetDays: 0
1971
+ },
1972
+ {
1973
+ key: "tomorrow",
1974
+ offsetDays: 1
1975
+ },
1976
+ {
1977
+ key: "next_week",
1978
+ offsetDays: 7
1979
+ }
1980
+ ];
1981
+ function InlineTaskComposer({ contactId }) {
1982
+ const { t } = useContactsTranslation();
1983
+ const [isOpen, setIsOpen] = useState(false);
1984
+ const [body, setBody] = useState("");
1985
+ const [dueDate, setDueDate] = useState(null);
1986
+ const inputRef = useRef(null);
1987
+ const createTask = useCreateContactTask(contactId, { onSuccess: () => {
1988
+ setBody("");
1989
+ setDueDate(null);
1990
+ setIsOpen(false);
1991
+ } });
1992
+ useEffect(() => {
1993
+ if (isOpen) inputRef.current?.focus();
1994
+ }, [isOpen]);
1995
+ const quickDates = useMemo(() => QUICK_DATES.map((q) => ({
1996
+ key: q.key,
1997
+ iso: isoDate(q.offsetDays)
1998
+ })), []);
1999
+ const quickLabels = {
2000
+ today: t("quick_today"),
2001
+ tomorrow: t("quick_tomorrow"),
2002
+ next_week: t("quick_next_week")
2003
+ };
2004
+ const close = () => {
2005
+ setIsOpen(false);
2006
+ setBody("");
2007
+ setDueDate(null);
2008
+ };
2009
+ const submit = () => {
2010
+ const trimmed = body.trim();
2011
+ if (!trimmed || createTask.isPending) return;
2012
+ createTask.mutate({
2013
+ body: trimmed,
2014
+ due_at: dueDate
2015
+ });
2016
+ };
2017
+ const canSubmit = body.trim().length > 0 && !createTask.isPending;
2018
+ if (!isOpen) return /* @__PURE__ */ jsxs("button", {
2019
+ type: "button",
2020
+ onClick: () => setIsOpen(true),
2021
+ className: "border-border/50 text-muted-foreground hover:border-foreground/30 hover:bg-muted/40 hover:text-foreground flex w-full items-center gap-3 rounded-xl border border-dashed px-5 py-4 text-sm font-medium transition-colors",
2022
+ children: [/* @__PURE__ */ jsx(Plus, {
2023
+ className: "size-4",
2024
+ "aria-hidden": "true"
2025
+ }), t("new_task")]
2026
+ });
2027
+ return /* @__PURE__ */ jsxs("div", {
2028
+ className: "border-border/50 focus-within:border-foreground/30 rounded-xl border p-3 transition-colors",
2029
+ children: [/* @__PURE__ */ jsxs("div", {
2030
+ className: "flex items-start gap-3",
2031
+ children: [
2032
+ /* @__PURE__ */ jsx("div", {
2033
+ className: "border-muted-foreground/50 mt-1.5 size-5 shrink-0 rounded-full border-2",
2034
+ "aria-hidden": "true"
2035
+ }),
2036
+ /* @__PURE__ */ jsx("input", {
2037
+ ref: inputRef,
2038
+ value: body,
2039
+ onChange: (e) => setBody(e.target.value),
2040
+ onKeyDown: (e) => {
2041
+ if (e.key === "Enter" && !e.shiftKey) {
2042
+ e.preventDefault();
2043
+ submit();
2044
+ } else if (e.key === "Escape") {
2045
+ e.preventDefault();
2046
+ close();
2047
+ }
2048
+ },
2049
+ placeholder: t("task_describe_placeholder"),
2050
+ "aria-label": t("task_description_aria"),
2051
+ className: "placeholder:text-muted-foreground/80 text-foreground flex-1 border-0 bg-transparent text-sm font-medium outline-none"
2052
+ }),
2053
+ /* @__PURE__ */ jsx("button", {
2054
+ type: "button",
2055
+ onClick: close,
2056
+ "aria-label": t("task_discard_aria"),
2057
+ className: "text-muted-foreground hover:bg-muted hover:text-foreground -mt-0.5 -mr-0.5 flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",
2058
+ children: /* @__PURE__ */ jsx(X, { className: "size-4" })
2059
+ })
2060
+ ]
2061
+ }), /* @__PURE__ */ jsxs("div", {
2062
+ className: "mt-3 flex items-center gap-1.5 pl-8",
2063
+ children: [
2064
+ quickDates.map((q) => {
2065
+ const isActive = dueDate === q.iso;
2066
+ return /* @__PURE__ */ jsx("button", {
2067
+ type: "button",
2068
+ onClick: () => setDueDate(isActive ? null : q.iso),
2069
+ "aria-pressed": isActive,
2070
+ className: cn("shrink-0 rounded-full px-3 py-1 text-xs font-medium transition-colors", isActive ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/70"),
2071
+ children: quickLabels[q.key]
2072
+ }, q.key);
2073
+ }),
2074
+ /* @__PURE__ */ jsx("div", { className: "ml-auto" }),
2075
+ /* @__PURE__ */ jsx("button", {
2076
+ type: "button",
2077
+ onClick: submit,
2078
+ disabled: !canSubmit,
2079
+ className: "bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground inline-flex shrink-0 items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-semibold transition-colors disabled:cursor-not-allowed",
2080
+ children: createTask.isPending ? t("adding") : t("add_task")
2081
+ })
2082
+ ]
2083
+ })]
2084
+ });
2085
+ }
2086
+ //#endregion
2087
+ //#region ../../contacts/ui/src/portal/hooks/notes/use-delete-contact-note.ts
2088
+ function useDeleteContactNote(contactId, options) {
2089
+ const queryClient = useQueryClient();
2090
+ const api = useNotesApi();
2091
+ return useMutation({
2092
+ mutationFn: (noteId) => api.deleteNote(noteId, contactId),
2093
+ onSuccess: () => {
2094
+ fluidToast({
2095
+ title: "Note deleted",
2096
+ type: "success"
2097
+ });
2098
+ queryClient.invalidateQueries({ queryKey: contactsKeys.notes(contactId) });
2099
+ options?.onSuccess?.();
2100
+ },
2101
+ onError: (error) => {
2102
+ fluidToast({
2103
+ title: "Failed to delete note",
2104
+ type: "error",
2105
+ description: parseApiErrors(error)
2106
+ });
2107
+ }
2108
+ });
2109
+ }
2110
+ //#endregion
2111
+ //#region ../../contacts/ui/src/portal/hooks/notes/use-update-contact-note.ts
2112
+ function useUpdateContactNote(contactId, options) {
2113
+ const queryClient = useQueryClient();
2114
+ const api = useNotesApi();
2115
+ return useMutation({
2116
+ mutationFn: ({ noteId, input }) => api.updateNote(noteId, contactId, input),
2117
+ onSuccess: () => {
2118
+ fluidToast({
2119
+ title: "Note updated",
2120
+ type: "success"
2121
+ });
2122
+ queryClient.invalidateQueries({ queryKey: contactsKeys.notes(contactId) });
2123
+ options?.onSuccess?.();
2124
+ },
2125
+ onError: (error) => {
2126
+ fluidToast({
2127
+ title: "Failed to update note",
2128
+ type: "error",
2129
+ description: parseApiErrors(error)
2130
+ });
2131
+ }
2132
+ });
2133
+ }
2134
+ //#endregion
2135
+ //#region ../../contacts/ui/src/portal/hooks/notes/use-create-contact-note.ts
2136
+ function useCreateContactNote(contactId, options) {
2137
+ const queryClient = useQueryClient();
2138
+ const api = useNotesApi();
2139
+ return useMutation({
2140
+ mutationFn: (input) => api.createNote(contactId, input),
2141
+ onSuccess: () => {
2142
+ fluidToast({
2143
+ title: "Note created",
2144
+ type: "success"
2145
+ });
2146
+ queryClient.invalidateQueries({ queryKey: contactsKeys.notes(contactId) });
2147
+ options?.onSuccess?.();
2148
+ },
2149
+ onError: (error) => {
2150
+ fluidToast({
2151
+ title: "Failed to create note",
2152
+ type: "error",
2153
+ description: parseApiErrors(error)
2154
+ });
2155
+ }
2156
+ });
2157
+ }
2158
+ //#endregion
2159
+ //#region ../../contacts/ui/src/portal/components/notes/inline-note-composer.tsx
2160
+ function detectMacPlatform() {
2161
+ if (typeof navigator === "undefined") return false;
2162
+ const platform = navigator.userAgentData?.platform ?? navigator.userAgent ?? "";
2163
+ return /Mac|iPhone|iPad/i.test(platform);
2164
+ }
2165
+ function InlineNoteComposer({ contactId }) {
2166
+ const { t } = useContactsTranslation();
2167
+ const [body, setBody] = useState("");
2168
+ const [isFocused, setIsFocused] = useState(false);
2169
+ const [isMac, setIsMac] = useState(false);
2170
+ const textareaRef = useRef(null);
2171
+ useEffect(() => {
2172
+ setIsMac(detectMacPlatform());
2173
+ }, []);
2174
+ const createNote = useCreateContactNote(contactId, { onSuccess: () => {
2175
+ setBody("");
2176
+ textareaRef.current?.blur();
2177
+ } });
2178
+ const submit = () => {
2179
+ const trimmed = body.trim();
2180
+ if (!trimmed || createNote.isPending) return;
2181
+ const firstLine = trimmed.split("\n")[0]?.slice(0, 120) ?? "Note";
2182
+ createNote.mutate({
2183
+ title: firstLine,
2184
+ body: trimmed
2185
+ });
2186
+ };
2187
+ const canSubmit = body.trim().length > 0 && !createNote.isPending;
2188
+ return /* @__PURE__ */ jsxs("div", {
2189
+ className: cn("border-border/50 focus-within:border-foreground/30 rounded-2xl border p-4 transition-colors", isFocused && "border-foreground/30"),
2190
+ children: [/* @__PURE__ */ jsx("textarea", {
2191
+ ref: textareaRef,
2192
+ value: body,
2193
+ onChange: (e) => setBody(e.target.value),
2194
+ onFocus: () => setIsFocused(true),
2195
+ onBlur: () => setIsFocused(false),
2196
+ onKeyDown: (e) => {
2197
+ if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
2198
+ e.preventDefault();
2199
+ submit();
2200
+ }
2201
+ },
2202
+ placeholder: t("note_placeholder"),
2203
+ "aria-label": t("note_body_aria"),
2204
+ rows: 3,
2205
+ className: "placeholder:text-muted-foreground text-foreground min-h-[80px] w-full resize-none border-0 bg-transparent text-sm leading-relaxed outline-none"
2206
+ }), /* @__PURE__ */ jsxs("div", {
2207
+ className: "mt-3 flex items-center justify-between gap-3",
2208
+ children: [/* @__PURE__ */ jsx("span", {
2209
+ className: "text-muted-foreground text-xs",
2210
+ children: isMac ? t("tip_save_shortcut_mac") : t("tip_save_shortcut_other")
2211
+ }), /* @__PURE__ */ jsx("button", {
2212
+ type: "button",
2213
+ onClick: submit,
2214
+ disabled: !canSubmit,
2215
+ className: "bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground inline-flex shrink-0 items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-semibold transition-colors disabled:cursor-not-allowed",
2216
+ children: createNote.isPending ? t("adding") : t("add_note")
2217
+ })]
2218
+ })]
2219
+ });
2220
+ }
2221
+ //#endregion
2222
+ //#region ../../contacts/ui/src/portal/components/notes/notes-list.tsx
2223
+ function formatDueDate(dateStr) {
2224
+ return new Date(dateStr).toLocaleDateString("en-US", {
2225
+ month: "short",
2226
+ day: "numeric",
2227
+ year: "numeric"
2228
+ });
2229
+ }
2230
+ function formatRelativeNote(dateStr, t) {
2231
+ const date = new Date(dateStr);
2232
+ const diffMs = (/* @__PURE__ */ new Date()).getTime() - date.getTime();
2233
+ const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
2234
+ if (diffDays === 0) return date.toLocaleTimeString("en-US", {
2235
+ hour: "numeric",
2236
+ minute: "2-digit"
2237
+ });
2238
+ if (diffDays === 1) return t("task_yesterday");
2239
+ if (diffDays < 7) return t("task_days_ago_other", { count: diffDays });
2240
+ return formatDueDate(dateStr);
2241
+ }
2242
+ function NoteCard({ note, onEdit, onDelete }) {
2243
+ const { t } = useContactsTranslation();
2244
+ const assetCount = note.assets?.length ?? 0;
2245
+ const showTitle = !!note.title?.trim() && note.title.trim() !== note.body?.trim();
2246
+ const dueDateValue = note.due_at ?? note.due_date ?? null;
2247
+ const createdLabel = note.created_at ? formatRelativeNote(note.created_at, t) : null;
2248
+ return /* @__PURE__ */ jsxs("div", {
2249
+ role: "button",
2250
+ tabIndex: 0,
2251
+ onClick: () => onEdit(note),
2252
+ onKeyDown: (e) => {
2253
+ if (e.key === "Enter" || e.key === " ") {
2254
+ e.preventDefault();
2255
+ onEdit(note);
2256
+ }
2257
+ },
2258
+ className: "group border-border/50 hover:border-foreground/20 hover:bg-muted/40 relative cursor-pointer rounded-xl border p-4 transition-all hover:shadow-sm",
2259
+ children: [
2260
+ showTitle && /* @__PURE__ */ jsx("h4", {
2261
+ className: "text-foreground line-clamp-1 text-sm font-semibold",
2262
+ children: note.title
2263
+ }),
2264
+ /* @__PURE__ */ jsx("p", {
2265
+ className: cn("text-foreground line-clamp-4 text-sm leading-relaxed whitespace-pre-wrap", showTitle && "text-muted-foreground mt-1"),
2266
+ children: note.body
2267
+ }),
2268
+ (createdLabel || dueDateValue || assetCount > 0) && /* @__PURE__ */ jsxs("div", {
2269
+ className: "mt-2.5 flex flex-wrap items-center gap-3",
2270
+ children: [
2271
+ createdLabel && /* @__PURE__ */ jsx("span", {
2272
+ className: "text-muted-foreground/70 text-xs",
2273
+ children: createdLabel
2274
+ }),
2275
+ dueDateValue && /* @__PURE__ */ jsxs("span", {
2276
+ className: "bg-primary/10 text-primary inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium",
2277
+ children: [/* @__PURE__ */ jsx(Calendar, {
2278
+ className: "size-3",
2279
+ "aria-hidden": "true"
2280
+ }), t("task_due", { date: formatDueDate(dueDateValue) })]
2281
+ }),
2282
+ assetCount > 0 && /* @__PURE__ */ jsxs("span", {
2283
+ className: "text-muted-foreground inline-flex items-center gap-1 text-xs",
2284
+ children: [/* @__PURE__ */ jsx(Paperclip, {
2285
+ className: "size-3",
2286
+ "aria-hidden": "true"
2287
+ }), assetCount === 1 ? t("attachment_one") : t("attachment_other", { count: assetCount })]
2288
+ })
2289
+ ]
2290
+ }),
2291
+ /* @__PURE__ */ jsx("div", {
2292
+ className: "absolute top-3 right-3 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100",
2293
+ children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
2294
+ asChild: true,
2295
+ children: /* @__PURE__ */ jsx(Button, {
2296
+ variant: "ghost",
2297
+ size: "icon-xs",
2298
+ onClick: (e) => e.stopPropagation(),
2299
+ "aria-label": t("note_actions"),
2300
+ children: /* @__PURE__ */ jsx(EllipsisVertical, { className: "size-4" })
2301
+ })
2302
+ }), /* @__PURE__ */ jsx(DropdownMenuContent, {
2303
+ align: "end",
2304
+ children: /* @__PURE__ */ jsx(DropdownMenuItem, {
2305
+ className: "text-destructive",
2306
+ onClick: (e) => {
2307
+ e.stopPropagation();
2308
+ onDelete(note);
2309
+ },
2310
+ children: t("delete")
2311
+ })
2312
+ })] })
2313
+ })
2314
+ ]
2315
+ });
2316
+ }
2317
+ function NotesList({ notes, isLoading, contactId }) {
2318
+ const { t } = useContactsTranslation();
2319
+ const [noteToDelete, setNoteToDelete] = useState(null);
2320
+ const [editingNote, setEditingNote] = useState(null);
2321
+ const deleteNote = useDeleteContactNote(contactId, { onSuccess: () => setNoteToDelete(null) });
2322
+ const updateNote = useUpdateContactNote(contactId, { onSuccess: () => setEditingNote(null) });
2323
+ const handleEditSave = (data) => {
2324
+ if (!editingNote) return;
2325
+ updateNote.mutate({
2326
+ noteId: editingNote.id,
2327
+ input: {
2328
+ title: data.title,
2329
+ body: data.body
2330
+ }
2331
+ });
2332
+ };
2333
+ return /* @__PURE__ */ jsxs("div", {
2334
+ className: "space-y-4",
2335
+ children: [
2336
+ /* @__PURE__ */ jsx(InlineNoteComposer, { contactId }),
2337
+ isLoading ? /* @__PURE__ */ jsx("div", {
2338
+ className: "flex flex-col gap-3",
2339
+ children: [
2340
+ 1,
2341
+ 2,
2342
+ 3
2343
+ ].map((i) => /* @__PURE__ */ jsx("div", { className: "border-border/50 bg-muted/50 h-20 animate-pulse rounded-xl border" }, i))
2344
+ }) : notes.length === 0 ? null : /* @__PURE__ */ jsx("div", {
2345
+ className: "flex flex-col gap-3",
2346
+ children: notes.map((note) => /* @__PURE__ */ jsx(NoteCard, {
2347
+ note,
2348
+ onEdit: setEditingNote,
2349
+ onDelete: setNoteToDelete
2350
+ }, note.id))
2351
+ }),
2352
+ /* @__PURE__ */ jsx(NoteTaskModal, {
2353
+ open: editingNote !== null,
2354
+ onOpenChange: (open) => {
2355
+ if (!open) setEditingNote(null);
2356
+ },
2357
+ mode: "edit",
2358
+ type: "note",
2359
+ initialTitle: editingNote?.title ?? "",
2360
+ initialBody: editingNote?.body ?? "",
2361
+ onSave: handleEditSave,
2362
+ isPending: updateNote.isPending
2363
+ }, editingNote?.id ?? "edit"),
2364
+ /* @__PURE__ */ jsx(AlertDialog, {
2365
+ open: !!noteToDelete,
2366
+ onOpenChange: (open) => {
2367
+ if (!open) setNoteToDelete(null);
2368
+ },
2369
+ children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: t("delete_note_title") }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: t("delete_note_irreversible") })] }), /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [/* @__PURE__ */ jsx(AlertDialogCancel, { children: t("cancel") }), /* @__PURE__ */ jsx(AlertDialogAction, {
2370
+ variant: "destructive",
2371
+ onClick: () => {
2372
+ if (noteToDelete) deleteNote.mutate(noteToDelete.id);
2373
+ },
2374
+ children: t("delete")
2375
+ })] })] })
2376
+ })
2377
+ ]
2378
+ });
2379
+ }
2380
+ //#endregion
2381
+ //#region ../../contacts/ui/src/portal/components/contacts/rep-layout/ContactDetailTabs.tsx
2382
+ const VISIBLE_TABS = ["Tasks", "Notes"];
2383
+ function ContactDetailTabs({ contactId, tasks, isLoadingTasks, notes, isLoadingNotes, activeTab, onTabChange }) {
2384
+ const { t } = useContactsTranslation();
2385
+ const tabLabels = {
2386
+ Tasks: t("tab_tasks"),
2387
+ Notes: t("tab_notes")
2388
+ };
2389
+ return /* @__PURE__ */ jsxs("div", {
2390
+ className: "mt-8",
2391
+ children: [/* @__PURE__ */ jsx("div", {
2392
+ className: "border-border/50 flex items-center gap-1 border-b",
2393
+ children: VISIBLE_TABS.map((tab) => {
2394
+ const count = tab === "Tasks" ? tasks.length : notes.length;
2395
+ const isActive = activeTab === tab;
2396
+ return /* @__PURE__ */ jsxs("button", {
2397
+ type: "button",
2398
+ onClick: () => onTabChange(tab),
2399
+ className: cn("relative flex items-center gap-1.5 px-3 py-2.5 text-sm font-semibold transition-colors", isActive ? "text-foreground" : "text-muted-foreground hover:text-foreground"),
2400
+ children: [
2401
+ tabLabels[tab],
2402
+ /* @__PURE__ */ jsx("span", {
2403
+ className: cn("rounded-full px-1.5 text-xs leading-5 font-bold", isActive ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground"),
2404
+ children: count
2405
+ }),
2406
+ isActive && /* @__PURE__ */ jsx("span", {
2407
+ className: "bg-primary absolute inset-x-0 -bottom-px h-0.5",
2408
+ "aria-hidden": "true"
2409
+ })
2410
+ ]
2411
+ }, tab);
2412
+ })
2413
+ }), /* @__PURE__ */ jsxs("div", {
2414
+ className: "pt-6",
2415
+ children: [activeTab === "Tasks" && /* @__PURE__ */ jsxs("div", {
2416
+ className: "space-y-4",
2417
+ children: [/* @__PURE__ */ jsx(InlineTaskComposer, { contactId }), /* @__PURE__ */ jsx(TaskList, {
2418
+ tasks,
2419
+ isLoading: isLoadingTasks,
2420
+ contactId,
2421
+ hideHeader: true
2422
+ })]
2423
+ }), activeTab === "Notes" && /* @__PURE__ */ jsx(NotesList, {
2424
+ notes,
2425
+ isLoading: isLoadingNotes,
2426
+ contactId
2427
+ })]
2428
+ })]
2429
+ });
2430
+ }
2431
+ //#endregion
2432
+ //#region ../../contacts/ui/src/portal/components/contacts/rep-layout/ContactDetailPane.tsx
2433
+ function ContactDetailPane({ contactId, queryKeyPrefix, getCountries, onBack }) {
2434
+ const { t } = useContactsTranslation();
2435
+ const { contact, isLoading, methods, countryOptions, isDirty, isSubmitting, isDeleting, onSave, onDelete } = useContactDetailPage(contactId, {
2436
+ queryKeyPrefix,
2437
+ getCountries,
2438
+ onDeleteSuccess: onBack,
2439
+ onSaveSuccess: () => setEditProfileOpen(false)
2440
+ });
2441
+ const { data: tasks = [], isLoading: isLoadingTasks } = useContactTasks(contactId);
2442
+ const { data: notes = [], isLoading: isLoadingNotes } = useContactNotes(contactId);
2443
+ const [confirmDelete, setConfirmDelete] = useState(false);
2444
+ const [activeTab, setActiveTab] = useState("Tasks");
2445
+ const [editProfileOpen, setEditProfileOpen] = useState(false);
2446
+ const handleConfirmDelete = useCallback(() => {
2447
+ setConfirmDelete(false);
2448
+ onDelete();
2449
+ }, [onDelete]);
2450
+ if (isLoading) return /* @__PURE__ */ jsx(ContactDetailSkeleton, { onBack });
2451
+ if (!contact) return /* @__PURE__ */ jsxs("div", {
2452
+ className: "flex h-full flex-1 flex-col",
2453
+ children: [/* @__PURE__ */ jsx(DetailTopBar, {
2454
+ onBack,
2455
+ phone: null,
2456
+ email: null,
2457
+ onDelete: null,
2458
+ onEditProfile: null
2459
+ }), /* @__PURE__ */ jsxs("div", {
2460
+ className: "mx-auto flex max-w-md flex-col items-center px-6 py-16 text-center",
2461
+ children: [/* @__PURE__ */ jsx("h2", {
2462
+ className: "text-foreground text-base font-semibold",
2463
+ children: t("error_loading")
2464
+ }), /* @__PURE__ */ jsx("p", {
2465
+ className: "text-muted-foreground mt-2 text-sm",
2466
+ children: t("error_loading_description")
2467
+ })]
2468
+ })]
2469
+ });
2470
+ const fullName = getDisplayName(contact);
2471
+ return /* @__PURE__ */ jsx(FormProvider, {
2472
+ ...methods,
2473
+ children: /* @__PURE__ */ jsxs("div", {
2474
+ className: "flex h-full flex-1 flex-col",
2475
+ children: [
2476
+ /* @__PURE__ */ jsx(DetailTopBar, {
2477
+ onBack,
2478
+ phone: contact.phone ?? null,
2479
+ email: contact.email ?? null,
2480
+ onDelete: () => setConfirmDelete(true),
2481
+ onEditProfile: () => setEditProfileOpen(true)
2482
+ }),
2483
+ /* @__PURE__ */ jsx("div", {
2484
+ className: "flex-1 overflow-y-auto",
2485
+ children: /* @__PURE__ */ jsxs("div", {
2486
+ className: "mx-auto w-full max-w-[900px] px-6 pt-8 pb-16 md:px-8 md:pt-10",
2487
+ children: [
2488
+ /* @__PURE__ */ jsx(ContactDetailHero, {
2489
+ contact,
2490
+ tasksCount: tasks.length,
2491
+ notesCount: notes.length
2492
+ }),
2493
+ /* @__PURE__ */ jsx(ContactInfoRow, {
2494
+ contact,
2495
+ onEditEmpty: () => setEditProfileOpen(true)
2496
+ }),
2497
+ /* @__PURE__ */ jsx(ContactDetailTabs, {
2498
+ contactId,
2499
+ tasks,
2500
+ isLoadingTasks,
2501
+ notes,
2502
+ isLoadingNotes,
2503
+ activeTab,
2504
+ onTabChange: setActiveTab
2505
+ })
2506
+ ]
2507
+ })
2508
+ }),
2509
+ /* @__PURE__ */ jsx(Dialog, {
2510
+ open: editProfileOpen,
2511
+ onOpenChange: (open) => {
2512
+ if (!open && isSubmitting) return;
2513
+ setEditProfileOpen(open);
2514
+ },
2515
+ children: /* @__PURE__ */ jsxs(DialogContent, {
2516
+ className: "max-h-[90vh] max-w-2xl overflow-y-auto",
2517
+ children: [
2518
+ /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("edit_contact_name", { name: fullName }) }) }),
2519
+ /* @__PURE__ */ jsx(ContactDetailsForm, { countries: countryOptions }),
2520
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
2521
+ type: "button",
2522
+ variant: "secondary",
2523
+ onClick: () => setEditProfileOpen(false),
2524
+ disabled: isSubmitting,
2525
+ children: t("cancel")
2526
+ }), /* @__PURE__ */ jsxs(Button, {
2527
+ type: "button",
2528
+ onClick: onSave,
2529
+ disabled: !isDirty || isSubmitting,
2530
+ "aria-busy": isSubmitting,
2531
+ children: [isSubmitting && /* @__PURE__ */ jsx(Spinner, { className: "size-4" }), isSubmitting ? t("saving") : t("save_changes")]
2532
+ })] })
2533
+ ]
2534
+ })
2535
+ }),
2536
+ /* @__PURE__ */ jsx(AlertDialog, {
2537
+ open: confirmDelete,
2538
+ onOpenChange: setConfirmDelete,
2539
+ children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: t("delete_name", { name: fullName }) }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: t("delete_confirm_permanent") })] }), /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [/* @__PURE__ */ jsx(AlertDialogCancel, {
2540
+ disabled: isDeleting,
2541
+ children: t("cancel")
2542
+ }), /* @__PURE__ */ jsx(AlertDialogAction, {
2543
+ variant: "destructive",
2544
+ onClick: handleConfirmDelete,
2545
+ disabled: isDeleting,
2546
+ children: isDeleting ? t("deleting") : t("delete_contact")
2547
+ })] })] })
2548
+ })
2549
+ ]
2550
+ })
2551
+ });
2552
+ }
2553
+ function DetailTopBar({ onBack, phone, email, onDelete, onEditProfile }) {
2554
+ const { t } = useContactsTranslation();
2555
+ return /* @__PURE__ */ jsxs("div", {
2556
+ className: "border-border/50 bg-background/90 sticky top-0 z-10 flex items-center justify-between border-b px-4 py-3 backdrop-blur md:px-8",
2557
+ children: [/* @__PURE__ */ jsxs("div", {
2558
+ className: "flex items-center gap-3",
2559
+ children: [/* @__PURE__ */ jsx("button", {
2560
+ type: "button",
2561
+ onClick: onBack,
2562
+ className: "text-muted-foreground hover:bg-muted hover:text-foreground flex size-8 items-center justify-center rounded-full transition-colors md:hidden",
2563
+ "aria-label": t("back_to_contacts"),
2564
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" })
2565
+ }), /* @__PURE__ */ jsx("span", {
2566
+ className: "text-muted-foreground hidden text-xs font-semibold tracking-widest uppercase md:inline",
2567
+ children: t("contact_label")
2568
+ })]
2569
+ }), /* @__PURE__ */ jsxs("div", {
2570
+ className: "flex items-center gap-1",
2571
+ children: [
2572
+ onEditProfile && /* @__PURE__ */ jsx("button", {
2573
+ type: "button",
2574
+ onClick: onEditProfile,
2575
+ className: "text-muted-foreground hover:bg-muted hover:text-foreground flex size-8 items-center justify-center rounded-full transition-colors",
2576
+ "aria-label": t("edit_profile"),
2577
+ children: /* @__PURE__ */ jsx(Pencil, {
2578
+ className: "size-4",
2579
+ "aria-hidden": "true"
2580
+ })
2581
+ }),
2582
+ /* @__PURE__ */ jsx(ActionLink, {
2583
+ href: phone ? `tel:${phone}` : null,
2584
+ label: t("label_call"),
2585
+ icon: /* @__PURE__ */ jsx(Phone, {
2586
+ className: "size-4",
2587
+ "aria-hidden": "true"
2588
+ })
2589
+ }),
2590
+ /* @__PURE__ */ jsx(ActionLink, {
2591
+ href: email ? `mailto:${email}` : null,
2592
+ label: t("label_email"),
2593
+ icon: /* @__PURE__ */ jsx(Mail, {
2594
+ className: "size-4",
2595
+ "aria-hidden": "true"
2596
+ })
2597
+ }),
2598
+ onDelete && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
2599
+ className: "bg-border mx-1 h-5 w-px",
2600
+ "aria-hidden": "true"
2601
+ }), /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
2602
+ asChild: true,
2603
+ children: /* @__PURE__ */ jsx("button", {
2604
+ type: "button",
2605
+ className: "text-muted-foreground hover:bg-muted hover:text-foreground flex size-8 items-center justify-center rounded-full transition-colors",
2606
+ "aria-label": t("more_actions"),
2607
+ children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "size-4" })
2608
+ })
2609
+ }), /* @__PURE__ */ jsx(DropdownMenuContent, {
2610
+ align: "end",
2611
+ children: /* @__PURE__ */ jsxs(DropdownMenuItem, {
2612
+ className: "text-destructive",
2613
+ onClick: onDelete,
2614
+ children: [/* @__PURE__ */ jsx(Trash2, {
2615
+ className: "size-4",
2616
+ "aria-hidden": "true"
2617
+ }), t("delete_contact")]
2618
+ })
2619
+ })] })] })
2620
+ ]
2621
+ })]
2622
+ });
2623
+ }
2624
+ function ActionLink({ href, label, icon }) {
2625
+ const baseClass = "flex size-8 items-center justify-center rounded-full transition-colors";
2626
+ if (!href) return /* @__PURE__ */ jsx("span", {
2627
+ "aria-label": `${label} (unavailable)`,
2628
+ className: cn(baseClass, "text-muted-foreground/40 cursor-default"),
2629
+ children: icon
2630
+ });
2631
+ return /* @__PURE__ */ jsx("a", {
2632
+ href,
2633
+ "aria-label": label,
2634
+ className: cn(baseClass, "text-muted-foreground hover:bg-muted hover:text-foreground"),
2635
+ children: icon
2636
+ });
2637
+ }
2638
+ function ContactDetailSkeleton({ onBack }) {
2639
+ return /* @__PURE__ */ jsxs("div", {
2640
+ className: "flex h-full flex-1 flex-col",
2641
+ children: [/* @__PURE__ */ jsx(DetailTopBar, {
2642
+ onBack,
2643
+ phone: null,
2644
+ email: null,
2645
+ onDelete: null,
2646
+ onEditProfile: null
2647
+ }), /* @__PURE__ */ jsxs("div", {
2648
+ className: "mx-auto w-full max-w-[900px] flex-1 space-y-6 px-6 pt-8 pb-16 md:px-8 md:pt-10",
2649
+ children: [
2650
+ /* @__PURE__ */ jsxs("div", {
2651
+ className: "flex items-start gap-5",
2652
+ children: [/* @__PURE__ */ jsx("div", { className: "bg-muted size-20 animate-pulse rounded-xl" }), /* @__PURE__ */ jsxs("div", {
2653
+ className: "flex-1 space-y-3",
2654
+ children: [/* @__PURE__ */ jsx("div", { className: "bg-muted h-7 w-48 animate-pulse rounded" }), /* @__PURE__ */ jsx("div", { className: "bg-muted h-4 w-24 animate-pulse rounded" })]
2655
+ })]
2656
+ }),
2657
+ /* @__PURE__ */ jsx("div", { className: "bg-muted h-24 animate-pulse rounded-xl" }),
2658
+ /* @__PURE__ */ jsx("div", { className: "bg-muted h-64 animate-pulse rounded-xl" })
2659
+ ]
2660
+ })]
2661
+ });
2662
+ }
2663
+ //#endregion
2664
+ //#region ../../contacts/ui/src/portal/components/contacts/rep-layout/ContactsEmptyState.tsx
2665
+ function ContactsEmptyState() {
2666
+ const { t } = useContactsTranslation();
2667
+ return /* @__PURE__ */ jsxs("div", {
2668
+ className: "hidden h-full flex-1 flex-col items-center justify-center px-8 text-center md:flex",
2669
+ children: [
2670
+ /* @__PURE__ */ jsx("div", {
2671
+ className: "bg-muted text-muted-foreground flex size-16 items-center justify-center rounded-xl",
2672
+ children: /* @__PURE__ */ jsx(Users, {
2673
+ className: "size-7",
2674
+ "aria-hidden": "true"
2675
+ })
2676
+ }),
2677
+ /* @__PURE__ */ jsx("h2", {
2678
+ className: "text-foreground mt-5 text-base font-semibold",
2679
+ children: t("empty_select_contact")
2680
+ }),
2681
+ /* @__PURE__ */ jsx("p", {
2682
+ className: "text-muted-foreground mt-1 max-w-xs text-sm",
2683
+ children: t("empty_select_description")
2684
+ })
2685
+ ]
2686
+ });
2687
+ }
2688
+ //#endregion
2689
+ //#region ../../contacts/ui/src/portal/components/contacts/rep-layout/RepContactsLayout.tsx
2690
+ function RepContactsLayout({ selectedContactId, onSelect, onAdd, queryKeyPrefix, getCountries }) {
2691
+ return /* @__PURE__ */ jsxs("div", {
2692
+ className: "bg-background flex h-full overflow-hidden",
2693
+ children: [/* @__PURE__ */ jsx("aside", {
2694
+ className: cn("border-border/50 bg-background w-full shrink-0 overflow-hidden border-r md:flex md:w-[420px] md:flex-col", selectedContactId ? "hidden" : "flex flex-col"),
2695
+ children: /* @__PURE__ */ jsx(ContactsSidebar, {
2696
+ selectedContactId,
2697
+ onSelect,
2698
+ onAdd
2699
+ })
2700
+ }), /* @__PURE__ */ jsx("main", {
2701
+ className: cn("bg-background relative flex-1 md:flex md:flex-col", selectedContactId ? "flex flex-col" : "hidden md:flex"),
2702
+ children: selectedContactId ? /* @__PURE__ */ jsx(ContactDetailPane, {
2703
+ contactId: selectedContactId,
2704
+ queryKeyPrefix,
2705
+ getCountries,
2706
+ onBack: () => onSelect(null)
2707
+ }, selectedContactId) : /* @__PURE__ */ jsx(ContactsEmptyState, {})
2708
+ })]
2709
+ });
2710
+ }
2711
+ //#endregion
2712
+ //#region ../../contacts/ui/src/shared/hooks/useCreateContactMutation.ts
2713
+ function useCreateContactMutation(queryKeyPrefix = "contacts", options) {
2714
+ const queryClient = useQueryClient();
2715
+ const api = useContactsCrud();
2716
+ return useMutation({
2717
+ mutationFn: (data) => api.createContact(data),
2718
+ onSuccess: (data) => {
2719
+ fluidToast({
2720
+ title: "Contact created successfully",
2721
+ type: "success"
2722
+ });
2723
+ queryClient.invalidateQueries({ queryKey: CONTACTS_QUERY_KEYS.all(queryKeyPrefix) });
2724
+ options?.onSuccess?.(data);
2725
+ },
2726
+ onError: (error) => {
2727
+ if (options?.onError) options.onError(error);
2728
+ else fluidToast({
2729
+ title: "Failed to create contact",
2730
+ type: "error",
2731
+ description: parseApiErrors(error)
2732
+ });
2733
+ }
2734
+ });
2735
+ }
2736
+ //#endregion
2737
+ //#region ../../api-clients/portal-tenant-contacts/src/namespaces/portal_tenant_contacts.ts
2738
+ /**
2739
+ * List contacts with cursor pagination
2740
+ * Returns a paginated list of contacts belonging to the authenticated member.
2741
+ *
2742
+ * @param client - Fetch client instance
2743
+ * @param [params] - params
2744
+ */
2745
+ async function contacts_list(client, params) {
2746
+ return client.get(`/api/contacts`, params);
2747
+ }
2748
+ /**
2749
+ * Create a new contact
2750
+ * Creates a new contact for the authenticated member.
2751
+ *
2752
+ * @param client - Fetch client instance
2753
+ * @param body - body
2754
+ */
2755
+ async function contacts_create(client, body) {
2756
+ return client.post(`/api/contacts`, body);
2757
+ }
2758
+ /**
2759
+ * Get a specific contact
2760
+ * Returns a single contact by ID.
2761
+ *
2762
+ * @param client - Fetch client instance
2763
+ * @param id - id
2764
+ */
2765
+ async function contacts_show(client, id) {
2766
+ return client.get(`/api/contacts/${id}`);
2767
+ }
2768
+ /**
2769
+ * Update a contact
2770
+ * Updates an existing contact's attributes.
2771
+ *
2772
+ * @param client - Fetch client instance
2773
+ * @param id - id
2774
+ * @param body - body
2775
+ */
2776
+ async function contacts_update(client, id, body) {
2777
+ return client.patch(`/api/contacts/${id}`, body);
2778
+ }
2779
+ /**
2780
+ * Delete a contact
2781
+ * Soft-deletes a contact by ID.
2782
+ *
2783
+ * @param client - Fetch client instance
2784
+ * @param id - id
2785
+ */
2786
+ async function contacts_destroy(client, id) {
2787
+ return client.delete(`/api/contacts/${id}`);
2788
+ }
2789
+ /**
2790
+ * Delete multiple contacts
2791
+ * Soft-deletes multiple contacts by their IDs.
2792
+ *
2793
+ * @param client - Fetch client instance
2794
+ * @param body - body
2795
+ */
2796
+ async function contacts_bulk_destroy(client, body) {
2797
+ return client.delete(`/api/contacts/bulk`, { body });
2798
+ }
2799
+ /**
2800
+ * List contact groups
2801
+ * Returns a paginated list of contact groups belonging to the authenticated member.
2802
+ *
2803
+ * @param client - Fetch client instance
2804
+ * @param [params] - params
2805
+ */
2806
+ async function contacts_groups_list(client, params) {
2807
+ return client.get(`/api/contacts/groups`, params);
2808
+ }
2809
+ /**
2810
+ * Create a new group
2811
+ * Creates a new contact group for the authenticated member.
2812
+ *
2813
+ * @param client - Fetch client instance
2814
+ * @param body - body
2815
+ */
2816
+ async function contacts_groups_create(client, body) {
2817
+ return client.post(`/api/contacts/groups`, body);
2818
+ }
2819
+ /**
2820
+ * Update a group
2821
+ * Updates an existing contact group.
2822
+ *
2823
+ * @param client - Fetch client instance
2824
+ * @param id - id
2825
+ * @param body - body
2826
+ */
2827
+ async function contacts_groups_update(client, id, body) {
2828
+ return client.patch(`/api/contacts/groups/${id}`, body);
2829
+ }
2830
+ /**
2831
+ * Delete a group
2832
+ * Removes a contact group.
2833
+ *
2834
+ * @param client - Fetch client instance
2835
+ * @param id - id
2836
+ */
2837
+ async function contacts_groups_destroy(client, id) {
2838
+ return client.delete(`/api/contacts/groups/${id}`);
2839
+ }
2840
+ /**
2841
+ * List notes for a contact
2842
+ * Returns notes attached to a contact.
2843
+ *
2844
+ * @param client - Fetch client instance
2845
+ * @param contact_id - contact_id
2846
+ * @param [params] - params
2847
+ */
2848
+ async function contacts_notes_list(client, contact_id, params) {
2849
+ return client.get(`/api/contacts/${contact_id}/notes`, params);
2850
+ }
2851
+ /**
2852
+ * Create a note for a contact
2853
+ * Adds a new note to a contact.
2854
+ *
2855
+ * @param client - Fetch client instance
2856
+ * @param contact_id - contact_id
2857
+ * @param body - body
2858
+ */
2859
+ async function contacts_notes_create(client, contact_id, body) {
2860
+ return client.post(`/api/contacts/${contact_id}/notes`, body);
2861
+ }
2862
+ /**
2863
+ * List tasks for a contact
2864
+ * Returns tasks assigned to a contact.
2865
+ *
2866
+ * @param client - Fetch client instance
2867
+ * @param contact_id - contact_id
2868
+ * @param [params] - params
2869
+ */
2870
+ async function contacts_tasks_list(client, contact_id, params) {
2871
+ return client.get(`/api/contacts/${contact_id}/tasks`, params);
2872
+ }
2873
+ /**
2874
+ * Create a task for a contact
2875
+ * Adds a new task to a contact.
2876
+ *
2877
+ * @param client - Fetch client instance
2878
+ * @param contact_id - contact_id
2879
+ * @param body - body
2880
+ */
2881
+ async function contacts_tasks_create(client, contact_id, body) {
2882
+ return client.post(`/api/contacts/${contact_id}/tasks`, body);
2883
+ }
2884
+ /**
2885
+ * Update a note
2886
+ * Updates an existing note on a contact.
2887
+ *
2888
+ * @param client - Fetch client instance
2889
+ * @param contact_id - contact_id
2890
+ * @param id - id
2891
+ * @param body - body
2892
+ */
2893
+ async function contacts_notes_update(client, contact_id, id, body) {
2894
+ return client.patch(`/api/contacts/${contact_id}/notes/${id}`, body);
2895
+ }
2896
+ /**
2897
+ * Delete a note
2898
+ * Removes a note from a contact.
2899
+ *
2900
+ * @param client - Fetch client instance
2901
+ * @param contact_id - contact_id
2902
+ * @param id - id
2903
+ */
2904
+ async function contacts_notes_destroy(client, contact_id, id) {
2905
+ return client.delete(`/api/contacts/${contact_id}/notes/${id}`);
2906
+ }
2907
+ /**
2908
+ * Update a task
2909
+ * Updates an existing task on a contact.
2910
+ *
2911
+ * @param client - Fetch client instance
2912
+ * @param contact_id - contact_id
2913
+ * @param id - id
2914
+ * @param body - body
2915
+ */
2916
+ async function contacts_tasks_update(client, contact_id, id, body) {
2917
+ return client.patch(`/api/contacts/${contact_id}/tasks/${id}`, body);
2918
+ }
2919
+ /**
2920
+ * Delete a task
2921
+ * Removes a task from a contact.
2922
+ *
2923
+ * @param client - Fetch client instance
2924
+ * @param contact_id - contact_id
2925
+ * @param id - id
2926
+ */
2927
+ async function contacts_tasks_destroy(client, contact_id, id) {
2928
+ return client.delete(`/api/contacts/${contact_id}/tasks/${id}`);
2929
+ }
2930
+ //#endregion
2931
+ //#region src/adapters/contacts-api-adapter.ts
2932
+ const EMPTY_META = {
2933
+ total_count: 0,
2934
+ total_pages: 0,
2935
+ current_page: 1,
2936
+ next_cursor: null
2937
+ };
2938
+ function paginationFromBff(meta, itemCount, currentPage, pageSize) {
2939
+ if (!meta) return EMPTY_META;
2940
+ const nextCursor = meta.pagination?.next_cursor ?? null;
2941
+ const hasNext = !!nextCursor;
2942
+ const totalCount = meta.total_count ?? (hasNext ? (currentPage + 1) * pageSize : (currentPage - 1) * pageSize + itemCount);
2943
+ return {
2944
+ total_count: totalCount,
2945
+ total_pages: Math.max(1, Math.ceil(totalCount / pageSize)),
2946
+ current_page: currentPage,
2947
+ next_cursor: nextCursor,
2948
+ request_id: meta.request_id ?? void 0,
2949
+ timestamp: meta.timestamp ?? void 0
2950
+ };
2951
+ }
2952
+ /** BFF Contact → core Contact. Fills missing fields with safe defaults. */
2953
+ function mapContact(raw) {
2954
+ return {
2955
+ id: raw.id,
2956
+ full_name: `${raw.first_name ?? ""} ${raw.last_name ?? ""}`.trim(),
2957
+ first_name: raw.first_name ?? null,
2958
+ last_name: raw.last_name ?? null,
2959
+ email: raw.email ?? null,
2960
+ phone: raw.phone ?? null,
2961
+ status: raw.status ?? null,
2962
+ address: raw.address ?? null,
2963
+ city: raw.city ?? null,
2964
+ state: raw.state ?? null,
2965
+ postal_code: raw.postal_code ?? null,
2966
+ avatar_url: raw.avatar_url ?? null,
2967
+ country: raw.country ?? null,
2968
+ tags: raw.tags ?? [],
2969
+ metadata: {},
2970
+ created_at: raw.created_at,
2971
+ updated_at: raw.updated_at
2972
+ };
2973
+ }
2974
+ /** BFF Note → core ContactNote. */
2975
+ function mapNote(raw) {
2976
+ return {
2977
+ id: raw.id,
2978
+ title: raw.title ?? "",
2979
+ body: raw.body ?? "",
2980
+ note_type: null,
2981
+ due_date: null,
2982
+ due_time: null,
2983
+ pinned: null,
2984
+ created_at: raw.created_at,
2985
+ updated_at: raw.updated_at,
2986
+ contact_id: raw.contact_id ?? 0,
2987
+ assets: []
2988
+ };
2989
+ }
2990
+ /** BFF Task → core ContactTask. */
2991
+ function mapTask(raw) {
2992
+ return {
2993
+ id: raw.id,
2994
+ body: raw.title ?? "",
2995
+ due_at: raw.due_date ?? null,
2996
+ completed_at: raw.completed_at ?? (raw.completed ? (/* @__PURE__ */ new Date()).toISOString() : null),
2997
+ created_at: raw.created_at,
2998
+ contact_id: raw.contact_id ?? null
2999
+ };
3000
+ }
3001
+ /**
3002
+ * The contacts-ui sends offset pagination params (page, per_page, sort_by,
3003
+ * sort_direction, search, status). The BFF expects cursor pagination
3004
+ * (page[cursor], page[limit], search, tags). Translate between the two.
3005
+ *
3006
+ * `cursorCache` maps page numbers → cursor tokens so page-2+ requests can
3007
+ * resolve to the correct cursor. The cache is populated from BFF responses.
3008
+ */
3009
+ function mapListParams(params, cursorCache) {
3010
+ if (!params) return void 0;
3011
+ const mapped = {};
3012
+ if (params.per_page || params.limit) mapped["page[limit]"] = params.per_page ?? params.limit;
3013
+ const page = params.page ?? 1;
3014
+ if (page > 1) {
3015
+ const cursor = cursorCache.get(page);
3016
+ if (cursor) mapped["page[cursor]"] = cursor;
3017
+ }
3018
+ if (params.search_query || params.search || params.query) mapped.search = params.search_query ?? params.search ?? params.query;
3019
+ if (params.tags) mapped.tags = params.tags;
3020
+ return mapped;
3021
+ }
3022
+ function createContactsAdapter(client) {
3023
+ const cursorCache = /* @__PURE__ */ new Map();
3024
+ return {
3025
+ getContact: async (id) => {
3026
+ return { contact: mapContact((await contacts_show(client, id)).contact) };
3027
+ },
3028
+ listContacts: async (params) => {
3029
+ const raw = params;
3030
+ const page = raw?.page ?? 1;
3031
+ const pageSize = raw?.per_page ?? 25;
3032
+ const body = await contacts_list(client, mapListParams(raw, cursorCache));
3033
+ const meta = body.meta;
3034
+ const nextCursor = (meta?.pagination)?.next_cursor;
3035
+ if (nextCursor) cursorCache.set(page + 1, nextCursor);
3036
+ const contacts = (body.contacts ?? []).map(mapContact);
3037
+ return {
3038
+ contacts,
3039
+ meta: paginationFromBff(meta, contacts.length, page, pageSize)
3040
+ };
3041
+ },
3042
+ createContact: async (data) => {
3043
+ return contacts_create(client, { contact: data });
3044
+ },
3045
+ updateContact: async (id, data) => {
3046
+ return contacts_update(client, id, { contact: data });
3047
+ },
3048
+ deleteContact: async (id) => {
3049
+ return contacts_destroy(client, id);
3050
+ },
3051
+ bulkDeleteContacts: async (ids) => {
3052
+ return contacts_bulk_destroy(client, { ids });
3053
+ }
3054
+ };
3055
+ }
3056
+ function createNotesAdapter(client) {
3057
+ return {
3058
+ listNotes: async (contactId) => {
3059
+ return { notes: ((await contacts_notes_list(client, contactId)).notes ?? []).map(mapNote) };
3060
+ },
3061
+ createNote: async (contactId, input) => {
3062
+ return contacts_notes_create(client, contactId, { note: input });
3063
+ },
3064
+ updateNote: async (noteId, contactId, input) => {
3065
+ return contacts_notes_update(client, contactId, noteId, { note: input });
3066
+ },
3067
+ deleteNote: async (noteId, contactId) => {
3068
+ return contacts_notes_destroy(client, contactId, noteId);
3069
+ }
3070
+ };
3071
+ }
3072
+ function createTasksAdapter(client) {
3073
+ return {
3074
+ listTasks: async (contactId) => {
3075
+ return { tasks: ((await contacts_tasks_list(client, contactId)).tasks ?? []).map(mapTask) };
3076
+ },
3077
+ createTask: async (contactId, input) => {
3078
+ return contacts_tasks_create(client, contactId, { task: {
3079
+ title: input.body,
3080
+ due_date: input.due_at
3081
+ } });
3082
+ },
3083
+ updateTask: async (taskId, contactId, input) => {
3084
+ return contacts_tasks_update(client, contactId, taskId, { task: {
3085
+ title: input.body ?? void 0,
3086
+ completed: input.completed_at !== void 0 ? input.completed_at !== null : void 0,
3087
+ due_date: input.due_at
3088
+ } });
3089
+ },
3090
+ deleteTask: async (taskId, contactId) => {
3091
+ return contacts_tasks_destroy(client, contactId, taskId);
3092
+ }
3093
+ };
3094
+ }
3095
+ /** BFF Group → core ContactGroup. */
3096
+ function mapGroup(raw) {
3097
+ return {
3098
+ id: raw.id,
3099
+ name: raw.name ?? "",
3100
+ avatar: raw.avatar ?? null,
3101
+ avatar_background: raw.avatar_background ?? null,
3102
+ created_at: raw.created_at,
3103
+ updated_at: raw.updated_at
3104
+ };
3105
+ }
3106
+ function createGroupsAdapter(client) {
3107
+ return {
3108
+ listGroups: async () => {
3109
+ return { groups: ((await contacts_groups_list(client)).groups ?? []).map(mapGroup) };
3110
+ },
3111
+ createGroup: async (input) => {
3112
+ return { group: mapGroup((await contacts_groups_create(client, { group: input })).group) };
3113
+ },
3114
+ updateGroup: async (groupId, input) => {
3115
+ return { group: mapGroup((await contacts_groups_update(client, groupId, { group: input })).group) };
3116
+ },
3117
+ deleteGroup: async (groupId) => {
3118
+ return contacts_groups_destroy(client, groupId);
3119
+ }
3120
+ };
3121
+ }
3122
+ /**
3123
+ * Creates a composite ContactsDomainApi backed by the portal-tenant
3124
+ * Contacts BFF endpoints.
3125
+ */
3126
+ function createPortalContactsDomainApiAdapter(client) {
3127
+ return {
3128
+ contacts: createContactsAdapter(client),
3129
+ notes: createNotesAdapter(client),
3130
+ tasks: createTasksAdapter(client),
3131
+ groups: createGroupsAdapter(client)
3132
+ };
3133
+ }
3134
+ //#endregion
3135
+ //#region src/contacts/PortalContactsApiProvider.tsx
3136
+ function PortalContactsApiProvider({ children }) {
3137
+ const client = usePortalTenantClient();
3138
+ return /* @__PURE__ */ jsx(ContactsApiProvider, {
3139
+ value: useMemo(() => createPortalContactsDomainApiAdapter(client), [client]),
3140
+ children
3141
+ });
3142
+ }
3143
+ //#endregion
3144
+ //#region ../../contacts/core/src/translation-adapter.ts
3145
+ const contactsDomain = createDomainTranslations({
3146
+ fallback: {
3147
+ breadcrumb: "Contacts",
3148
+ breadcrumb_new: "New Contact",
3149
+ contact_label: "Contact",
3150
+ add: "Add",
3151
+ add_contact: "Add Contact",
3152
+ adding: "Adding...",
3153
+ update_contact: "Update Contact",
3154
+ saving: "Saving",
3155
+ cancel: "Cancel",
3156
+ save: "Save",
3157
+ delete: "Delete",
3158
+ delete_name: "Delete {{name}}?",
3159
+ delete_confirm_permanent: "This permanently removes the contact and all of their notes, tasks, and activity. This can't be undone.",
3160
+ delete_contact: "Delete contact",
3161
+ deleting: "Deleting...",
3162
+ search_placeholder: "Search contacts",
3163
+ error_loading: "Couldn't load contact",
3164
+ error_loading_description: "This contact may have been deleted, you may not have permission to view it, or there was a network error. Try selecting them again.",
3165
+ error_loading_list: "Couldn't load contacts. Pull down to retry.",
3166
+ error_generic: "Something went wrong. Please try again later.",
3167
+ loading: "Loading...",
3168
+ loading_more: "Loading more...",
3169
+ searching: "Searching...",
3170
+ people_count: "{{count}} people across your network",
3171
+ person_count: "{{count}} person across your network",
3172
+ no_contacts_search: "No contacts match \"{{term}}\".",
3173
+ no_contacts_yet: "No contacts yet.",
3174
+ no_contacts_filter: "No contacts match this filter.",
3175
+ empty_select_contact: "Select a contact",
3176
+ empty_select_description: "Pick someone from your list on the left to see their details, notes, and tasks.",
3177
+ tab_tasks: "Tasks",
3178
+ tab_notes: "Notes",
3179
+ edit_profile: "Edit profile",
3180
+ editing_name: "Editing {{name}}",
3181
+ profile_edit_description: "Update details below. Your contact card above is paused while you edit.",
3182
+ new_task: "New task",
3183
+ last_updated: "Last updated {{date}}",
3184
+ label_email: "Email",
3185
+ label_phone: "Phone",
3186
+ label_address: "Address",
3187
+ label_call: "Call",
3188
+ not_set: "Not set",
3189
+ more_actions: "More actions",
3190
+ back_to_contacts: "Back to contacts",
3191
+ back_to_tasks: "Back to Tasks",
3192
+ filter_all: "All",
3193
+ filter_leads: "Leads",
3194
+ filter_customers: "Customers",
3195
+ note_placeholder: "Leave a note about this contact…",
3196
+ note_body_aria: "Note body",
3197
+ add_note: "Add note",
3198
+ tip_save_shortcut_mac: "Tip: ⌘ + Enter to save",
3199
+ tip_save_shortcut_other: "Tip: Ctrl + Enter to save",
3200
+ task_describe_placeholder: "Describe the task…",
3201
+ task_description_aria: "Task description",
3202
+ task_discard_aria: "Discard task",
3203
+ add_task: "Add task",
3204
+ quick_today: "Today",
3205
+ quick_tomorrow: "Tomorrow",
3206
+ quick_next_week: "Next week",
3207
+ edit_contact_name: "Edit {{name}}",
3208
+ save_changes: "Save changes",
3209
+ add_field: "Add {{field}}",
3210
+ copy_field: "Copy {{field}}",
3211
+ copied_field: "Copied {{field}}",
3212
+ attachment_one: "1 attachment",
3213
+ attachment_other: "{{count}} attachments",
3214
+ note_actions: "Note actions",
3215
+ delete_note_title: "Delete note?",
3216
+ delete_note_irreversible: "This action cannot be undone.",
3217
+ task_yesterday: "Yesterday",
3218
+ task_days_ago_one: "1 day ago",
3219
+ task_days_ago_other: "{{count}} days ago",
3220
+ task_overdue_due: "Overdue · {{date}}",
3221
+ task_due: "Due {{date}}",
3222
+ mark_as_open: "Mark as open",
3223
+ mark_as_completed: "Mark as completed",
3224
+ task_actions: "Task actions",
3225
+ delete_task_title: "Delete task?",
3226
+ delete_task_confirm: "Are you sure you want to delete this task? This action cannot be undone."
3227
+ },
3228
+ loaders: {
3229
+ de: () => import("./de-CGy25zic.mjs").then((m) => m.default),
3230
+ el: () => import("./el-CskvdzKi.mjs").then((m) => m.default),
3231
+ es: () => import("./es-C9i5io24.mjs").then((m) => m.default),
3232
+ fr: () => import("./fr-C3_oKvzk.mjs").then((m) => m.default),
3233
+ he: () => import("./he-CuqCUKV8.mjs").then((m) => m.default),
3234
+ hu: () => import("./hu-C4zRpT5A.mjs").then((m) => m.default),
3235
+ id: () => import("./id-D46AnV5d.mjs").then((m) => m.default),
3236
+ it: () => import("./it-B5FAdcWK.mjs").then((m) => m.default),
3237
+ ja: () => import("./ja--szyvUVA.mjs").then((m) => m.default),
3238
+ ko: () => import("./ko-BmLeX3IQ.mjs").then((m) => m.default),
3239
+ nl: () => import("./nl-bDUZu4UW.mjs").then((m) => m.default),
3240
+ pl: () => import("./pl-Cajq0xj3.mjs").then((m) => m.default),
3241
+ pt: () => import("./pt-DI7pacS4.mjs").then((m) => m.default),
3242
+ ro: () => import("./ro-1kra0Vj9.mjs").then((m) => m.default),
3243
+ ru: () => import("./ru-BDzvZSyf.mjs").then((m) => m.default),
3244
+ th: () => import("./th-Bn-4AmzJ.mjs").then((m) => m.default),
3245
+ tl: () => import("./tl-BUEIFsUN.mjs").then((m) => m.default),
3246
+ tr: () => import("./tr-DLIJaWKF.mjs").then((m) => m.default),
3247
+ zh_CN: () => import("./zh_CN-CoqqAq_7.mjs").then((m) => m.default),
3248
+ zh_TW: () => import("./zh_TW-Bu6jD4YX.mjs").then((m) => m.default)
3249
+ }
3250
+ });
3251
+ function createContactsTranslationAdapter(locale, dict) {
3252
+ return createStaticDictAdapter(locale, dict);
3253
+ }
3254
+ //#endregion
3255
+ //#region src/providers/ContactsTranslationBridge.tsx
3256
+ function ContactsTranslationBridge({ children }) {
3257
+ const { locale } = useActiveLocale();
3258
+ const dict = useDomainDict(contactsDomain, locale);
3259
+ return /* @__PURE__ */ jsx(ContactsTranslationProvider, {
3260
+ value: useMemo(() => createContactsTranslationAdapter(locale, dict), [locale, dict]),
3261
+ children
3262
+ });
3263
+ }
3264
+ //#endregion
3265
+ //#region src/screens/ContactsScreen.tsx
3266
+ var ContactsScreen_exports = /* @__PURE__ */ __exportAll({
3267
+ ContactsScreen: () => ContactsScreen,
3268
+ contactsScreenPropertySchema: () => contactsScreenPropertySchema
3269
+ });
3270
+ const QUERY_KEY_PREFIX = "sdk-contacts";
3271
+ function ContactBrowseView({ selectedContactId, onSelect, onAdd }) {
3272
+ const countriesAdapter = useCountriesApi();
3273
+ return /* @__PURE__ */ jsx(RepContactsLayout, {
3274
+ selectedContactId,
3275
+ onSelect,
3276
+ onAdd,
3277
+ queryKeyPrefix: QUERY_KEY_PREFIX,
3278
+ getCountries: useCallback(async () => {
3279
+ return (await countriesAdapter.listCountries()).countries.map((c) => ({
3280
+ id: 0,
3281
+ name: c.name,
3282
+ iso: c.code
3283
+ }));
3284
+ }, [countriesAdapter])
3285
+ });
3286
+ }
3287
+ const CREATE_DEFAULT_VALUES = {
3288
+ first_name: "",
3289
+ last_name: "",
3290
+ email: "",
3291
+ phone: "",
3292
+ status: "new",
3293
+ address: "",
3294
+ city: "",
3295
+ state: "",
3296
+ postal_code: "",
3297
+ country_code: null,
3298
+ language_code: null,
3299
+ metadata: {},
3300
+ affiliate: {}
3301
+ };
3302
+ function ContactCreateView({ onNavigate, onCreateContact }) {
3303
+ const formRef = useRef(null);
3304
+ const countriesAdapter = useCountriesApi();
3305
+ const { data: countriesResponse } = useQuery({
3306
+ queryKey: storeKeys.countries(),
3307
+ queryFn: () => countriesAdapter.listCountries()
3308
+ });
3309
+ const countryOptions = useMemo(() => (countriesResponse?.countries ?? []).map((c) => ({
3310
+ name: c.name,
3311
+ value: c.code
3312
+ })).sort((a, b) => a.name.localeCompare(b.name)), [countriesResponse]);
3313
+ const methods = useZodForm(createContactFormSchema, { defaultValues: CREATE_DEFAULT_VALUES });
3314
+ const mutation = useCreateContactMutation(QUERY_KEY_PREFIX, { onSuccess: (data) => {
3315
+ onCreateContact?.();
3316
+ const newContactId = data?.contact?.id;
3317
+ if (newContactId) onNavigate({
3318
+ view: "browse",
3319
+ selectedContactId: String(newContactId)
3320
+ });
3321
+ else onNavigate({
3322
+ view: "browse",
3323
+ selectedContactId: null
3324
+ });
3325
+ } });
3326
+ const { mutate } = mutation;
3327
+ const onSubmit = useMemo(() => methods.handleSubmit((data) => {
3328
+ const { affiliate, ...contactFields } = data;
3329
+ const payload = {};
3330
+ for (const [key, value] of Object.entries(contactFields)) if (value !== "" && value !== null && value !== void 0) payload[key] = value;
3331
+ if (affiliate && Object.keys(affiliate).length > 0) payload.affiliate = affiliate;
3332
+ mutate(payload);
3333
+ }, () => {}), [methods, mutate]);
3334
+ return /* @__PURE__ */ jsx(ContactCreateScreen, {
3335
+ onNavigateToList: useCallback(() => {
3336
+ onNavigate({
3337
+ view: "browse",
3338
+ selectedContactId: null
3339
+ });
3340
+ }, [onNavigate]),
3341
+ onSubmit: () => formRef.current?.requestSubmit(),
3342
+ isPending: mutation.isPending,
3343
+ children: /* @__PURE__ */ jsx(FormProvider, {
3344
+ ...methods,
3345
+ children: /* @__PURE__ */ jsx("div", {
3346
+ className: "mx-auto max-w-7xl space-y-12 md:px-10 md:py-8",
3347
+ children: /* @__PURE__ */ jsx("form", {
3348
+ ref: formRef,
3349
+ onSubmit,
3350
+ className: "mx-auto space-y-6 lg:max-w-2xl",
3351
+ children: /* @__PURE__ */ jsx(ContactDetailsForm, { countries: countryOptions })
3352
+ })
3353
+ })
3354
+ })
3355
+ });
3356
+ }
3357
+ function ContactsScreen({ onContactSelect, onCreateContact, background, textColor, accentColor, padding, borderRadius, defaultViewMode, ...divProps }) {
3358
+ const [nav, setNav] = useState({
3359
+ view: "browse",
3360
+ selectedContactId: null
3361
+ });
3362
+ const handleSelect = useCallback((id) => {
3363
+ setNav({
3364
+ view: "browse",
3365
+ selectedContactId: id
3366
+ });
3367
+ if (id) onContactSelect?.(id);
3368
+ }, [onContactSelect]);
3369
+ const handleAdd = useCallback(() => {
3370
+ setNav({ view: "new" });
3371
+ }, []);
3372
+ return /* @__PURE__ */ jsx(ContactsTranslationBridge, { children: /* @__PURE__ */ jsx(PortalContactsApiProvider, { children: /* @__PURE__ */ jsxs("div", {
3373
+ ...divProps,
3374
+ className: `h-full ${divProps.className ?? ""}`,
3375
+ children: [nav.view === "browse" && /* @__PURE__ */ jsx(ContactBrowseView, {
3376
+ selectedContactId: nav.selectedContactId,
3377
+ onSelect: handleSelect,
3378
+ onAdd: handleAdd
3379
+ }), nav.view === "new" && /* @__PURE__ */ jsx(ContactCreateView, {
3380
+ onNavigate: setNav,
3381
+ onCreateContact
3382
+ })]
3383
+ }) }) });
3384
+ }
3385
+ const contactsScreenPropertySchema = {
3386
+ widgetType: "ContactsScreen",
3387
+ displayName: "Contacts Screen",
3388
+ tabsConfig: [{
3389
+ id: "styling",
3390
+ label: "Styling"
3391
+ }],
3392
+ fields: []
3393
+ };
3394
+ //#endregion
3395
+ export { ContactsScreen_exports as n, contactsScreenPropertySchema as r, ContactsScreen as t };
3396
+
3397
+ //# sourceMappingURL=ContactsScreen-CLLyfNru.mjs.map