@fluid-app/portal-sdk 0.1.249 → 0.1.251

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 (224) hide show
  1. package/dist/{AddressAutocompleteInput-B0qLrCHN.mjs → AddressAutocompleteInput-Bdsv2iFU.mjs} +2 -2
  2. package/dist/{AddressAutocompleteInput-B0qLrCHN.mjs.map → AddressAutocompleteInput-Bdsv2iFU.mjs.map} +1 -1
  3. package/dist/{ChartWidget-Ci4Q0Ig-.mjs → ChartWidget-aFsH9gwD.mjs} +2 -2
  4. package/dist/{ChartWidget-Ci4Q0Ig-.mjs.map → ChartWidget-aFsH9gwD.mjs.map} +1 -1
  5. package/dist/{ContactsScreen-Bq8zrA8k.mjs → ContactsScreen-DlxwuLwy.mjs} +4 -4
  6. package/dist/{ContactsScreen-Bq8zrA8k.mjs.map → ContactsScreen-DlxwuLwy.mjs.map} +1 -1
  7. package/dist/{FluidProvider-DS1QKy5j.mjs → FluidProvider-CvS807e4.mjs} +9 -9
  8. package/dist/{FluidProvider-DS1QKy5j.mjs.map → FluidProvider-CvS807e4.mjs.map} +1 -1
  9. package/dist/{InfiniteScrollSentinel-BHIgNtHI.mjs → InfiniteScrollSentinel-Dq--_LMC.mjs} +2 -2
  10. package/dist/{InfiniteScrollSentinel-BHIgNtHI.mjs.map → InfiniteScrollSentinel-Dq--_LMC.mjs.map} +1 -1
  11. package/dist/{LinkWidget-utkZrvAV.mjs → LinkWidget-CcEATaYa.mjs} +2 -2
  12. package/dist/{LinkWidget-utkZrvAV.mjs.map → LinkWidget-CcEATaYa.mjs.map} +1 -1
  13. package/dist/{MessagingScreen-CJ_9yIHK.mjs → MessagingScreen-D7crRUnX.mjs} +4 -4
  14. package/dist/{MessagingScreen-CJ_9yIHK.mjs.map → MessagingScreen-D7crRUnX.mjs.map} +1 -1
  15. package/dist/{MessagingScreen-s7CL9vPN.mjs → MessagingScreen-DZfFOdFI.mjs} +8 -8
  16. package/dist/{MessagingScreen-DeYSVcMd.cjs → MessagingScreen-GLb5id9n.cjs} +63 -130
  17. package/dist/MessagingScreen-GLb5id9n.cjs.map +1 -0
  18. package/dist/{MessagingScreen-FHwytr8B.cjs → MessagingScreen-jOf-MSk1.cjs} +1 -1
  19. package/dist/{MySiteScreen-DX8tBz8Z.mjs → MySiteScreen-CZFM4MQO.mjs} +3 -3
  20. package/dist/{MySiteScreen-DX8tBz8Z.mjs.map → MySiteScreen-CZFM4MQO.mjs.map} +1 -1
  21. package/dist/{OrdersScreen-B3vtWt8_.mjs → OrdersScreen-BDTtvnBR.mjs} +3 -3
  22. package/dist/{OrdersScreen-B3vtWt8_.mjs.map → OrdersScreen-BDTtvnBR.mjs.map} +1 -1
  23. package/dist/{ProfileScreen-IPuXlf9V.mjs → ProfileScreen--6ETap-j.mjs} +5 -5
  24. package/dist/{ProfileScreen-IPuXlf9V.mjs.map → ProfileScreen--6ETap-j.mjs.map} +1 -1
  25. package/dist/{ProfileScreen-m3fTsHyw.mjs → ProfileScreen-BXzIR1xc.mjs} +9 -9
  26. package/dist/{SearchSort-B5Jrk5lW.mjs → SearchSort-CnUiCGu2.mjs} +2 -2
  27. package/dist/{SearchSort-B5Jrk5lW.mjs.map → SearchSort-CnUiCGu2.mjs.map} +1 -1
  28. package/dist/{ShareablesScreen-NMoZH9ed.mjs → ShareablesScreen-BY47-Q_G.mjs} +4 -4
  29. package/dist/{ShareablesScreen-NMoZH9ed.mjs.map → ShareablesScreen-BY47-Q_G.mjs.map} +1 -1
  30. package/dist/{ShareablesScreen-Cd8chxk4.mjs → ShareablesScreen-D0z03RD0.mjs} +4 -4
  31. package/dist/{ShopScreen-DJANOOka.mjs → ShopScreen-BLU3IQ5B.mjs} +24 -24
  32. package/dist/{ShopScreen-DJANOOka.mjs.map → ShopScreen-BLU3IQ5B.mjs.map} +1 -1
  33. package/dist/{ShopScreen-CM3DDvLt.cjs → ShopScreen-BsfMjIPn.cjs} +21 -21
  34. package/dist/{ShopScreen-CM3DDvLt.cjs.map → ShopScreen-BsfMjIPn.cjs.map} +1 -1
  35. package/dist/{ShopScreen-BvSiWgsJ.mjs → ShopScreen-CKRSy_uk.mjs} +8 -8
  36. package/dist/{ShopScreen-Cz0dbkhp.cjs → ShopScreen-P7EazKlQ.cjs} +1 -1
  37. package/dist/{SubscriptionsScreen-DCUwHrdm.cjs → SubscriptionsScreen-BToWvdTh.cjs} +661 -252
  38. package/dist/SubscriptionsScreen-BToWvdTh.cjs.map +1 -0
  39. package/dist/{SubscriptionsScreen-rZxqb0eR.mjs → SubscriptionsScreen-CTGqV8gK.mjs} +567 -218
  40. package/dist/SubscriptionsScreen-CTGqV8gK.mjs.map +1 -0
  41. package/dist/{SubscriptionsScreen-BgKpfzi0.cjs → SubscriptionsScreen-DHTV7cFL.cjs} +1 -1
  42. package/dist/{TableWidget-CNCHDRrR.mjs → TableWidget-BtAfTNH_.mjs} +2 -2
  43. package/dist/{TableWidget-CNCHDRrR.mjs.map → TableWidget-BtAfTNH_.mjs.map} +1 -1
  44. package/dist/{ToDoWidget-C3lh-3SB.mjs → ToDoWidget-bn9bc_MO.mjs} +2 -2
  45. package/dist/{ToDoWidget-C3lh-3SB.mjs.map → ToDoWidget-bn9bc_MO.mjs.map} +1 -1
  46. package/dist/{UpgradeScreen-D_CM1n1M.mjs → UpgradeScreen-B-5QKZ_X.mjs} +2 -2
  47. package/dist/{UpgradeScreen-D_CM1n1M.mjs.map → UpgradeScreen-B-5QKZ_X.mjs.map} +1 -1
  48. package/dist/{components-D2h9u3tH.mjs → components-hloC7Tbu.mjs} +2 -2
  49. package/dist/{components-D2h9u3tH.mjs.map → components-hloC7Tbu.mjs.map} +1 -1
  50. package/dist/de-DGEv3Wj7.cjs +43 -0
  51. package/dist/de-DGEv3Wj7.cjs.map +1 -0
  52. package/dist/de-f_0MEvly.mjs +37 -0
  53. package/dist/de-f_0MEvly.mjs.map +1 -0
  54. package/dist/el-DBeHybzu.mjs +37 -0
  55. package/dist/el-DBeHybzu.mjs.map +1 -0
  56. package/dist/el-a-BUUyaN.cjs +43 -0
  57. package/dist/el-a-BUUyaN.cjs.map +1 -0
  58. package/dist/{es-C5dhBJ9E.mjs → es-B1tdcIoq.mjs} +2 -2
  59. package/dist/{es-C5dhBJ9E.mjs.map → es-B1tdcIoq.mjs.map} +1 -1
  60. package/dist/es-N-LjvJCS.cjs +43 -0
  61. package/dist/es-N-LjvJCS.cjs.map +1 -0
  62. package/dist/es-zRvcomm1.mjs +37 -0
  63. package/dist/es-zRvcomm1.mjs.map +1 -0
  64. package/dist/fr-CFggon_j.cjs +43 -0
  65. package/dist/fr-CFggon_j.cjs.map +1 -0
  66. package/dist/fr-DZ8hb7Li.mjs +37 -0
  67. package/dist/fr-DZ8hb7Li.mjs.map +1 -0
  68. package/dist/he-BXo3e9k9.mjs +37 -0
  69. package/dist/he-BXo3e9k9.mjs.map +1 -0
  70. package/dist/he-T4b_SIEg.cjs +43 -0
  71. package/dist/he-T4b_SIEg.cjs.map +1 -0
  72. package/dist/hu-C5uVO1Gi.cjs +43 -0
  73. package/dist/hu-C5uVO1Gi.cjs.map +1 -0
  74. package/dist/hu-DUbmD_v7.mjs +37 -0
  75. package/dist/hu-DUbmD_v7.mjs.map +1 -0
  76. package/dist/id-I8bH5NN_.mjs +37 -0
  77. package/dist/id-I8bH5NN_.mjs.map +1 -0
  78. package/dist/id-_R_sj2Zl.cjs +43 -0
  79. package/dist/id-_R_sj2Zl.cjs.map +1 -0
  80. package/dist/index.cjs +9 -9
  81. package/dist/index.mjs +39 -39
  82. package/dist/{format-CLUjV1oR.cjs → isAfter-DXdeICis.cjs} +80 -1
  83. package/dist/isAfter-DXdeICis.cjs.map +1 -0
  84. package/dist/it-BMvqaIb9.cjs +43 -0
  85. package/dist/it-BMvqaIb9.cjs.map +1 -0
  86. package/dist/it-D3Jf5QRi.mjs +37 -0
  87. package/dist/it-D3Jf5QRi.mjs.map +1 -0
  88. package/dist/ja-9CIQCExk.mjs +37 -0
  89. package/dist/ja-9CIQCExk.mjs.map +1 -0
  90. package/dist/ja-DBbelgna.cjs +43 -0
  91. package/dist/ja-DBbelgna.cjs.map +1 -0
  92. package/dist/ko-Bw-gMUu6.mjs +37 -0
  93. package/dist/ko-Bw-gMUu6.mjs.map +1 -0
  94. package/dist/ko-C0Tajaz1.cjs +43 -0
  95. package/dist/ko-C0Tajaz1.cjs.map +1 -0
  96. package/dist/nl-B89YTYeT.cjs +43 -0
  97. package/dist/nl-B89YTYeT.cjs.map +1 -0
  98. package/dist/nl-DDGMf5eH.mjs +37 -0
  99. package/dist/nl-DDGMf5eH.mjs.map +1 -0
  100. package/dist/{order-status-badge-CjX7Qxdk.mjs → order-status-badge-CKLegNhv.mjs} +4 -4
  101. package/dist/{order-status-badge-CjX7Qxdk.mjs.map → order-status-badge-CKLegNhv.mjs.map} +1 -1
  102. package/dist/pl--xhIwSlw.cjs +43 -0
  103. package/dist/pl--xhIwSlw.cjs.map +1 -0
  104. package/dist/pl-CdZlOTsS.mjs +37 -0
  105. package/dist/pl-CdZlOTsS.mjs.map +1 -0
  106. package/dist/pt-BdKQZfRo.mjs +37 -0
  107. package/dist/pt-BdKQZfRo.mjs.map +1 -0
  108. package/dist/pt-Cfp_A3CX.cjs +43 -0
  109. package/dist/pt-Cfp_A3CX.cjs.map +1 -0
  110. package/dist/ro-DnAztrxY.mjs +37 -0
  111. package/dist/ro-DnAztrxY.mjs.map +1 -0
  112. package/dist/ro-Qp0OJAI0.cjs +43 -0
  113. package/dist/ro-Qp0OJAI0.cjs.map +1 -0
  114. package/dist/ru-BkBpELbx.mjs +37 -0
  115. package/dist/ru-BkBpELbx.mjs.map +1 -0
  116. package/dist/ru-CY41Fh7R.cjs +43 -0
  117. package/dist/ru-CY41Fh7R.cjs.map +1 -0
  118. package/dist/{src-KINQ78Nj.mjs → src-jSFuc4IV.mjs} +2 -2
  119. package/dist/{src-KINQ78Nj.mjs.map → src-jSFuc4IV.mjs.map} +1 -1
  120. package/dist/th--13cvzk3.cjs +43 -0
  121. package/dist/th--13cvzk3.cjs.map +1 -0
  122. package/dist/th-B4QOqrXn.mjs +37 -0
  123. package/dist/th-B4QOqrXn.mjs.map +1 -0
  124. package/dist/tl-CEypklNf.mjs +37 -0
  125. package/dist/tl-CEypklNf.mjs.map +1 -0
  126. package/dist/tl-CaqI-eLl.cjs +43 -0
  127. package/dist/tl-CaqI-eLl.cjs.map +1 -0
  128. package/dist/tr-BzJ5aLBX.cjs +43 -0
  129. package/dist/tr-BzJ5aLBX.cjs.map +1 -0
  130. package/dist/tr-DUrLeX63.mjs +37 -0
  131. package/dist/tr-DUrLeX63.mjs.map +1 -0
  132. package/dist/zh_CN-2xAokYb4.cjs +43 -0
  133. package/dist/zh_CN-2xAokYb4.cjs.map +1 -0
  134. package/dist/zh_CN-Bhfuxe7w.mjs +37 -0
  135. package/dist/zh_CN-Bhfuxe7w.mjs.map +1 -0
  136. package/dist/zh_TW-B9XT91CL.cjs +43 -0
  137. package/dist/zh_TW-B9XT91CL.cjs.map +1 -0
  138. package/dist/zh_TW-DR3xhpLa.mjs +37 -0
  139. package/dist/zh_TW-DR3xhpLa.mjs.map +1 -0
  140. package/package.json +14 -14
  141. package/dist/MessagingScreen-DeYSVcMd.cjs.map +0 -1
  142. package/dist/SubscriptionsScreen-DCUwHrdm.cjs.map +0 -1
  143. package/dist/SubscriptionsScreen-rZxqb0eR.mjs.map +0 -1
  144. package/dist/de-CH__cDep.mjs +0 -6
  145. package/dist/de-CH__cDep.mjs.map +0 -1
  146. package/dist/de-CqKH8kwp.cjs +0 -12
  147. package/dist/de-CqKH8kwp.cjs.map +0 -1
  148. package/dist/el-CIrAhB-W.cjs +0 -12
  149. package/dist/el-CIrAhB-W.cjs.map +0 -1
  150. package/dist/el-De9QZiqh.mjs +0 -6
  151. package/dist/el-De9QZiqh.mjs.map +0 -1
  152. package/dist/es-4Wsa13tV.cjs +0 -12
  153. package/dist/es-4Wsa13tV.cjs.map +0 -1
  154. package/dist/es-CZLh7tET.mjs +0 -6
  155. package/dist/es-CZLh7tET.mjs.map +0 -1
  156. package/dist/format-CLUjV1oR.cjs.map +0 -1
  157. package/dist/fr-BDKPrKKW.cjs +0 -12
  158. package/dist/fr-BDKPrKKW.cjs.map +0 -1
  159. package/dist/fr-CIfM_0kG.mjs +0 -6
  160. package/dist/fr-CIfM_0kG.mjs.map +0 -1
  161. package/dist/he-5dq6lV2h.cjs +0 -12
  162. package/dist/he-5dq6lV2h.cjs.map +0 -1
  163. package/dist/he-BTK1iEJE.mjs +0 -6
  164. package/dist/he-BTK1iEJE.mjs.map +0 -1
  165. package/dist/hu-CrZGIbz9.mjs +0 -6
  166. package/dist/hu-CrZGIbz9.mjs.map +0 -1
  167. package/dist/hu-Dpgriy5N.cjs +0 -12
  168. package/dist/hu-Dpgriy5N.cjs.map +0 -1
  169. package/dist/id-B-LeCfHj.mjs +0 -6
  170. package/dist/id-B-LeCfHj.mjs.map +0 -1
  171. package/dist/id-Ba-0RT7y.cjs +0 -12
  172. package/dist/id-Ba-0RT7y.cjs.map +0 -1
  173. package/dist/it-CaxIV-R4.cjs +0 -12
  174. package/dist/it-CaxIV-R4.cjs.map +0 -1
  175. package/dist/it-rIkFmAF3.mjs +0 -6
  176. package/dist/it-rIkFmAF3.mjs.map +0 -1
  177. package/dist/ja--J_bhk3I.mjs +0 -6
  178. package/dist/ja--J_bhk3I.mjs.map +0 -1
  179. package/dist/ja-Lcg_Qqtj.cjs +0 -12
  180. package/dist/ja-Lcg_Qqtj.cjs.map +0 -1
  181. package/dist/ko-B2fghWQ9.mjs +0 -6
  182. package/dist/ko-B2fghWQ9.mjs.map +0 -1
  183. package/dist/ko-CFu0TjJO.cjs +0 -12
  184. package/dist/ko-CFu0TjJO.cjs.map +0 -1
  185. package/dist/nl-DR9IRXGT.cjs +0 -12
  186. package/dist/nl-DR9IRXGT.cjs.map +0 -1
  187. package/dist/nl-KgHmrRKy.mjs +0 -6
  188. package/dist/nl-KgHmrRKy.mjs.map +0 -1
  189. package/dist/pl-BJvDPvs3.mjs +0 -6
  190. package/dist/pl-BJvDPvs3.mjs.map +0 -1
  191. package/dist/pl-DSGSRDM2.cjs +0 -12
  192. package/dist/pl-DSGSRDM2.cjs.map +0 -1
  193. package/dist/pt-CmZpxftX.mjs +0 -6
  194. package/dist/pt-CmZpxftX.mjs.map +0 -1
  195. package/dist/pt-Pz_D1HUz.cjs +0 -12
  196. package/dist/pt-Pz_D1HUz.cjs.map +0 -1
  197. package/dist/ro-BoGeZTac.cjs +0 -12
  198. package/dist/ro-BoGeZTac.cjs.map +0 -1
  199. package/dist/ro-C_4rHVWp.mjs +0 -6
  200. package/dist/ro-C_4rHVWp.mjs.map +0 -1
  201. package/dist/ru-B0lzoBye.mjs +0 -6
  202. package/dist/ru-B0lzoBye.mjs.map +0 -1
  203. package/dist/ru-Cd7LUmcu.cjs +0 -12
  204. package/dist/ru-Cd7LUmcu.cjs.map +0 -1
  205. package/dist/th-DwLAQd0u.cjs +0 -12
  206. package/dist/th-DwLAQd0u.cjs.map +0 -1
  207. package/dist/th-QhoPGZ6C.mjs +0 -6
  208. package/dist/th-QhoPGZ6C.mjs.map +0 -1
  209. package/dist/tl-Dsfp243U.mjs +0 -6
  210. package/dist/tl-Dsfp243U.mjs.map +0 -1
  211. package/dist/tl-DwAVpDyB.cjs +0 -12
  212. package/dist/tl-DwAVpDyB.cjs.map +0 -1
  213. package/dist/tr-BFbCmHQZ.cjs +0 -12
  214. package/dist/tr-BFbCmHQZ.cjs.map +0 -1
  215. package/dist/tr-BiolaqkO.mjs +0 -6
  216. package/dist/tr-BiolaqkO.mjs.map +0 -1
  217. package/dist/zh_CN-Cn-k18Y5.cjs +0 -12
  218. package/dist/zh_CN-Cn-k18Y5.cjs.map +0 -1
  219. package/dist/zh_CN-DcGf3QsR.mjs +0 -6
  220. package/dist/zh_CN-DcGf3QsR.mjs.map +0 -1
  221. package/dist/zh_TW-CIUhIeJP.cjs +0 -12
  222. package/dist/zh_TW-CIUhIeJP.cjs.map +0 -1
  223. package/dist/zh_TW-DFw2O0OX.mjs +0 -6
  224. package/dist/zh_TW-DFw2O0OX.mjs.map +0 -1
@@ -3,19 +3,19 @@ import { i as usePayApi } from "./api-context-3GmfqvIB.mjs";
3
3
  import { n as useCountriesApi } from "./countries-api-context-CMh13cfX.mjs";
4
4
  import { C as subscriptions_reactivate, D as subscriptions_update, E as subscriptions_skip, S as subscriptions_pause, T as subscriptions_show, b as subscriptions_cancel, w as subscriptions_resume, x as subscriptions_list } from "./portal_tenant-Q3x7ALaZ.mjs";
5
5
  import { n as usePortalTenantClient } from "./PortalTenantClientProvider-Bni6J3KS.mjs";
6
- import { $t as startOfISOWeek, An as Accordion, Bt as warnOrThrowProtectedError, C as Skeleton, Cn as AlertDialogDescription, Dn as Button, En as AlertDialogTitle, Fn as cn$1, Gt as enUS, Ht as getWeek, K as Label, L as Input, Lt as format, Mn as AccordionItem, Mt as Calendar$1, Nn as AccordionTrigger, Qt as getTimezoneOffsetInMilliseconds, Rt as isProtectedDayOfYearToken, Sn as AlertDialogContent, Tn as AlertDialogHeader, Ut as getWeekYear, Vt as longFormatters, Wt as getISOWeek, a as ToggleGroup, an as constructFrom, b as fluidToast, bn as AlertDialogAction, cn as millisecondsInSecond, ct as DialogFooter, d as Table$1, dn as BreadcrumbLink, en as startOfWeek, f as TableBody, fn as BreadcrumbList, ft as DialogTitle, g as TableRow, h as TableHeader, ht as PopoverTrigger, in as toDate, it as Dialog, jn as AccordionContent, ln as Breadcrumb, lt as DialogHeader, mn as BreadcrumbSeparator, mt as PopoverContent, o as ToggleGroupItem, on as millisecondsInHour, ot as DialogContent, p as TableCell, pn as BreadcrumbPage, pt as Popover, rn as addDays, sn as millisecondsInMinute, tn as getDefaultOptions$1, un as BreadcrumbItem, wn as AlertDialogFooter, xn as AlertDialogCancel, yn as AlertDialog, zt as isProtectedWeekYearToken } from "./src-KINQ78Nj.mjs";
6
+ import { A as Select, Bt as warnOrThrowProtectedError, C as Skeleton, Cn as AlertDialogCancel, Dn as AlertDialogHeader, En as AlertDialogFooter, Fn as AccordionTrigger, Gt as enUS, Ht as getWeek, It as isAfter, K as Label, L as Input, Ln as cn$1, Lt as format, M as SelectItem, Mn as Accordion, Mt as Calendar$1, N as SelectTrigger, Nn as AccordionContent, On as AlertDialogTitle, P as SelectValue, Pn as AccordionItem, Rt as isProtectedDayOfYearToken, Tn as AlertDialogDescription, Ut as getWeekYear, Vt as longFormatters, Wt as getISOWeek, Xt as addWeeks, Yt as addYears, a as ToggleGroup, an as addDays, b as fluidToast, cn as millisecondsInHour, ct as DialogFooter, d as Table$1, dn as Breadcrumb, en as getTimezoneOffsetInMilliseconds, f as TableBody, fn as BreadcrumbItem, ft as DialogTitle, g as TableRow, gn as BreadcrumbSeparator, h as TableHeader, hn as BreadcrumbPage, ht as PopoverTrigger, in as addMonths, it as Dialog, j as SelectContent, kn as Button, ln as millisecondsInMinute, lt as DialogHeader, mn as BreadcrumbList, mt as PopoverContent, nn as startOfWeek, o as ToggleGroupItem, on as toDate, ot as DialogContent, p as TableCell, pn as BreadcrumbLink, pt as Popover, rn as getDefaultOptions$1, sn as constructFrom, tn as startOfISOWeek, un as millisecondsInSecond, wn as AlertDialogContent, xn as AlertDialog, zt as isProtectedWeekYearToken } from "./src-jSFuc4IV.mjs";
7
7
  import { r as useScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-4WYXIqQ5.mjs";
8
8
  import { n as payKeys, r as storeKeys } from "./query-keys-DXle2tm8.mjs";
9
9
  import { t as useAccount } from "./use-account-CGaDP8xd.mjs";
10
10
  import { n as useAppNavigation } from "./AppNavigationContext-BcZZMtV6.mjs";
11
- import { f as PaymentIcon, h as FluidPayCoreProvider, i as CreditCardFormDialog, m as getCardExpiry, n as createFluidPayApiAdapter, p as getCardDisplayName, r as mapToFluidPayPaymentMethod, t as AddressAutocompleteInput } from "./AddressAutocompleteInput-B0qLrCHN.mjs";
12
- import { t as SearchSort } from "./SearchSort-B5Jrk5lW.mjs";
13
- import { t as InfiniteScrollSentinel } from "./InfiniteScrollSentinel-BHIgNtHI.mjs";
14
- import { r as TableColumn } from "./order-status-badge-CjX7Qxdk.mjs";
11
+ import { f as PaymentIcon, h as FluidPayCoreProvider, i as CreditCardFormDialog, m as getCardExpiry, n as createFluidPayApiAdapter, p as getCardDisplayName, r as mapToFluidPayPaymentMethod, t as AddressAutocompleteInput } from "./AddressAutocompleteInput-Bdsv2iFU.mjs";
12
+ import { t as SearchSort } from "./SearchSort-CnUiCGu2.mjs";
13
+ import { t as InfiniteScrollSentinel } from "./InfiniteScrollSentinel-Dq--_LMC.mjs";
14
+ import { r as TableColumn } from "./order-status-badge-CKLegNhv.mjs";
15
15
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
16
16
  import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
17
17
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
18
- import { CalendarIcon, Pause, Play, RotateCcw, SkipForward, XCircle } from "lucide-react";
18
+ import { CalendarDays, CalendarIcon, ChevronLeft, ChevronRight, Pause, Play, RotateCcw, SkipForward, XCircle } from "lucide-react";
19
19
  import { clsx } from "clsx";
20
20
  import { twMerge } from "tailwind-merge";
21
21
  //#region ../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDefaultOptions.js
@@ -2109,6 +2109,16 @@ const subscriptionsKeys = {
2109
2109
  ]
2110
2110
  };
2111
2111
  //#endregion
2112
+ //#region ../../subscriptions/core/src/hooks/use-subscriptions.ts
2113
+ function useSubscriptions(params, options) {
2114
+ const api = useSubscriptionsApi();
2115
+ return useQuery({
2116
+ queryKey: subscriptionsKeys.list(params),
2117
+ queryFn: () => api.fetchCustomerSubscriptions(params),
2118
+ enabled: options?.enabled ?? !!params.customerId
2119
+ });
2120
+ }
2121
+ //#endregion
2112
2122
  //#region ../../subscriptions/core/src/hooks/use-infinite-subscriptions.ts
2113
2123
  function useInfiniteSubscriptions(params, options) {
2114
2124
  const api = useSubscriptionsApi();
@@ -2636,6 +2646,7 @@ function createPortalSubscriptionsAdapter(client) {
2636
2646
  const subscription = {};
2637
2647
  if (body.payment_method_id != null) subscription.payment_method_id = body.payment_method_id;
2638
2648
  if (body.quantity != null) subscription.quantity = body.quantity;
2649
+ if (body.next_bill_date != null) subscription.next_bill_date = body.next_bill_date;
2639
2650
  return mapSubscriptionDetail(await subscriptions_update(client, subscriptionToken, { subscription }));
2640
2651
  }
2641
2652
  };
@@ -3001,92 +3012,127 @@ function SubscriptionsListScreen({ customerId, isLoadingCustomer }) {
3001
3012
  });
3002
3013
  }
3003
3014
  //#endregion
3004
- //#region ../../subscriptions/ui/src/components/confirm-dialog.tsx
3005
- function ConfirmDialog({ title, description, actionButtonText = "Delete", cancelButtonText = "Cancel", open, setOpen, onConfirm }) {
3015
+ //#region ../../subscriptions/ui/src/components/cancel-subscription-dialog.tsx
3016
+ const PAUSE_MONTH_OPTIONS = [
3017
+ 1,
3018
+ 2,
3019
+ 3
3020
+ ];
3021
+ function CancelSubscriptionDialog({ open, onOpenChange, onConfirm, onPauseInstead, errorMessage, title = "Cancel Subscription", description = "Are you sure you want to cancel this subscription? You can reactivate it later.", pauseQuestion = "Would you like to pause your subscription instead?", pauseButtonText = "Pause Subscription", cancelButtonText = "Cancel", actionButtonText = "Cancel Subscription" }) {
3006
3022
  const [isPending, setIsPending] = useState(false);
3023
+ const [selectedMonths, setSelectedMonths] = useState(null);
3024
+ useEffect(() => {
3025
+ if (!open) setSelectedMonths(null);
3026
+ }, [open]);
3007
3027
  const handleConfirm = async () => {
3028
+ const result = onConfirm();
3029
+ if (!(result instanceof Promise)) {
3030
+ onOpenChange(false);
3031
+ return;
3032
+ }
3033
+ setIsPending(true);
3008
3034
  try {
3009
- const result = onConfirm();
3010
- if (result instanceof Promise) {
3011
- setIsPending(true);
3012
- await result;
3013
- }
3035
+ await result;
3036
+ onOpenChange(false);
3014
3037
  } catch (error) {
3015
- console.error("ConfirmDialog: action rejected", error);
3038
+ console.error("CancelSubscriptionDialog: action rejected", error);
3016
3039
  } finally {
3017
3040
  setIsPending(false);
3018
- setOpen(false);
3019
3041
  }
3020
3042
  };
3043
+ const handlePause = () => {
3044
+ if (!selectedMonths) return;
3045
+ onPauseInstead(selectedMonths);
3046
+ };
3021
3047
  return /* @__PURE__ */ jsx(AlertDialog, {
3022
3048
  open,
3023
- onOpenChange: (v) => !isPending && setOpen(v),
3024
- children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: title }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: description })] }), /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [/* @__PURE__ */ jsx(AlertDialogCancel, {
3025
- disabled: isPending,
3026
- children: cancelButtonText
3027
- }), /* @__PURE__ */ jsx(AlertDialogAction, {
3028
- onClick: handleConfirm,
3029
- disabled: isPending,
3030
- className: "bg-red-600 text-white hover:bg-red-500",
3031
- children: isPending ? "..." : actionButtonText
3032
- })] })] })
3049
+ onOpenChange: (v) => !isPending && onOpenChange(v),
3050
+ children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
3051
+ /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [/* @__PURE__ */ jsx(AlertDialogTitle, { children: title }), /* @__PURE__ */ jsx(AlertDialogDescription, { children: description })] }),
3052
+ /* @__PURE__ */ jsxs("div", {
3053
+ className: "border-border space-y-2 rounded-md border p-3",
3054
+ children: [
3055
+ /* @__PURE__ */ jsx("p", {
3056
+ className: "text-foreground text-sm font-medium",
3057
+ children: pauseQuestion
3058
+ }),
3059
+ /* @__PURE__ */ jsx(Label, {
3060
+ htmlFor: "cancel-pause-months",
3061
+ className: "text-foreground text-sm font-semibold",
3062
+ children: "Pause for"
3063
+ }),
3064
+ /* @__PURE__ */ jsxs(Select, {
3065
+ value: selectedMonths ? String(selectedMonths) : void 0,
3066
+ onValueChange: (value) => setSelectedMonths(value ? Number(value) : null),
3067
+ disabled: isPending,
3068
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
3069
+ id: "cancel-pause-months",
3070
+ className: "w-full",
3071
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select duration" })
3072
+ }), /* @__PURE__ */ jsx(SelectContent, { children: PAUSE_MONTH_OPTIONS.map((months) => /* @__PURE__ */ jsxs(SelectItem, {
3073
+ value: String(months),
3074
+ children: [
3075
+ months,
3076
+ " ",
3077
+ months === 1 ? "month" : "months"
3078
+ ]
3079
+ }, months)) })]
3080
+ }),
3081
+ /* @__PURE__ */ jsx(Button, {
3082
+ variant: "outline",
3083
+ onClick: handlePause,
3084
+ disabled: isPending || !selectedMonths,
3085
+ className: "w-full",
3086
+ children: pauseButtonText
3087
+ })
3088
+ ]
3089
+ }),
3090
+ errorMessage && /* @__PURE__ */ jsx("p", {
3091
+ className: "text-destructive text-left text-sm",
3092
+ children: errorMessage
3093
+ }),
3094
+ /* @__PURE__ */ jsxs(AlertDialogFooter, {
3095
+ className: "flex-col gap-2 sm:flex-row sm:justify-end",
3096
+ children: [/* @__PURE__ */ jsx(AlertDialogCancel, {
3097
+ disabled: isPending,
3098
+ children: cancelButtonText
3099
+ }), /* @__PURE__ */ jsx(Button, {
3100
+ variant: "destructive",
3101
+ onClick: handleConfirm,
3102
+ disabled: isPending,
3103
+ autoFocus: true,
3104
+ children: isPending ? "..." : actionButtonText
3105
+ })]
3106
+ })
3107
+ ] })
3033
3108
  });
3034
3109
  }
3035
3110
  //#endregion
3036
- //#region ../../subscriptions/ui/src/lib/parse-iso-date.ts
3037
- const ISO_DATE = "yyyy-MM-dd";
3038
- /**
3039
- * Parse an ISO date string as local midnight. Accepts either a bare
3040
- * "yyyy-MM-dd" or a full ISO timestamp — both are sliced to the date
3041
- * portion first so the result lands on the intended calendar day
3042
- * regardless of the viewer's timezone.
3043
- */
3044
- function parseIsoDate(value) {
3045
- return parse(value.slice(0, 10), ISO_DATE, /* @__PURE__ */ new Date());
3046
- }
3047
- //#endregion
3048
3111
  //#region ../../subscriptions/ui/src/components/pause-subscription-dialog.tsx
3049
3112
  function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, billingInterval = 1, billingIntervalUnit = "month", title = "Pause subscription", description = "Are you sure you want to pause subscription?", actionText = "Pause" }) {
3050
- const [pauseType, setPauseType] = useState("specific");
3051
- const [selectedDate, setSelectedDate] = useState(void 0);
3052
- const [calendarOpen, setCalendarOpen] = useState(false);
3113
+ const [pauseType, setPauseType] = useState("indefinite");
3053
3114
  const [selectedOrderCount, setSelectedOrderCount] = useState(null);
3054
- const today = /* @__PURE__ */ new Date();
3055
- today.setHours(0, 0, 0, 0);
3056
- const minDate = addDays(today, 1);
3057
3115
  const orderCountOptions = Array.from({ length: 99 }, (_, i) => i + 1);
3058
3116
  const calculatedResumeDate = selectedOrderCount && currentNextBillDate ? calculateResumeDate(billingInterval, billingIntervalUnit, selectedOrderCount, currentNextBillDate) : null;
3059
3117
  useEffect(() => {
3060
3118
  if (!open) return;
3061
- setPauseType("specific");
3119
+ setPauseType("indefinite");
3062
3120
  setSelectedOrderCount(null);
3063
- if (currentNextBillDate) {
3064
- const initial = parseIsoDate(currentNextBillDate);
3065
- setSelectedDate(initial < minDate ? minDate : initial);
3066
- } else setSelectedDate(void 0);
3067
- }, [open, currentNextBillDate]);
3121
+ }, [open]);
3068
3122
  const handleConfirm = () => {
3069
3123
  if (pauseType === "indefinite") {
3070
3124
  onConfirm({ type: "indefinite" });
3071
3125
  return;
3072
3126
  }
3073
- if (pauseType === "order_count" && selectedOrderCount) {
3074
- onConfirm({
3075
- type: "order_count",
3076
- numberOfOrders: selectedOrderCount
3077
- });
3078
- return;
3079
- }
3080
- if (pauseType === "specific" && selectedDate) onConfirm({
3081
- type: "specific",
3082
- nextBillDate: format(selectedDate, "yyyy-MM-dd")
3127
+ if (pauseType === "order_count" && selectedOrderCount) onConfirm({
3128
+ type: "order_count",
3129
+ numberOfOrders: selectedOrderCount
3083
3130
  });
3084
3131
  };
3085
3132
  const handleDismiss = (next) => {
3086
3133
  if (!next) {
3087
- setPauseType("specific");
3134
+ setPauseType("indefinite");
3088
3135
  setSelectedOrderCount(null);
3089
- setSelectedDate(void 0);
3090
3136
  }
3091
3137
  onOpenChange(next);
3092
3138
  };
@@ -3096,29 +3142,24 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
3096
3142
  /* @__PURE__ */ jsx("strong", { children: "Resume" }),
3097
3143
  " from your account."
3098
3144
  ] });
3099
- if (pauseType === "order_count" && !selectedOrderCount) return null;
3100
- let displayDate;
3101
- if (pauseType === "order_count" && calculatedResumeDate) displayDate = format(calculatedResumeDate, "MMMM d, yyyy");
3102
- else if (pauseType === "specific" && selectedDate) displayDate = format(selectedDate, "MMMM d, yyyy");
3103
- else if (currentNextBillDate) displayDate = format(parseIsoDate(currentNextBillDate), "MMMM d, yyyy");
3104
- else displayDate = "a future date";
3145
+ if (!selectedOrderCount) return null;
3105
3146
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3106
3147
  "You won't be charged until your subscription resumes on",
3107
3148
  " ",
3108
3149
  /* @__PURE__ */ jsx("span", {
3109
3150
  className: "font-semibold",
3110
- children: displayDate
3151
+ children: calculatedResumeDate ? format(calculatedResumeDate, "MMMM d, yyyy") : "a future date"
3111
3152
  }),
3112
3153
  "."
3113
3154
  ] });
3114
3155
  })();
3115
- const isActionDisabled = pauseType === "specific" && !selectedDate || pauseType === "order_count" && !selectedOrderCount;
3156
+ const isActionDisabled = pauseType === "order_count" && !selectedOrderCount;
3116
3157
  return /* @__PURE__ */ jsx(Dialog, {
3117
3158
  open,
3118
3159
  onOpenChange: handleDismiss,
3119
3160
  children: /* @__PURE__ */ jsxs(DialogContent, {
3120
3161
  "aria-describedby": "pause-subscription-dialog-description",
3121
- className: "max-w-sm rounded md:w-90",
3162
+ className: "rounded",
3122
3163
  children: [
3123
3164
  /* @__PURE__ */ jsx(DialogHeader, {
3124
3165
  className: "flex flex-row justify-between",
@@ -3185,57 +3226,6 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
3185
3226
  })]
3186
3227
  })]
3187
3228
  }),
3188
- /* @__PURE__ */ jsxs("div", {
3189
- className: "space-y-2",
3190
- children: [/* @__PURE__ */ jsxs("div", {
3191
- className: "flex items-center space-x-2",
3192
- children: [/* @__PURE__ */ jsx("input", {
3193
- id: "pause-until-date",
3194
- type: "radio",
3195
- checked: pauseType === "specific",
3196
- onChange: () => setPauseType("specific"),
3197
- className: "border-border accent-primary h-4 w-4 focus:ring-0"
3198
- }), /* @__PURE__ */ jsx(Label, {
3199
- htmlFor: "pause-until-date",
3200
- className: "text-foreground cursor-pointer text-sm font-medium",
3201
- children: "Pause until a specific date"
3202
- })]
3203
- }), pauseType === "specific" && /* @__PURE__ */ jsx("div", {
3204
- className: "ml-6",
3205
- children: /* @__PURE__ */ jsxs(Popover, {
3206
- open: calendarOpen,
3207
- onOpenChange: setCalendarOpen,
3208
- children: [/* @__PURE__ */ jsx(PopoverTrigger, {
3209
- asChild: true,
3210
- children: /* @__PURE__ */ jsxs(Button, {
3211
- variant: "outline",
3212
- className: cn$1("border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground h-9 w-full justify-start border px-3 py-2 text-left font-normal", !selectedDate && "text-muted-foreground hover:text-muted-foreground"),
3213
- children: [selectedDate ? format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "mm/dd/yyyy" }), /* @__PURE__ */ jsx(CalendarIcon, { className: "text-muted-foreground ml-auto h-4 w-4" })]
3214
- })
3215
- }), /* @__PURE__ */ jsx(PopoverContent, {
3216
- className: "bg-popover w-auto rounded-md border p-0 shadow-lg",
3217
- align: "start",
3218
- sideOffset: 4,
3219
- style: { zIndex: 9999 },
3220
- children: /* @__PURE__ */ jsx(Calendar$1, {
3221
- mode: "single",
3222
- selected: selectedDate,
3223
- onSelect: (date) => {
3224
- setSelectedDate(date);
3225
- setCalendarOpen(false);
3226
- },
3227
- disabled: (date) => date < minDate,
3228
- defaultMonth: selectedDate ?? (currentNextBillDate ? parseIsoDate(currentNextBillDate) : void 0),
3229
- modifiersStyles: { selected: {
3230
- backgroundColor: "var(--primary)",
3231
- color: "var(--primary-foreground)"
3232
- } },
3233
- initialFocus: true
3234
- })
3235
- })]
3236
- })
3237
- })]
3238
- }),
3239
3229
  statusMessage && /* @__PURE__ */ jsx("div", {
3240
3230
  className: "text-muted-foreground text-xs",
3241
3231
  children: statusMessage
@@ -3250,12 +3240,13 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
3250
3240
  /* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsxs("div", {
3251
3241
  className: "flex w-full flex-row justify-between space-x-2",
3252
3242
  children: [/* @__PURE__ */ jsx(Button, {
3253
- className: "bg-muted text-foreground ring-border hover:bg-muted/80 h-10 min-w-[70px] rounded p-3 ring-1",
3243
+ variant: "outline",
3244
+ className: "h-10 min-w-[70px] rounded p-3",
3254
3245
  onClick: () => handleDismiss(false),
3255
3246
  children: "Cancel"
3256
3247
  }), /* @__PURE__ */ jsx(Button, {
3257
3248
  type: "button",
3258
- className: "bg-primary text-primary-foreground h-10 min-w-[70px] rounded p-3 hover:opacity-90 disabled:opacity-50",
3249
+ className: "h-10 min-w-[70px] rounded p-3",
3259
3250
  onClick: handleConfirm,
3260
3251
  disabled: isActionDisabled || isLoading,
3261
3252
  children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) : actionText
@@ -3266,6 +3257,18 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
3266
3257
  });
3267
3258
  }
3268
3259
  //#endregion
3260
+ //#region ../../subscriptions/ui/src/lib/parse-iso-date.ts
3261
+ const ISO_DATE = "yyyy-MM-dd";
3262
+ /**
3263
+ * Parse an ISO date string as local midnight. Accepts either a bare
3264
+ * "yyyy-MM-dd" or a full ISO timestamp — both are sliced to the date
3265
+ * portion first so the result lands on the intended calendar day
3266
+ * regardless of the viewer's timezone.
3267
+ */
3268
+ function parseIsoDate(value) {
3269
+ return parse(value.slice(0, 10), ISO_DATE, /* @__PURE__ */ new Date());
3270
+ }
3271
+ //#endregion
3269
3272
  //#region ../../subscriptions/ui/src/components/resume-subscription-dialog.tsx
3270
3273
  function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, defaultNextBillDate, title = "Resume subscription", description = "Choose the date your subscription should resume.", actionText = "Resume" }) {
3271
3274
  const [selectedDate, setSelectedDate] = useState(void 0);
@@ -3293,7 +3296,7 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
3293
3296
  onOpenChange: handleDismiss,
3294
3297
  children: /* @__PURE__ */ jsxs(DialogContent, {
3295
3298
  "aria-describedby": "resume-subscription-dialog-description",
3296
- className: "max-w-sm rounded md:w-90",
3299
+ className: "rounded",
3297
3300
  children: [
3298
3301
  /* @__PURE__ */ jsx(DialogHeader, {
3299
3302
  className: "flex flex-row justify-between",
@@ -3385,6 +3388,255 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
3385
3388
  });
3386
3389
  }
3387
3390
  //#endregion
3391
+ //#region ../../subscriptions/ui/src/components/edit-bill-date-dialog.tsx
3392
+ function advanceByInterval(date, interval, unit) {
3393
+ const step = Math.max(1, interval);
3394
+ switch (unit.toLowerCase()) {
3395
+ case "day": return addDays(date, step);
3396
+ case "week": return addWeeks(date, step);
3397
+ case "year": return addYears(date, step);
3398
+ default: return addMonths(date, step);
3399
+ }
3400
+ }
3401
+ const SUBSCRIPTION_COLORS = [
3402
+ "#3b82f6",
3403
+ "#f97316",
3404
+ "#10b981",
3405
+ "#a855f7",
3406
+ "#ec4899",
3407
+ "#eab308",
3408
+ "#14b8a6",
3409
+ "#ef4444",
3410
+ "#0ea5e9",
3411
+ "#84cc16"
3412
+ ];
3413
+ const MAX_PROJECTIONS_PER_SUB = 104;
3414
+ function EditBillDateDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, currentNextBillDate, otherSubscriptions, onNavigateToSubscription, title = "Edit bill date", description = "Select a new date for your next bill.", actionText = "Save" }) {
3415
+ const [selectedDate, setSelectedDate] = useState(void 0);
3416
+ const [calendarOpen, setCalendarOpen] = useState(false);
3417
+ const today = /* @__PURE__ */ new Date();
3418
+ today.setHours(0, 0, 0, 0);
3419
+ const minDate = addDays(today, 1);
3420
+ const subscriptionsWithColor = useMemo(() => (otherSubscriptions ?? []).map((sub, idx) => ({
3421
+ ...sub,
3422
+ color: SUBSCRIPTION_COLORS[idx % SUBSCRIPTION_COLORS.length]
3423
+ })), [otherSubscriptions]);
3424
+ const billingColorsByDate = useMemo(() => {
3425
+ const m = /* @__PURE__ */ new Map();
3426
+ const horizon = addYears(/* @__PURE__ */ new Date(), 2);
3427
+ for (const sub of subscriptionsWithColor) {
3428
+ if (!sub.nextBillDate) continue;
3429
+ let d = parseIsoDate(sub.nextBillDate);
3430
+ let count = 0;
3431
+ while (!isAfter(d, horizon) && count < MAX_PROJECTIONS_PER_SUB) {
3432
+ const key = format(d, "yyyy-MM-dd");
3433
+ const arr = m.get(key) ?? [];
3434
+ arr.push(sub.color);
3435
+ m.set(key, arr);
3436
+ d = advanceByInterval(d, sub.billingInterval, sub.billingIntervalUnit);
3437
+ count++;
3438
+ }
3439
+ }
3440
+ return m;
3441
+ }, [subscriptionsWithColor]);
3442
+ const calendarComponents = useMemo(() => ({
3443
+ DayContent: ({ date }) => {
3444
+ const key = format(date, "yyyy-MM-dd");
3445
+ const colors = billingColorsByDate.get(key) ?? [];
3446
+ return /* @__PURE__ */ jsxs("div", {
3447
+ className: "flex h-full w-full flex-col items-center justify-center",
3448
+ children: [/* @__PURE__ */ jsx("span", {
3449
+ className: "leading-none",
3450
+ children: date.getDate()
3451
+ }), colors.length > 0 && /* @__PURE__ */ jsx("div", {
3452
+ className: "mt-0.5 flex items-center justify-center gap-0.5",
3453
+ children: colors.map((c, i) => /* @__PURE__ */ jsx("span", {
3454
+ className: "h-1 w-1 rounded-[1px]",
3455
+ style: { backgroundColor: c }
3456
+ }, `${key}-${i}`))
3457
+ })]
3458
+ });
3459
+ },
3460
+ IconLeft: ({ className: iconClassName, ...iconProps }) => /* @__PURE__ */ jsx(ChevronLeft, {
3461
+ className: cn$1("h-4 w-4", iconClassName),
3462
+ ...iconProps
3463
+ }),
3464
+ IconRight: ({ className: iconClassName, ...iconProps }) => /* @__PURE__ */ jsx(ChevronRight, {
3465
+ className: cn$1("h-4 w-4", iconClassName),
3466
+ ...iconProps
3467
+ })
3468
+ }), [billingColorsByDate]);
3469
+ useEffect(() => {
3470
+ if (!open) return;
3471
+ if (currentNextBillDate) {
3472
+ const initial = parseIsoDate(currentNextBillDate);
3473
+ setSelectedDate(initial < minDate ? minDate : initial);
3474
+ } else setSelectedDate(void 0);
3475
+ }, [open, currentNextBillDate]);
3476
+ const handleConfirm = () => {
3477
+ if (!selectedDate) return;
3478
+ onConfirm(format(selectedDate, "yyyy-MM-dd"));
3479
+ };
3480
+ const handleDismiss = (next) => {
3481
+ if (!next) setSelectedDate(void 0);
3482
+ onOpenChange(next);
3483
+ };
3484
+ const previewDate = selectedDate ? format(selectedDate, "MMMM d, yyyy") : currentNextBillDate ? format(parseIsoDate(currentNextBillDate), "MMMM d, yyyy") : "a future date";
3485
+ return /* @__PURE__ */ jsx(Dialog, {
3486
+ open,
3487
+ onOpenChange: handleDismiss,
3488
+ children: /* @__PURE__ */ jsxs(DialogContent, {
3489
+ "aria-describedby": "edit-bill-date-dialog-description",
3490
+ className: "rounded",
3491
+ children: [
3492
+ /* @__PURE__ */ jsx(DialogHeader, {
3493
+ className: "flex flex-row justify-between",
3494
+ children: /* @__PURE__ */ jsx(DialogTitle, {
3495
+ className: "text-md w-full text-left font-medium",
3496
+ children: title
3497
+ })
3498
+ }),
3499
+ /* @__PURE__ */ jsxs("div", {
3500
+ className: "space-y-4",
3501
+ children: [
3502
+ /* @__PURE__ */ jsx("p", {
3503
+ id: "edit-bill-date-dialog-description",
3504
+ className: "text-muted-foreground text-sm",
3505
+ children: description
3506
+ }),
3507
+ /* @__PURE__ */ jsxs("div", {
3508
+ className: "space-y-2",
3509
+ children: [/* @__PURE__ */ jsx(Label, {
3510
+ className: "text-foreground text-sm font-semibold",
3511
+ children: "Next bill date"
3512
+ }), /* @__PURE__ */ jsxs(Popover, {
3513
+ open: calendarOpen,
3514
+ onOpenChange: setCalendarOpen,
3515
+ children: [/* @__PURE__ */ jsx(PopoverTrigger, {
3516
+ asChild: true,
3517
+ children: /* @__PURE__ */ jsxs(Button, {
3518
+ variant: "outline",
3519
+ className: cn$1("border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground h-9 w-full justify-start border px-3 py-2 text-left font-normal", !selectedDate && "text-muted-foreground hover:text-muted-foreground"),
3520
+ children: [selectedDate ? format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "mm/dd/yyyy" }), /* @__PURE__ */ jsx(CalendarIcon, { className: "text-muted-foreground ml-auto h-4 w-4" })]
3521
+ })
3522
+ }), /* @__PURE__ */ jsx(PopoverContent, {
3523
+ className: "bg-popover z-[9999] w-auto rounded-md border p-0 shadow-lg",
3524
+ align: "start",
3525
+ sideOffset: 4,
3526
+ children: /* @__PURE__ */ jsx(Calendar$1, {
3527
+ mode: "single",
3528
+ selected: selectedDate,
3529
+ onSelect: (date) => {
3530
+ setSelectedDate(date);
3531
+ setCalendarOpen(false);
3532
+ },
3533
+ disabled: (date) => date < minDate,
3534
+ defaultMonth: selectedDate ?? (currentNextBillDate ? parseIsoDate(currentNextBillDate) : void 0),
3535
+ components: calendarComponents,
3536
+ initialFocus: true
3537
+ })
3538
+ })]
3539
+ })]
3540
+ }),
3541
+ selectedDate && /* @__PURE__ */ jsxs("div", {
3542
+ className: "text-muted-foreground text-xs",
3543
+ children: [
3544
+ "Your next bill will be on",
3545
+ " ",
3546
+ /* @__PURE__ */ jsx("span", {
3547
+ className: "font-semibold",
3548
+ children: previewDate
3549
+ }),
3550
+ "."
3551
+ ]
3552
+ }),
3553
+ subscriptionsWithColor.length > 0 && /* @__PURE__ */ jsxs("div", {
3554
+ className: "space-y-2",
3555
+ children: [/* @__PURE__ */ jsx(Label, {
3556
+ className: "text-foreground text-sm font-semibold",
3557
+ children: "Your other subscriptions"
3558
+ }), /* @__PURE__ */ jsx("div", {
3559
+ className: "border-border max-h-40 overflow-auto rounded-md border",
3560
+ children: /* @__PURE__ */ jsxs("table", {
3561
+ className: "w-full table-fixed text-sm",
3562
+ children: [/* @__PURE__ */ jsx("thead", {
3563
+ className: "bg-muted text-muted-foreground sticky top-0",
3564
+ children: /* @__PURE__ */ jsxs("tr", { children: [
3565
+ /* @__PURE__ */ jsx("th", {
3566
+ className: "w-6 px-2 py-2",
3567
+ "aria-label": "Color"
3568
+ }),
3569
+ /* @__PURE__ */ jsx("th", {
3570
+ className: "px-3 py-2 text-left font-medium",
3571
+ children: "Product"
3572
+ }),
3573
+ /* @__PURE__ */ jsx("th", {
3574
+ className: "w-28 px-3 py-2 text-left font-medium",
3575
+ children: "Bill Date"
3576
+ })
3577
+ ] })
3578
+ }), /* @__PURE__ */ jsx("tbody", {
3579
+ className: "divide-border divide-y",
3580
+ children: subscriptionsWithColor.map((sub) => /* @__PURE__ */ jsxs("tr", { children: [
3581
+ /* @__PURE__ */ jsx("td", {
3582
+ className: "px-2 py-2",
3583
+ children: /* @__PURE__ */ jsx("span", {
3584
+ "aria-hidden": true,
3585
+ className: "inline-block h-2.5 w-2.5 rounded-full",
3586
+ style: { backgroundColor: sub.color }
3587
+ })
3588
+ }),
3589
+ /* @__PURE__ */ jsx("td", {
3590
+ className: "overflow-hidden px-3 py-2",
3591
+ title: sub.productTitle,
3592
+ children: onNavigateToSubscription ? /* @__PURE__ */ jsx("button", {
3593
+ type: "button",
3594
+ onClick: () => {
3595
+ onNavigateToSubscription(sub.token);
3596
+ handleDismiss(false);
3597
+ },
3598
+ className: "text-primary block w-full truncate text-left hover:underline",
3599
+ children: sub.productTitle
3600
+ }) : /* @__PURE__ */ jsx("span", {
3601
+ className: "text-foreground block truncate",
3602
+ children: sub.productTitle
3603
+ })
3604
+ }),
3605
+ /* @__PURE__ */ jsx("td", {
3606
+ className: "text-muted-foreground px-3 py-2 whitespace-nowrap",
3607
+ children: sub.nextBillDate ? format(parseIsoDate(sub.nextBillDate), "MMM d, yyyy") : "—"
3608
+ })
3609
+ ] }, sub.token))
3610
+ })]
3611
+ })
3612
+ })]
3613
+ })
3614
+ ]
3615
+ }),
3616
+ errorMessage && /* @__PURE__ */ jsx("p", {
3617
+ className: "text-destructive text-left text-sm",
3618
+ children: errorMessage
3619
+ }),
3620
+ /* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsxs("div", {
3621
+ className: "flex w-full flex-row justify-between space-x-2",
3622
+ children: [/* @__PURE__ */ jsx(Button, {
3623
+ variant: "outline",
3624
+ className: "h-10 min-w-[70px] rounded p-3",
3625
+ onClick: () => handleDismiss(false),
3626
+ children: "Cancel"
3627
+ }), /* @__PURE__ */ jsx(Button, {
3628
+ type: "button",
3629
+ className: "h-10 min-w-[70px] rounded p-3",
3630
+ onClick: handleConfirm,
3631
+ disabled: !selectedDate || isLoading,
3632
+ children: isLoading ? /* @__PURE__ */ jsx("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) : actionText
3633
+ })]
3634
+ }) })
3635
+ ]
3636
+ })
3637
+ });
3638
+ }
3639
+ //#endregion
3388
3640
  //#region ../../subscriptions/ui/src/components/subscription-detail.tsx
3389
3641
  function SubscriptionDetailSkeleton() {
3390
3642
  return /* @__PURE__ */ jsxs("div", {
@@ -3450,7 +3702,7 @@ function SubscriptionDetailSkeleton() {
3450
3702
  })]
3451
3703
  });
3452
3704
  }
3453
- function SubscriptionItemsSection({ subscription, displayQuantity, canEditQuantity = false, onQuantityChange, isUpdatingQuantity = false }) {
3705
+ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBillDate, canEditQuantity = false, onQuantityChange, isUpdatingQuantity = false }) {
3454
3706
  const variant = subscription.variant;
3455
3707
  const product = variant?.product;
3456
3708
  const quantity = displayQuantity ?? subscription.quantity;
@@ -3459,7 +3711,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, canEditQuanti
3459
3711
  const discount = subscription.original_price != null ? subscription.original_price - subscription.price : 0;
3460
3712
  const subtotal = discount > 0 ? formatCurrency(subscription.original_price * quantity) : totalPrice;
3461
3713
  return /* @__PURE__ */ jsx("section", {
3462
- className: "bg-muted flex w-full flex-col items-center px-8 lg:col-span-4",
3714
+ className: "bg-muted flex w-full flex-col items-center rounded-lg px-8 lg:col-span-4 lg:self-start",
3463
3715
  children: /* @__PURE__ */ jsxs("div", {
3464
3716
  className: "flex w-full max-w-lg flex-col",
3465
3717
  children: [
@@ -3479,17 +3731,27 @@ function SubscriptionItemsSection({ subscription, displayQuantity, canEditQuanti
3479
3731
  children: "Next Order Date"
3480
3732
  }), /* @__PURE__ */ jsx("div", {
3481
3733
  className: "text-foreground text-2xl font-bold",
3482
- children: getNextBillDisplay(subscription)
3734
+ children: getNextBillDisplay(displayNextBillDate ? {
3735
+ ...subscription,
3736
+ next_bill_date: displayNextBillDate
3737
+ } : subscription)
3483
3738
  })]
3484
3739
  }), /* @__PURE__ */ jsxs("div", {
3485
3740
  className: "pl-4",
3486
- children: [/* @__PURE__ */ jsx("div", {
3487
- className: "text-muted-foreground mb-1 text-sm",
3488
- children: "Next Bill Amount"
3489
- }), /* @__PURE__ */ jsx("div", {
3490
- className: "text-foreground text-2xl font-bold",
3491
- children: formatCurrency(subscription.price * quantity)
3492
- })]
3741
+ children: [
3742
+ /* @__PURE__ */ jsx("div", {
3743
+ className: "text-muted-foreground mb-1 text-sm",
3744
+ children: "Next Bill Amount"
3745
+ }),
3746
+ /* @__PURE__ */ jsx("div", {
3747
+ className: "text-foreground text-2xl font-bold",
3748
+ children: formatCurrency(subscription.price * quantity)
3749
+ }),
3750
+ (displayNextBillDate ?? subscription.next_bill_date) && /* @__PURE__ */ jsx("div", {
3751
+ className: "text-muted-foreground mt-1 text-xs",
3752
+ children: formatDate(displayNextBillDate ?? subscription.next_bill_date ?? "")
3753
+ })
3754
+ ]
3493
3755
  })]
3494
3756
  }), /* @__PURE__ */ jsx("hr", { className: "border-border mt-4" })]
3495
3757
  })]
@@ -3602,7 +3864,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, canEditQuanti
3602
3864
  })
3603
3865
  });
3604
3866
  }
3605
- function SubscriptionManagementSection({ subscription, isActive, isPaused, isCancelled, isMutating, onSkip, onPause, onResume, onCancel, onReactivate, renderPaymentMethod }) {
3867
+ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCancelled, isMutating, onSkip, onPause, onResume, onCancel, onReactivate, onEditBillDate, displayNextBillDate, renderPaymentMethod, renderShippingAddress }) {
3606
3868
  const plan = subscription.subscription_plan;
3607
3869
  const quantity = subscription.quantity;
3608
3870
  const totalPrice = formatCurrency(subscription.price * quantity);
@@ -3634,22 +3896,22 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
3634
3896
  }),
3635
3897
  isActive && /* @__PURE__ */ jsxs(Button, {
3636
3898
  variant: "outline",
3637
- onClick: onPause,
3899
+ onClick: onEditBillDate,
3638
3900
  disabled: isMutating,
3639
3901
  className: actionButtonClass,
3640
- children: [/* @__PURE__ */ jsx(Pause, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
3902
+ children: [/* @__PURE__ */ jsx(CalendarDays, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
3641
3903
  className: "truncate",
3642
- children: "Pause Subscription"
3904
+ children: "Edit Bill Date"
3643
3905
  })]
3644
3906
  }),
3645
- isPaused && /* @__PURE__ */ jsxs(Button, {
3907
+ isActive && /* @__PURE__ */ jsxs(Button, {
3646
3908
  variant: "outline",
3647
- onClick: onResume,
3909
+ onClick: onPause,
3648
3910
  disabled: isMutating,
3649
3911
  className: actionButtonClass,
3650
- children: [/* @__PURE__ */ jsx(Play, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
3912
+ children: [/* @__PURE__ */ jsx(Pause, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
3651
3913
  className: "truncate",
3652
- children: "Resume Subscription"
3914
+ children: "Pause Subscription"
3653
3915
  })]
3654
3916
  }),
3655
3917
  /* @__PURE__ */ jsxs(Button, {
@@ -3659,7 +3921,17 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
3659
3921
  className: actionButtonClass,
3660
3922
  children: [/* @__PURE__ */ jsx(XCircle, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
3661
3923
  className: "truncate",
3662
- children: isCancelled ? "Cancelled" : "Cancel Subscription"
3924
+ children: isCancelled ? "Cancelled Subscription" : "Cancel Subscription"
3925
+ })]
3926
+ }),
3927
+ isPaused && /* @__PURE__ */ jsxs(Button, {
3928
+ variant: "outline",
3929
+ onClick: onResume,
3930
+ disabled: isMutating,
3931
+ className: actionButtonClass,
3932
+ children: [/* @__PURE__ */ jsx(Play, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ jsx("span", {
3933
+ className: "truncate",
3934
+ children: "Resume Subscription"
3663
3935
  })]
3664
3936
  }),
3665
3937
  isCancelled && /* @__PURE__ */ jsxs(Button, {
@@ -3701,13 +3973,20 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
3701
3973
  }),
3702
3974
  /* @__PURE__ */ jsxs("div", {
3703
3975
  className: "flex-1 px-4",
3704
- children: [/* @__PURE__ */ jsx("div", {
3705
- className: "text-muted-foreground text-sm",
3706
- children: "Next Payment"
3707
- }), /* @__PURE__ */ jsx("div", {
3708
- className: "text-foreground font-medium",
3709
- children: totalPrice
3710
- })]
3976
+ children: [
3977
+ /* @__PURE__ */ jsx("div", {
3978
+ className: "text-muted-foreground text-sm",
3979
+ children: "Next Payment"
3980
+ }),
3981
+ /* @__PURE__ */ jsx("div", {
3982
+ className: "text-foreground font-medium",
3983
+ children: totalPrice
3984
+ }),
3985
+ (displayNextBillDate ?? subscription.next_bill_date) && /* @__PURE__ */ jsx("div", {
3986
+ className: "text-muted-foreground text-xs",
3987
+ children: formatDate(displayNextBillDate ?? subscription.next_bill_date ?? "")
3988
+ })
3989
+ ]
3711
3990
  }),
3712
3991
  subscription.last_bill_date && /* @__PURE__ */ jsxs("div", {
3713
3992
  className: "flex-1 pl-4 text-right",
@@ -3729,7 +4008,12 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
3729
4008
  children: "Payment & Shipping"
3730
4009
  }), /* @__PURE__ */ jsxs("div", {
3731
4010
  className: "flex flex-col",
3732
- children: [subscription.address && /* @__PURE__ */ jsxs("div", {
4011
+ children: [renderShippingAddress ? renderShippingAddress({
4012
+ address: subscription.address ?? null,
4013
+ subscriptionToken: subscription.subscription_token,
4014
+ customerId: subscription.customer?.id ?? 0,
4015
+ countryCode: subscription.address?.country_code ?? "US"
4016
+ }) : subscription.address && /* @__PURE__ */ jsxs("div", {
3733
4017
  className: "border-border mb-6 border-b pb-4",
3734
4018
  children: [/* @__PURE__ */ jsx("div", {
3735
4019
  className: "text-muted-foreground mt-3 mb-1 text-sm",
@@ -3753,7 +4037,9 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
3753
4037
  })]
3754
4038
  }), paymentMethod && (renderPaymentMethod ? renderPaymentMethod({
3755
4039
  paymentMethod,
3756
- subscriptionToken: subscription.subscription_token
4040
+ subscriptionToken: subscription.subscription_token,
4041
+ customerId: subscription.customer?.id ?? 0,
4042
+ countryCode: subscription.address?.country_code ?? "US"
3757
4043
  }) : /* @__PURE__ */ jsxs("div", {
3758
4044
  className: "border-border mb-6 border-b pb-4",
3759
4045
  children: [/* @__PURE__ */ jsx("div", {
@@ -3772,71 +4058,87 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
3772
4058
  })]
3773
4059
  }))]
3774
4060
  })]
3775
- }),
3776
- subscription.orders.length > 0 && /* @__PURE__ */ jsxs("div", {
3777
- className: "border-border mb-4 border-b pb-4",
3778
- children: [/* @__PURE__ */ jsx("h3", {
3779
- className: "text-foreground mb-3 text-sm/6 font-semibold",
3780
- children: "Order History"
3781
- }), /* @__PURE__ */ jsx("div", {
3782
- className: "overflow-x-auto",
3783
- children: /* @__PURE__ */ jsxs("table", {
3784
- className: "divide-border min-w-full divide-y text-sm",
3785
- children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
3786
- /* @__PURE__ */ jsx("th", {
3787
- className: "text-muted-foreground py-2 pr-3 text-left font-medium",
3788
- children: "Order"
3789
- }),
3790
- /* @__PURE__ */ jsx("th", {
3791
- className: "text-muted-foreground px-3 py-2 text-left font-medium",
3792
- children: "Date"
3793
- }),
3794
- /* @__PURE__ */ jsx("th", {
3795
- className: "text-muted-foreground px-3 py-2 text-left font-medium",
3796
- children: "Status"
3797
- }),
3798
- /* @__PURE__ */ jsx("th", {
3799
- className: "text-muted-foreground py-2 pl-3 text-right font-medium",
3800
- children: "Amount"
3801
- })
3802
- ] }) }), /* @__PURE__ */ jsx("tbody", {
3803
- className: "divide-border divide-y",
3804
- children: subscription.orders.map((order) => /* @__PURE__ */ jsxs("tr", { children: [
3805
- /* @__PURE__ */ jsx("td", {
3806
- className: "text-foreground py-2 pr-3 font-medium",
3807
- children: order.order_number ?? `#${order.id}`
3808
- }),
3809
- /* @__PURE__ */ jsx("td", {
3810
- className: "text-muted-foreground px-3 py-2",
3811
- children: formatDate(order.created_at.split("T")[0] ?? "")
3812
- }),
3813
- /* @__PURE__ */ jsx("td", {
3814
- className: "px-3 py-2",
3815
- children: /* @__PURE__ */ jsx(StatusPill, {
3816
- status: order.status,
3817
- children: startCase(order.status)
3818
- })
3819
- }),
3820
- /* @__PURE__ */ jsx("td", {
3821
- className: "text-foreground py-2 pl-3 text-right",
3822
- children: order.amount != null ? formatCurrency(Number(order.amount)) : "N/A"
3823
- })
3824
- ] }, order.id))
3825
- })]
3826
- })
3827
- })]
3828
4061
  })
3829
4062
  ]
3830
4063
  })
3831
4064
  });
3832
4065
  }
3833
- function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationError, renderPaymentMethod }) {
4066
+ function OrderHistorySection({ subscription }) {
4067
+ if (subscription.orders.length === 0) return null;
4068
+ return /* @__PURE__ */ jsxs("section", {
4069
+ className: "mt-6 px-8 pt-6 pb-8",
4070
+ children: [/* @__PURE__ */ jsx("h3", {
4071
+ className: "text-foreground mb-3 text-sm/6 font-semibold",
4072
+ children: "Subscription Order History"
4073
+ }), /* @__PURE__ */ jsx("div", {
4074
+ className: "border-border overflow-x-auto rounded-md border",
4075
+ children: /* @__PURE__ */ jsxs("table", {
4076
+ className: "divide-border min-w-full divide-y text-sm",
4077
+ children: [/* @__PURE__ */ jsx("thead", {
4078
+ className: "bg-muted",
4079
+ children: /* @__PURE__ */ jsxs("tr", { children: [
4080
+ /* @__PURE__ */ jsx("th", {
4081
+ className: "text-muted-foreground py-2 pr-3 pl-3 text-left font-medium",
4082
+ children: "Order"
4083
+ }),
4084
+ /* @__PURE__ */ jsx("th", {
4085
+ className: "text-muted-foreground px-3 py-2 text-left font-medium",
4086
+ children: "Date"
4087
+ }),
4088
+ /* @__PURE__ */ jsx("th", {
4089
+ className: "text-muted-foreground px-3 py-2 text-left font-medium",
4090
+ children: "Status"
4091
+ }),
4092
+ /* @__PURE__ */ jsx("th", {
4093
+ className: "text-muted-foreground py-2 pr-3 pl-3 text-right font-medium",
4094
+ children: "Amount"
4095
+ })
4096
+ ] })
4097
+ }), /* @__PURE__ */ jsx("tbody", {
4098
+ className: "divide-border divide-y",
4099
+ children: subscription.orders.map((order) => /* @__PURE__ */ jsxs("tr", { children: [
4100
+ /* @__PURE__ */ jsx("td", {
4101
+ className: "text-foreground py-2 pr-3 pl-3 font-medium",
4102
+ children: order.order_number ?? `#${order.id}`
4103
+ }),
4104
+ /* @__PURE__ */ jsx("td", {
4105
+ className: "text-muted-foreground px-3 py-2",
4106
+ children: formatDate(order.created_at.split("T")[0] ?? "")
4107
+ }),
4108
+ /* @__PURE__ */ jsx("td", {
4109
+ className: "px-3 py-2",
4110
+ children: /* @__PURE__ */ jsx(StatusPill, {
4111
+ status: order.status,
4112
+ children: startCase(order.status)
4113
+ })
4114
+ }),
4115
+ /* @__PURE__ */ jsx("td", {
4116
+ className: "text-foreground py-2 pr-3 pl-3 text-right",
4117
+ children: order.amount != null ? formatCurrency(Number(order.amount)) : "N/A"
4118
+ })
4119
+ ] }, order.id))
4120
+ })]
4121
+ })
4122
+ })]
4123
+ });
4124
+ }
4125
+ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationError, onNavigateToSubscription, renderPaymentMethod, renderShippingAddress }) {
3834
4126
  const [showCancelModal, setShowCancelModal] = useState(false);
3835
4127
  const [showPauseModal, setShowPauseModal] = useState(false);
3836
4128
  const [showResumeModal, setShowResumeModal] = useState(false);
4129
+ const [showEditBillDateModal, setShowEditBillDateModal] = useState(false);
4130
+ const [pendingNextBillDate, setPendingNextBillDate] = useState(null);
3837
4131
  const { data, isLoading, error } = useSubscription(token);
3838
4132
  const subscription = data?.subscription;
3839
4133
  const customerId = subscription?.customer?.id ?? 0;
4134
+ const customerSubscriptionsQuery = useSubscriptions({ perPage: 100 }, { enabled: showEditBillDateModal });
4135
+ const otherSubscriptionsForBillDate = useMemo(() => (customerSubscriptionsQuery.data?.subscriptions ?? []).filter((s) => s.subscription_token !== token).map((s) => ({
4136
+ token: s.subscription_token,
4137
+ productTitle: s.variant?.product?.title ?? "Subscription",
4138
+ nextBillDate: s.next_bill_date,
4139
+ billingInterval: s.subscription_plan?.billing_interval ?? 1,
4140
+ billingIntervalUnit: s.subscription_plan?.billing_interval_unit ?? "month"
4141
+ })), [customerSubscriptionsQuery.data, token]);
3840
4142
  const pauseMutation = usePauseSubscription({
3841
4143
  onSuccess: () => onSuccess?.("Subscription paused"),
3842
4144
  onError: (err) => onMutationError?.("Failed to pause subscription", err)
@@ -3871,6 +4173,20 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
3871
4173
  onMutationError?.("Failed to update quantity", err);
3872
4174
  }
3873
4175
  });
4176
+ const editBillDateMutation = useUpdateSubscriptionInfo({
4177
+ onSuccess: () => {
4178
+ onSuccess?.("Bill date updated");
4179
+ setShowEditBillDateModal(false);
4180
+ },
4181
+ onError: (err) => {
4182
+ setPendingNextBillDate(null);
4183
+ onMutationError?.("Failed to update bill date", err);
4184
+ }
4185
+ });
4186
+ const serverNextBillDate = data?.subscription.next_bill_date ?? null;
4187
+ useEffect(() => {
4188
+ if (pendingNextBillDate != null && serverNextBillDate != null && serverNextBillDate.startsWith(pendingNextBillDate)) setPendingNextBillDate(null);
4189
+ }, [pendingNextBillDate, serverNextBillDate]);
3874
4190
  const serverQuantity = data?.subscription.quantity;
3875
4191
  useEffect(() => {
3876
4192
  if (pendingQuantity != null && serverQuantity === pendingQuantity) setPendingQuantity(null);
@@ -3918,11 +4234,10 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
3918
4234
  const isActive = subscription.status === "active";
3919
4235
  const isPaused = subscription.status === "paused";
3920
4236
  const isCancelled = subscription.status === "cancelled";
3921
- const isMutating = pauseMutation.isPending || resumeMutation.isPending || skipMutation.isPending || cancelMutation.isPending || reactivateMutation.isPending;
4237
+ const isMutating = pauseMutation.isPending || resumeMutation.isPending || skipMutation.isPending || cancelMutation.isPending || reactivateMutation.isPending || editBillDateMutation.isPending;
3922
4238
  const handlePauseConfirm = (selection) => {
3923
4239
  const pauseParams = { customerId };
3924
4240
  if (selection.type === "order_count") pauseParams.numberOfOrders = selection.numberOfOrders;
3925
- else if (selection.type === "specific") pauseParams.nextBillDate = selection.nextBillDate;
3926
4241
  pauseMutation.mutate({
3927
4242
  subscriptionToken: token,
3928
4243
  pauseParams
@@ -3965,6 +4280,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
3965
4280
  children: [/* @__PURE__ */ jsx(SubscriptionItemsSection, {
3966
4281
  subscription,
3967
4282
  displayQuantity: pendingQuantity ?? void 0,
4283
+ displayNextBillDate: pendingNextBillDate ?? void 0,
3968
4284
  canEditQuantity: isActive,
3969
4285
  onQuantityChange: handleQuantityChange,
3970
4286
  isUpdatingQuantity: quantityMutation.isPending
@@ -3979,16 +4295,46 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
3979
4295
  onResume: () => setShowResumeModal(true),
3980
4296
  onCancel: () => setShowCancelModal(true),
3981
4297
  onReactivate: handleReactivate,
3982
- renderPaymentMethod
4298
+ onEditBillDate: () => setShowEditBillDateModal(true),
4299
+ displayNextBillDate: pendingNextBillDate ?? void 0,
4300
+ renderPaymentMethod,
4301
+ renderShippingAddress
3983
4302
  })]
3984
4303
  }),
3985
- /* @__PURE__ */ jsx(ConfirmDialog, {
3986
- title: "Cancel Subscription",
3987
- actionButtonText: "Cancel Subscription",
3988
- description: "Are you sure you want to cancel this subscription? You can reactivate it later.",
4304
+ /* @__PURE__ */ jsx(OrderHistorySection, { subscription }),
4305
+ /* @__PURE__ */ jsx(CancelSubscriptionDialog, {
3989
4306
  open: showCancelModal,
3990
- setOpen: setShowCancelModal,
3991
- onConfirm: handleCancel
4307
+ onOpenChange: setShowCancelModal,
4308
+ onConfirm: handleCancel,
4309
+ onPauseInstead: (months) => {
4310
+ setShowCancelModal(false);
4311
+ pauseMutation.mutate({
4312
+ subscriptionToken: token,
4313
+ pauseParams: {
4314
+ customerId,
4315
+ nextBillDate: format(addMonths(/* @__PURE__ */ new Date(), months), "yyyy-MM-dd")
4316
+ }
4317
+ });
4318
+ }
4319
+ }),
4320
+ /* @__PURE__ */ jsx(EditBillDateDialog, {
4321
+ open: showEditBillDateModal,
4322
+ onOpenChange: (next) => {
4323
+ if (!next) editBillDateMutation.reset();
4324
+ setShowEditBillDateModal(next);
4325
+ },
4326
+ onConfirm: (nextBillDate) => {
4327
+ setPendingNextBillDate(nextBillDate);
4328
+ editBillDateMutation.mutate({
4329
+ subscriptionToken: token,
4330
+ body: { next_bill_date: nextBillDate }
4331
+ });
4332
+ },
4333
+ isLoading: editBillDateMutation.isPending,
4334
+ errorMessage: editBillDateMutation.isError ? "Could not update the bill date. Please try a different date." : void 0,
4335
+ currentNextBillDate: subscription.next_bill_date,
4336
+ otherSubscriptions: otherSubscriptionsForBillDate,
4337
+ onNavigateToSubscription
3992
4338
  }),
3993
4339
  /* @__PURE__ */ jsx(PauseSubscriptionDialog, {
3994
4340
  open: showPauseModal,
@@ -4018,7 +4364,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
4018
4364
  }
4019
4365
  //#endregion
4020
4366
  //#region ../../subscriptions/ui/src/screens/SubscriptionDetailScreen.tsx
4021
- function SubscriptionDetailScreen$1({ token, onNavigateToList, onNotFound, onError, onSuccess, onMutationError, renderPaymentMethod }) {
4367
+ function SubscriptionDetailScreen$1({ token, onNavigateToList, onNavigateToSubscription, onNotFound, onError, onSuccess, onMutationError, renderPaymentMethod, renderShippingAddress }) {
4022
4368
  useScreenHeaderBreadcrumbs(useMemo(() => /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsxs(BreadcrumbList, {
4023
4369
  className: "text-lg",
4024
4370
  children: [
@@ -4045,7 +4391,9 @@ function SubscriptionDetailScreen$1({ token, onNavigateToList, onNotFound, onErr
4045
4391
  onError,
4046
4392
  onSuccess,
4047
4393
  onMutationError,
4048
- renderPaymentMethod
4394
+ onNavigateToSubscription,
4395
+ renderPaymentMethod,
4396
+ renderShippingAddress
4049
4397
  })
4050
4398
  });
4051
4399
  }
@@ -4320,6 +4668,7 @@ function SubscriptionDetailScreen({ token, onToast }) {
4320
4668
  return /* @__PURE__ */ jsx(SubscriptionDetailScreen$1, {
4321
4669
  token,
4322
4670
  onNavigateToList: () => navigate("subscriptions"),
4671
+ onNavigateToSubscription: (nextToken) => navigate(`subscriptions/${nextToken}`),
4323
4672
  onNotFound: () => {
4324
4673
  onToast("Subscription not found", "warning");
4325
4674
  navigate("subscriptions");
@@ -4389,4 +4738,4 @@ const subscriptionsScreenPropertySchema = {
4389
4738
  //#endregion
4390
4739
  export { SubscriptionsScreen_exports as n, subscriptionsScreenPropertySchema as r, SubscriptionsScreen as t };
4391
4740
 
4392
- //# sourceMappingURL=SubscriptionsScreen-rZxqb0eR.mjs.map
4741
+ //# sourceMappingURL=SubscriptionsScreen-CTGqV8gK.mjs.map