@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.
- package/dist/{AddressAutocompleteInput-B0qLrCHN.mjs → AddressAutocompleteInput-Bdsv2iFU.mjs} +2 -2
- package/dist/{AddressAutocompleteInput-B0qLrCHN.mjs.map → AddressAutocompleteInput-Bdsv2iFU.mjs.map} +1 -1
- package/dist/{ChartWidget-Ci4Q0Ig-.mjs → ChartWidget-aFsH9gwD.mjs} +2 -2
- package/dist/{ChartWidget-Ci4Q0Ig-.mjs.map → ChartWidget-aFsH9gwD.mjs.map} +1 -1
- package/dist/{ContactsScreen-Bq8zrA8k.mjs → ContactsScreen-DlxwuLwy.mjs} +4 -4
- package/dist/{ContactsScreen-Bq8zrA8k.mjs.map → ContactsScreen-DlxwuLwy.mjs.map} +1 -1
- package/dist/{FluidProvider-DS1QKy5j.mjs → FluidProvider-CvS807e4.mjs} +9 -9
- package/dist/{FluidProvider-DS1QKy5j.mjs.map → FluidProvider-CvS807e4.mjs.map} +1 -1
- package/dist/{InfiniteScrollSentinel-BHIgNtHI.mjs → InfiniteScrollSentinel-Dq--_LMC.mjs} +2 -2
- package/dist/{InfiniteScrollSentinel-BHIgNtHI.mjs.map → InfiniteScrollSentinel-Dq--_LMC.mjs.map} +1 -1
- package/dist/{LinkWidget-utkZrvAV.mjs → LinkWidget-CcEATaYa.mjs} +2 -2
- package/dist/{LinkWidget-utkZrvAV.mjs.map → LinkWidget-CcEATaYa.mjs.map} +1 -1
- package/dist/{MessagingScreen-CJ_9yIHK.mjs → MessagingScreen-D7crRUnX.mjs} +4 -4
- package/dist/{MessagingScreen-CJ_9yIHK.mjs.map → MessagingScreen-D7crRUnX.mjs.map} +1 -1
- package/dist/{MessagingScreen-s7CL9vPN.mjs → MessagingScreen-DZfFOdFI.mjs} +8 -8
- package/dist/{MessagingScreen-DeYSVcMd.cjs → MessagingScreen-GLb5id9n.cjs} +63 -130
- package/dist/MessagingScreen-GLb5id9n.cjs.map +1 -0
- package/dist/{MessagingScreen-FHwytr8B.cjs → MessagingScreen-jOf-MSk1.cjs} +1 -1
- package/dist/{MySiteScreen-DX8tBz8Z.mjs → MySiteScreen-CZFM4MQO.mjs} +3 -3
- package/dist/{MySiteScreen-DX8tBz8Z.mjs.map → MySiteScreen-CZFM4MQO.mjs.map} +1 -1
- package/dist/{OrdersScreen-B3vtWt8_.mjs → OrdersScreen-BDTtvnBR.mjs} +3 -3
- package/dist/{OrdersScreen-B3vtWt8_.mjs.map → OrdersScreen-BDTtvnBR.mjs.map} +1 -1
- package/dist/{ProfileScreen-IPuXlf9V.mjs → ProfileScreen--6ETap-j.mjs} +5 -5
- package/dist/{ProfileScreen-IPuXlf9V.mjs.map → ProfileScreen--6ETap-j.mjs.map} +1 -1
- package/dist/{ProfileScreen-m3fTsHyw.mjs → ProfileScreen-BXzIR1xc.mjs} +9 -9
- package/dist/{SearchSort-B5Jrk5lW.mjs → SearchSort-CnUiCGu2.mjs} +2 -2
- package/dist/{SearchSort-B5Jrk5lW.mjs.map → SearchSort-CnUiCGu2.mjs.map} +1 -1
- package/dist/{ShareablesScreen-NMoZH9ed.mjs → ShareablesScreen-BY47-Q_G.mjs} +4 -4
- package/dist/{ShareablesScreen-NMoZH9ed.mjs.map → ShareablesScreen-BY47-Q_G.mjs.map} +1 -1
- package/dist/{ShareablesScreen-Cd8chxk4.mjs → ShareablesScreen-D0z03RD0.mjs} +4 -4
- package/dist/{ShopScreen-DJANOOka.mjs → ShopScreen-BLU3IQ5B.mjs} +24 -24
- package/dist/{ShopScreen-DJANOOka.mjs.map → ShopScreen-BLU3IQ5B.mjs.map} +1 -1
- package/dist/{ShopScreen-CM3DDvLt.cjs → ShopScreen-BsfMjIPn.cjs} +21 -21
- package/dist/{ShopScreen-CM3DDvLt.cjs.map → ShopScreen-BsfMjIPn.cjs.map} +1 -1
- package/dist/{ShopScreen-BvSiWgsJ.mjs → ShopScreen-CKRSy_uk.mjs} +8 -8
- package/dist/{ShopScreen-Cz0dbkhp.cjs → ShopScreen-P7EazKlQ.cjs} +1 -1
- package/dist/{SubscriptionsScreen-DCUwHrdm.cjs → SubscriptionsScreen-BToWvdTh.cjs} +661 -252
- package/dist/SubscriptionsScreen-BToWvdTh.cjs.map +1 -0
- package/dist/{SubscriptionsScreen-rZxqb0eR.mjs → SubscriptionsScreen-CTGqV8gK.mjs} +567 -218
- package/dist/SubscriptionsScreen-CTGqV8gK.mjs.map +1 -0
- package/dist/{SubscriptionsScreen-BgKpfzi0.cjs → SubscriptionsScreen-DHTV7cFL.cjs} +1 -1
- package/dist/{TableWidget-CNCHDRrR.mjs → TableWidget-BtAfTNH_.mjs} +2 -2
- package/dist/{TableWidget-CNCHDRrR.mjs.map → TableWidget-BtAfTNH_.mjs.map} +1 -1
- package/dist/{ToDoWidget-C3lh-3SB.mjs → ToDoWidget-bn9bc_MO.mjs} +2 -2
- package/dist/{ToDoWidget-C3lh-3SB.mjs.map → ToDoWidget-bn9bc_MO.mjs.map} +1 -1
- package/dist/{UpgradeScreen-D_CM1n1M.mjs → UpgradeScreen-B-5QKZ_X.mjs} +2 -2
- package/dist/{UpgradeScreen-D_CM1n1M.mjs.map → UpgradeScreen-B-5QKZ_X.mjs.map} +1 -1
- package/dist/{components-D2h9u3tH.mjs → components-hloC7Tbu.mjs} +2 -2
- package/dist/{components-D2h9u3tH.mjs.map → components-hloC7Tbu.mjs.map} +1 -1
- package/dist/de-DGEv3Wj7.cjs +43 -0
- package/dist/de-DGEv3Wj7.cjs.map +1 -0
- package/dist/de-f_0MEvly.mjs +37 -0
- package/dist/de-f_0MEvly.mjs.map +1 -0
- package/dist/el-DBeHybzu.mjs +37 -0
- package/dist/el-DBeHybzu.mjs.map +1 -0
- package/dist/el-a-BUUyaN.cjs +43 -0
- package/dist/el-a-BUUyaN.cjs.map +1 -0
- package/dist/{es-C5dhBJ9E.mjs → es-B1tdcIoq.mjs} +2 -2
- package/dist/{es-C5dhBJ9E.mjs.map → es-B1tdcIoq.mjs.map} +1 -1
- package/dist/es-N-LjvJCS.cjs +43 -0
- package/dist/es-N-LjvJCS.cjs.map +1 -0
- package/dist/es-zRvcomm1.mjs +37 -0
- package/dist/es-zRvcomm1.mjs.map +1 -0
- package/dist/fr-CFggon_j.cjs +43 -0
- package/dist/fr-CFggon_j.cjs.map +1 -0
- package/dist/fr-DZ8hb7Li.mjs +37 -0
- package/dist/fr-DZ8hb7Li.mjs.map +1 -0
- package/dist/he-BXo3e9k9.mjs +37 -0
- package/dist/he-BXo3e9k9.mjs.map +1 -0
- package/dist/he-T4b_SIEg.cjs +43 -0
- package/dist/he-T4b_SIEg.cjs.map +1 -0
- package/dist/hu-C5uVO1Gi.cjs +43 -0
- package/dist/hu-C5uVO1Gi.cjs.map +1 -0
- package/dist/hu-DUbmD_v7.mjs +37 -0
- package/dist/hu-DUbmD_v7.mjs.map +1 -0
- package/dist/id-I8bH5NN_.mjs +37 -0
- package/dist/id-I8bH5NN_.mjs.map +1 -0
- package/dist/id-_R_sj2Zl.cjs +43 -0
- package/dist/id-_R_sj2Zl.cjs.map +1 -0
- package/dist/index.cjs +9 -9
- package/dist/index.mjs +39 -39
- package/dist/{format-CLUjV1oR.cjs → isAfter-DXdeICis.cjs} +80 -1
- package/dist/isAfter-DXdeICis.cjs.map +1 -0
- package/dist/it-BMvqaIb9.cjs +43 -0
- package/dist/it-BMvqaIb9.cjs.map +1 -0
- package/dist/it-D3Jf5QRi.mjs +37 -0
- package/dist/it-D3Jf5QRi.mjs.map +1 -0
- package/dist/ja-9CIQCExk.mjs +37 -0
- package/dist/ja-9CIQCExk.mjs.map +1 -0
- package/dist/ja-DBbelgna.cjs +43 -0
- package/dist/ja-DBbelgna.cjs.map +1 -0
- package/dist/ko-Bw-gMUu6.mjs +37 -0
- package/dist/ko-Bw-gMUu6.mjs.map +1 -0
- package/dist/ko-C0Tajaz1.cjs +43 -0
- package/dist/ko-C0Tajaz1.cjs.map +1 -0
- package/dist/nl-B89YTYeT.cjs +43 -0
- package/dist/nl-B89YTYeT.cjs.map +1 -0
- package/dist/nl-DDGMf5eH.mjs +37 -0
- package/dist/nl-DDGMf5eH.mjs.map +1 -0
- package/dist/{order-status-badge-CjX7Qxdk.mjs → order-status-badge-CKLegNhv.mjs} +4 -4
- package/dist/{order-status-badge-CjX7Qxdk.mjs.map → order-status-badge-CKLegNhv.mjs.map} +1 -1
- package/dist/pl--xhIwSlw.cjs +43 -0
- package/dist/pl--xhIwSlw.cjs.map +1 -0
- package/dist/pl-CdZlOTsS.mjs +37 -0
- package/dist/pl-CdZlOTsS.mjs.map +1 -0
- package/dist/pt-BdKQZfRo.mjs +37 -0
- package/dist/pt-BdKQZfRo.mjs.map +1 -0
- package/dist/pt-Cfp_A3CX.cjs +43 -0
- package/dist/pt-Cfp_A3CX.cjs.map +1 -0
- package/dist/ro-DnAztrxY.mjs +37 -0
- package/dist/ro-DnAztrxY.mjs.map +1 -0
- package/dist/ro-Qp0OJAI0.cjs +43 -0
- package/dist/ro-Qp0OJAI0.cjs.map +1 -0
- package/dist/ru-BkBpELbx.mjs +37 -0
- package/dist/ru-BkBpELbx.mjs.map +1 -0
- package/dist/ru-CY41Fh7R.cjs +43 -0
- package/dist/ru-CY41Fh7R.cjs.map +1 -0
- package/dist/{src-KINQ78Nj.mjs → src-jSFuc4IV.mjs} +2 -2
- package/dist/{src-KINQ78Nj.mjs.map → src-jSFuc4IV.mjs.map} +1 -1
- package/dist/th--13cvzk3.cjs +43 -0
- package/dist/th--13cvzk3.cjs.map +1 -0
- package/dist/th-B4QOqrXn.mjs +37 -0
- package/dist/th-B4QOqrXn.mjs.map +1 -0
- package/dist/tl-CEypklNf.mjs +37 -0
- package/dist/tl-CEypklNf.mjs.map +1 -0
- package/dist/tl-CaqI-eLl.cjs +43 -0
- package/dist/tl-CaqI-eLl.cjs.map +1 -0
- package/dist/tr-BzJ5aLBX.cjs +43 -0
- package/dist/tr-BzJ5aLBX.cjs.map +1 -0
- package/dist/tr-DUrLeX63.mjs +37 -0
- package/dist/tr-DUrLeX63.mjs.map +1 -0
- package/dist/zh_CN-2xAokYb4.cjs +43 -0
- package/dist/zh_CN-2xAokYb4.cjs.map +1 -0
- package/dist/zh_CN-Bhfuxe7w.mjs +37 -0
- package/dist/zh_CN-Bhfuxe7w.mjs.map +1 -0
- package/dist/zh_TW-B9XT91CL.cjs +43 -0
- package/dist/zh_TW-B9XT91CL.cjs.map +1 -0
- package/dist/zh_TW-DR3xhpLa.mjs +37 -0
- package/dist/zh_TW-DR3xhpLa.mjs.map +1 -0
- package/package.json +14 -14
- package/dist/MessagingScreen-DeYSVcMd.cjs.map +0 -1
- package/dist/SubscriptionsScreen-DCUwHrdm.cjs.map +0 -1
- package/dist/SubscriptionsScreen-rZxqb0eR.mjs.map +0 -1
- package/dist/de-CH__cDep.mjs +0 -6
- package/dist/de-CH__cDep.mjs.map +0 -1
- package/dist/de-CqKH8kwp.cjs +0 -12
- package/dist/de-CqKH8kwp.cjs.map +0 -1
- package/dist/el-CIrAhB-W.cjs +0 -12
- package/dist/el-CIrAhB-W.cjs.map +0 -1
- package/dist/el-De9QZiqh.mjs +0 -6
- package/dist/el-De9QZiqh.mjs.map +0 -1
- package/dist/es-4Wsa13tV.cjs +0 -12
- package/dist/es-4Wsa13tV.cjs.map +0 -1
- package/dist/es-CZLh7tET.mjs +0 -6
- package/dist/es-CZLh7tET.mjs.map +0 -1
- package/dist/format-CLUjV1oR.cjs.map +0 -1
- package/dist/fr-BDKPrKKW.cjs +0 -12
- package/dist/fr-BDKPrKKW.cjs.map +0 -1
- package/dist/fr-CIfM_0kG.mjs +0 -6
- package/dist/fr-CIfM_0kG.mjs.map +0 -1
- package/dist/he-5dq6lV2h.cjs +0 -12
- package/dist/he-5dq6lV2h.cjs.map +0 -1
- package/dist/he-BTK1iEJE.mjs +0 -6
- package/dist/he-BTK1iEJE.mjs.map +0 -1
- package/dist/hu-CrZGIbz9.mjs +0 -6
- package/dist/hu-CrZGIbz9.mjs.map +0 -1
- package/dist/hu-Dpgriy5N.cjs +0 -12
- package/dist/hu-Dpgriy5N.cjs.map +0 -1
- package/dist/id-B-LeCfHj.mjs +0 -6
- package/dist/id-B-LeCfHj.mjs.map +0 -1
- package/dist/id-Ba-0RT7y.cjs +0 -12
- package/dist/id-Ba-0RT7y.cjs.map +0 -1
- package/dist/it-CaxIV-R4.cjs +0 -12
- package/dist/it-CaxIV-R4.cjs.map +0 -1
- package/dist/it-rIkFmAF3.mjs +0 -6
- package/dist/it-rIkFmAF3.mjs.map +0 -1
- package/dist/ja--J_bhk3I.mjs +0 -6
- package/dist/ja--J_bhk3I.mjs.map +0 -1
- package/dist/ja-Lcg_Qqtj.cjs +0 -12
- package/dist/ja-Lcg_Qqtj.cjs.map +0 -1
- package/dist/ko-B2fghWQ9.mjs +0 -6
- package/dist/ko-B2fghWQ9.mjs.map +0 -1
- package/dist/ko-CFu0TjJO.cjs +0 -12
- package/dist/ko-CFu0TjJO.cjs.map +0 -1
- package/dist/nl-DR9IRXGT.cjs +0 -12
- package/dist/nl-DR9IRXGT.cjs.map +0 -1
- package/dist/nl-KgHmrRKy.mjs +0 -6
- package/dist/nl-KgHmrRKy.mjs.map +0 -1
- package/dist/pl-BJvDPvs3.mjs +0 -6
- package/dist/pl-BJvDPvs3.mjs.map +0 -1
- package/dist/pl-DSGSRDM2.cjs +0 -12
- package/dist/pl-DSGSRDM2.cjs.map +0 -1
- package/dist/pt-CmZpxftX.mjs +0 -6
- package/dist/pt-CmZpxftX.mjs.map +0 -1
- package/dist/pt-Pz_D1HUz.cjs +0 -12
- package/dist/pt-Pz_D1HUz.cjs.map +0 -1
- package/dist/ro-BoGeZTac.cjs +0 -12
- package/dist/ro-BoGeZTac.cjs.map +0 -1
- package/dist/ro-C_4rHVWp.mjs +0 -6
- package/dist/ro-C_4rHVWp.mjs.map +0 -1
- package/dist/ru-B0lzoBye.mjs +0 -6
- package/dist/ru-B0lzoBye.mjs.map +0 -1
- package/dist/ru-Cd7LUmcu.cjs +0 -12
- package/dist/ru-Cd7LUmcu.cjs.map +0 -1
- package/dist/th-DwLAQd0u.cjs +0 -12
- package/dist/th-DwLAQd0u.cjs.map +0 -1
- package/dist/th-QhoPGZ6C.mjs +0 -6
- package/dist/th-QhoPGZ6C.mjs.map +0 -1
- package/dist/tl-Dsfp243U.mjs +0 -6
- package/dist/tl-Dsfp243U.mjs.map +0 -1
- package/dist/tl-DwAVpDyB.cjs +0 -12
- package/dist/tl-DwAVpDyB.cjs.map +0 -1
- package/dist/tr-BFbCmHQZ.cjs +0 -12
- package/dist/tr-BFbCmHQZ.cjs.map +0 -1
- package/dist/tr-BiolaqkO.mjs +0 -6
- package/dist/tr-BiolaqkO.mjs.map +0 -1
- package/dist/zh_CN-Cn-k18Y5.cjs +0 -12
- package/dist/zh_CN-Cn-k18Y5.cjs.map +0 -1
- package/dist/zh_CN-DcGf3QsR.mjs +0 -6
- package/dist/zh_CN-DcGf3QsR.mjs.map +0 -1
- package/dist/zh_TW-CIUhIeJP.cjs +0 -12
- package/dist/zh_TW-CIUhIeJP.cjs.map +0 -1
- package/dist/zh_TW-DFw2O0OX.mjs +0 -6
- package/dist/zh_TW-DFw2O0OX.mjs.map +0 -1
|
@@ -9,7 +9,7 @@ const require_query_keys = require("./query-keys-e9EEoWxN.cjs");
|
|
|
9
9
|
const require_use_account = require("./use-account-D6Z9hkDX.cjs");
|
|
10
10
|
const require_AppNavigationContext = require("./AppNavigationContext-BDs1cOuG.cjs");
|
|
11
11
|
const require_AddressAutocompleteInput = require("./AddressAutocompleteInput-CbpNjpwB.cjs");
|
|
12
|
-
const
|
|
12
|
+
const require_isAfter = require("./isAfter-DXdeICis.cjs");
|
|
13
13
|
const require_SearchSort = require("./SearchSort-BP2ktxyN.cjs");
|
|
14
14
|
const require_InfiniteScrollSentinel = require("./InfiniteScrollSentinel-BaPx1tjC.cjs");
|
|
15
15
|
const require_order_status_badge = require("./order-status-badge-BKvLeVsM.cjs");
|
|
@@ -19,6 +19,66 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
19
19
|
let lucide_react = require("lucide-react");
|
|
20
20
|
let clsx = require("clsx");
|
|
21
21
|
let tailwind_merge = require("tailwind-merge");
|
|
22
|
+
//#region ../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addWeeks.js
|
|
23
|
+
/**
|
|
24
|
+
* The {@link addWeeks} function options.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* @name addWeeks
|
|
28
|
+
* @category Week Helpers
|
|
29
|
+
* @summary Add the specified number of weeks to the given date.
|
|
30
|
+
*
|
|
31
|
+
* @description
|
|
32
|
+
* Add the specified number of weeks to the given date.
|
|
33
|
+
*
|
|
34
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
35
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
36
|
+
*
|
|
37
|
+
* @param date - The date to be changed
|
|
38
|
+
* @param amount - The amount of weeks to be added.
|
|
39
|
+
* @param options - An object with options
|
|
40
|
+
*
|
|
41
|
+
* @returns The new date with the weeks added
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Add 4 weeks to 1 September 2014:
|
|
45
|
+
* const result = addWeeks(new Date(2014, 8, 1), 4)
|
|
46
|
+
* //=> Mon Sep 29 2014 00:00:00
|
|
47
|
+
*/
|
|
48
|
+
function addWeeks(date, amount, options) {
|
|
49
|
+
return require_isAfter.addDays(date, amount * 7, options);
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region ../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/addYears.js
|
|
53
|
+
/**
|
|
54
|
+
* The {@link addYears} function options.
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* @name addYears
|
|
58
|
+
* @category Year Helpers
|
|
59
|
+
* @summary Add the specified number of years to the given date.
|
|
60
|
+
*
|
|
61
|
+
* @description
|
|
62
|
+
* Add the specified number of years to the given date.
|
|
63
|
+
*
|
|
64
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
65
|
+
* @typeParam ResultDate - The result `Date` type.
|
|
66
|
+
*
|
|
67
|
+
* @param date - The date to be changed
|
|
68
|
+
* @param amount - The amount of years to be added.
|
|
69
|
+
* @param options - The options
|
|
70
|
+
*
|
|
71
|
+
* @returns The new date with the years added
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // Add 5 years to 1 September 2014:
|
|
75
|
+
* const result = addYears(new Date(2014, 8, 1), 5)
|
|
76
|
+
* //=> Sun Sep 01 2019 00:00:00
|
|
77
|
+
*/
|
|
78
|
+
function addYears(date, amount, options) {
|
|
79
|
+
return require_isAfter.addMonths(date, amount * 12, options);
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
22
82
|
//#region ../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getDefaultOptions.js
|
|
23
83
|
/**
|
|
24
84
|
* @name getDefaultOptions
|
|
@@ -45,7 +105,7 @@ let tailwind_merge = require("tailwind-merge");
|
|
|
45
105
|
* //=> { weekStarsOn: 1, firstWeekContainsDate: 4 }
|
|
46
106
|
*/
|
|
47
107
|
function getDefaultOptions() {
|
|
48
|
-
return Object.assign({},
|
|
108
|
+
return Object.assign({}, require_isAfter.getDefaultOptions());
|
|
49
109
|
}
|
|
50
110
|
//#endregion
|
|
51
111
|
//#region ../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/getISODay.js
|
|
@@ -74,7 +134,7 @@ function getDefaultOptions() {
|
|
|
74
134
|
* //=> 7
|
|
75
135
|
*/
|
|
76
136
|
function getISODay(date, options) {
|
|
77
|
-
const day =
|
|
137
|
+
const day = require_isAfter.toDate(date, options?.in).getDay();
|
|
78
138
|
return day === 0 ? 7 : day;
|
|
79
139
|
}
|
|
80
140
|
//#endregion
|
|
@@ -108,7 +168,7 @@ function getISODay(date, options) {
|
|
|
108
168
|
* //=> 'Sun Jul 10 2022 00:00:00 GMT+0000 (Coordinated Universal Time)'
|
|
109
169
|
*/
|
|
110
170
|
function transpose(date, constructor) {
|
|
111
|
-
const date_ = isConstructor(constructor) ? new constructor(0) :
|
|
171
|
+
const date_ = isConstructor(constructor) ? new constructor(0) : require_isAfter.constructFrom(constructor, 0);
|
|
112
172
|
date_.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
|
|
113
173
|
date_.setHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
114
174
|
return date_;
|
|
@@ -146,11 +206,11 @@ var DateTimezoneSetter = class extends Setter {
|
|
|
146
206
|
subPriority = -1;
|
|
147
207
|
constructor(context, reference) {
|
|
148
208
|
super();
|
|
149
|
-
this.context = context || ((date) =>
|
|
209
|
+
this.context = context || ((date) => require_isAfter.constructFrom(reference, date));
|
|
150
210
|
}
|
|
151
211
|
set(date, flags) {
|
|
152
212
|
if (flags.timestampIsSet) return date;
|
|
153
|
-
return
|
|
213
|
+
return require_isAfter.constructFrom(date, transpose(date, this.context));
|
|
154
214
|
}
|
|
155
215
|
};
|
|
156
216
|
//#endregion
|
|
@@ -253,7 +313,7 @@ function parseTimezonePattern(pattern, dateString) {
|
|
|
253
313
|
const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
|
|
254
314
|
const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
|
|
255
315
|
return {
|
|
256
|
-
value: sign * (hours *
|
|
316
|
+
value: sign * (hours * require_isAfter.millisecondsInHour + minutes * require_isAfter.millisecondsInMinute + seconds * require_isAfter.millisecondsInSecond),
|
|
257
317
|
rest: dateString.slice(matchResult[0].length)
|
|
258
318
|
};
|
|
259
319
|
}
|
|
@@ -367,17 +427,17 @@ var LocalWeekYearParser = class extends Parser {
|
|
|
367
427
|
return value.isTwoDigitYear || value.year > 0;
|
|
368
428
|
}
|
|
369
429
|
set(date, flags, value, options) {
|
|
370
|
-
const currentYear =
|
|
430
|
+
const currentYear = require_isAfter.getWeekYear(date, options);
|
|
371
431
|
if (value.isTwoDigitYear) {
|
|
372
432
|
const normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
|
|
373
433
|
date.setFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);
|
|
374
434
|
date.setHours(0, 0, 0, 0);
|
|
375
|
-
return
|
|
435
|
+
return require_isAfter.startOfWeek(date, options);
|
|
376
436
|
}
|
|
377
437
|
const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
|
378
438
|
date.setFullYear(year, 0, options.firstWeekContainsDate);
|
|
379
439
|
date.setHours(0, 0, 0, 0);
|
|
380
|
-
return
|
|
440
|
+
return require_isAfter.startOfWeek(date, options);
|
|
381
441
|
}
|
|
382
442
|
incompatibleTokens = [
|
|
383
443
|
"y",
|
|
@@ -404,10 +464,10 @@ var ISOWeekYearParser = class extends Parser {
|
|
|
404
464
|
return parseNDigitsSigned(token.length, dateString);
|
|
405
465
|
}
|
|
406
466
|
set(date, _flags, value) {
|
|
407
|
-
const firstWeekOfYear =
|
|
467
|
+
const firstWeekOfYear = require_isAfter.constructFrom(date, 0);
|
|
408
468
|
firstWeekOfYear.setFullYear(value, 0, 4);
|
|
409
469
|
firstWeekOfYear.setHours(0, 0, 0, 0);
|
|
410
|
-
return
|
|
470
|
+
return require_isAfter.startOfISOWeek(firstWeekOfYear);
|
|
411
471
|
}
|
|
412
472
|
incompatibleTokens = [
|
|
413
473
|
"G",
|
|
@@ -726,10 +786,10 @@ var StandAloneMonthParser = class extends Parser {
|
|
|
726
786
|
* //=> Sun Jan 4 2004 00:00:00
|
|
727
787
|
*/
|
|
728
788
|
function setWeek(date, week, options) {
|
|
729
|
-
const date_ =
|
|
730
|
-
const diff =
|
|
789
|
+
const date_ = require_isAfter.toDate(date, options?.in);
|
|
790
|
+
const diff = require_isAfter.getWeek(date_, options) - week;
|
|
731
791
|
date_.setDate(date_.getDate() - diff * 7);
|
|
732
|
-
return
|
|
792
|
+
return require_isAfter.toDate(date_, options?.in);
|
|
733
793
|
}
|
|
734
794
|
//#endregion
|
|
735
795
|
//#region ../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js
|
|
@@ -746,7 +806,7 @@ var LocalWeekParser = class extends Parser {
|
|
|
746
806
|
return value >= 1 && value <= 53;
|
|
747
807
|
}
|
|
748
808
|
set(date, _flags, value, options) {
|
|
749
|
-
return
|
|
809
|
+
return require_isAfter.startOfWeek(setWeek(date, value, options), options);
|
|
750
810
|
}
|
|
751
811
|
incompatibleTokens = [
|
|
752
812
|
"y",
|
|
@@ -794,8 +854,8 @@ var LocalWeekParser = class extends Parser {
|
|
|
794
854
|
* //=> Sat Jan 01 2005 00:00:00
|
|
795
855
|
*/
|
|
796
856
|
function setISOWeek(date, week, options) {
|
|
797
|
-
const _date =
|
|
798
|
-
const diff =
|
|
857
|
+
const _date = require_isAfter.toDate(date, options?.in);
|
|
858
|
+
const diff = require_isAfter.getISOWeek(_date, options) - week;
|
|
799
859
|
_date.setDate(_date.getDate() - diff * 7);
|
|
800
860
|
return _date;
|
|
801
861
|
}
|
|
@@ -814,7 +874,7 @@ var ISOWeekParser = class extends Parser {
|
|
|
814
874
|
return value >= 1 && value <= 53;
|
|
815
875
|
}
|
|
816
876
|
set(date, _flags, value) {
|
|
817
|
-
return
|
|
877
|
+
return require_isAfter.startOfISOWeek(setISOWeek(date, value));
|
|
818
878
|
}
|
|
819
879
|
incompatibleTokens = [
|
|
820
880
|
"y",
|
|
@@ -972,13 +1032,13 @@ var DayOfYearParser = class extends Parser {
|
|
|
972
1032
|
* //=> Sun Sep 07 2014 00:00:00
|
|
973
1033
|
*/
|
|
974
1034
|
function setDay(date, day, options) {
|
|
975
|
-
const defaultOptions =
|
|
1035
|
+
const defaultOptions = require_isAfter.getDefaultOptions();
|
|
976
1036
|
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
977
|
-
const date_ =
|
|
1037
|
+
const date_ = require_isAfter.toDate(date, options?.in);
|
|
978
1038
|
const currentDay = date_.getDay();
|
|
979
1039
|
const dayIndex = (day % 7 + 7) % 7;
|
|
980
1040
|
const delta = 7 - weekStartsOn;
|
|
981
|
-
return
|
|
1041
|
+
return require_isAfter.addDays(date_, day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7, options);
|
|
982
1042
|
}
|
|
983
1043
|
//#endregion
|
|
984
1044
|
//#region ../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/DayParser.js
|
|
@@ -1221,8 +1281,8 @@ var StandAloneLocalDayParser = class extends Parser {
|
|
|
1221
1281
|
* //=> Sun Sep 07 2014 00:00:00
|
|
1222
1282
|
*/
|
|
1223
1283
|
function setISODay(date, day, options) {
|
|
1224
|
-
const date_ =
|
|
1225
|
-
return
|
|
1284
|
+
const date_ = require_isAfter.toDate(date, options?.in);
|
|
1285
|
+
return require_isAfter.addDays(date_, day - getISODay(date_, options), options);
|
|
1226
1286
|
}
|
|
1227
1287
|
//#endregion
|
|
1228
1288
|
//#region ../../../node_modules/.pnpm/date-fns@4.1.0/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js
|
|
@@ -1611,7 +1671,7 @@ var ISOTimezoneWithZParser = class extends Parser {
|
|
|
1611
1671
|
}
|
|
1612
1672
|
set(date, flags, value) {
|
|
1613
1673
|
if (flags.timestampIsSet) return date;
|
|
1614
|
-
return
|
|
1674
|
+
return require_isAfter.constructFrom(date, date.getTime() - require_isAfter.getTimezoneOffsetInMilliseconds(date) - value);
|
|
1615
1675
|
}
|
|
1616
1676
|
incompatibleTokens = [
|
|
1617
1677
|
"t",
|
|
@@ -1634,7 +1694,7 @@ var ISOTimezoneParser = class extends Parser {
|
|
|
1634
1694
|
}
|
|
1635
1695
|
set(date, flags, value) {
|
|
1636
1696
|
if (flags.timestampIsSet) return date;
|
|
1637
|
-
return
|
|
1697
|
+
return require_isAfter.constructFrom(date, date.getTime() - require_isAfter.getTimezoneOffsetInMilliseconds(date) - value);
|
|
1638
1698
|
}
|
|
1639
1699
|
incompatibleTokens = [
|
|
1640
1700
|
"t",
|
|
@@ -1650,7 +1710,7 @@ var TimestampSecondsParser = class extends Parser {
|
|
|
1650
1710
|
return parseAnyDigitsSigned(dateString);
|
|
1651
1711
|
}
|
|
1652
1712
|
set(date, _flags, value) {
|
|
1653
|
-
return [
|
|
1713
|
+
return [require_isAfter.constructFrom(date, value * 1e3), { timestampIsSet: true }];
|
|
1654
1714
|
}
|
|
1655
1715
|
incompatibleTokens = "*";
|
|
1656
1716
|
};
|
|
@@ -1662,7 +1722,7 @@ var TimestampMillisecondsParser = class extends Parser {
|
|
|
1662
1722
|
return parseAnyDigitsSigned(dateString);
|
|
1663
1723
|
}
|
|
1664
1724
|
set(date, _flags, value) {
|
|
1665
|
-
return [
|
|
1725
|
+
return [require_isAfter.constructFrom(date, value), { timestampIsSet: true }];
|
|
1666
1726
|
}
|
|
1667
1727
|
incompatibleTokens = "*";
|
|
1668
1728
|
};
|
|
@@ -2011,12 +2071,12 @@ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
|
2011
2071
|
* //=> Sun Feb 28 2010 00:00:00
|
|
2012
2072
|
*/
|
|
2013
2073
|
function parse(dateStr, formatStr, referenceDate, options) {
|
|
2014
|
-
const invalidDate = () =>
|
|
2074
|
+
const invalidDate = () => require_isAfter.constructFrom(options?.in || referenceDate, NaN);
|
|
2015
2075
|
const defaultOptions = getDefaultOptions();
|
|
2016
|
-
const locale = options?.locale ?? defaultOptions.locale ??
|
|
2076
|
+
const locale = options?.locale ?? defaultOptions.locale ?? require_isAfter.enUS;
|
|
2017
2077
|
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
|
|
2018
2078
|
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
2019
|
-
if (!formatStr) return dateStr ? invalidDate() :
|
|
2079
|
+
if (!formatStr) return dateStr ? invalidDate() : require_isAfter.toDate(referenceDate, options?.in);
|
|
2020
2080
|
const subFnOptions = {
|
|
2021
2081
|
firstWeekContainsDate,
|
|
2022
2082
|
weekStartsOn,
|
|
@@ -2025,16 +2085,16 @@ function parse(dateStr, formatStr, referenceDate, options) {
|
|
|
2025
2085
|
const setters = [new DateTimezoneSetter(options?.in, referenceDate)];
|
|
2026
2086
|
const tokens = formatStr.match(longFormattingTokensRegExp).map((substring) => {
|
|
2027
2087
|
const firstCharacter = substring[0];
|
|
2028
|
-
if (firstCharacter in
|
|
2029
|
-
const longFormatter =
|
|
2088
|
+
if (firstCharacter in require_isAfter.longFormatters) {
|
|
2089
|
+
const longFormatter = require_isAfter.longFormatters[firstCharacter];
|
|
2030
2090
|
return longFormatter(substring, locale.formatLong);
|
|
2031
2091
|
}
|
|
2032
2092
|
return substring;
|
|
2033
2093
|
}).join("").match(formattingTokensRegExp);
|
|
2034
2094
|
const usedTokens = [];
|
|
2035
2095
|
for (let token of tokens) {
|
|
2036
|
-
if (!options?.useAdditionalWeekYearTokens &&
|
|
2037
|
-
if (!options?.useAdditionalDayOfYearTokens &&
|
|
2096
|
+
if (!options?.useAdditionalWeekYearTokens && require_isAfter.isProtectedWeekYearToken(token)) require_isAfter.warnOrThrowProtectedError(token, formatStr, dateStr);
|
|
2097
|
+
if (!options?.useAdditionalDayOfYearTokens && require_isAfter.isProtectedDayOfYearToken(token)) require_isAfter.warnOrThrowProtectedError(token, formatStr, dateStr);
|
|
2038
2098
|
const firstCharacter = token[0];
|
|
2039
2099
|
const parser = parsers[firstCharacter];
|
|
2040
2100
|
if (parser) {
|
|
@@ -2061,7 +2121,7 @@ function parse(dateStr, formatStr, referenceDate, options) {
|
|
|
2061
2121
|
}
|
|
2062
2122
|
if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) return invalidDate();
|
|
2063
2123
|
const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a, b) => b - a).filter((priority, index, array) => array.indexOf(priority) === index).map((priority) => setters.filter((setter) => setter.priority === priority).sort((a, b) => b.subPriority - a.subPriority)).map((setterArray) => setterArray[0]);
|
|
2064
|
-
let date =
|
|
2124
|
+
let date = require_isAfter.toDate(referenceDate, options?.in);
|
|
2065
2125
|
if (isNaN(+date)) return invalidDate();
|
|
2066
2126
|
const flags = {};
|
|
2067
2127
|
for (const setter of uniquePrioritySetters) {
|
|
@@ -2110,6 +2170,16 @@ const subscriptionsKeys = {
|
|
|
2110
2170
|
]
|
|
2111
2171
|
};
|
|
2112
2172
|
//#endregion
|
|
2173
|
+
//#region ../../subscriptions/core/src/hooks/use-subscriptions.ts
|
|
2174
|
+
function useSubscriptions(params, options) {
|
|
2175
|
+
const api = useSubscriptionsApi();
|
|
2176
|
+
return (0, _tanstack_react_query.useQuery)({
|
|
2177
|
+
queryKey: subscriptionsKeys.list(params),
|
|
2178
|
+
queryFn: () => api.fetchCustomerSubscriptions(params),
|
|
2179
|
+
enabled: options?.enabled ?? !!params.customerId
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2182
|
+
//#endregion
|
|
2113
2183
|
//#region ../../subscriptions/core/src/hooks/use-infinite-subscriptions.ts
|
|
2114
2184
|
function useInfiniteSubscriptions(params, options) {
|
|
2115
2185
|
const api = useSubscriptionsApi();
|
|
@@ -2637,6 +2707,7 @@ function createPortalSubscriptionsAdapter(client) {
|
|
|
2637
2707
|
const subscription = {};
|
|
2638
2708
|
if (body.payment_method_id != null) subscription.payment_method_id = body.payment_method_id;
|
|
2639
2709
|
if (body.quantity != null) subscription.quantity = body.quantity;
|
|
2710
|
+
if (body.next_bill_date != null) subscription.next_bill_date = body.next_bill_date;
|
|
2640
2711
|
return mapSubscriptionDetail(await require_portal_tenant.subscriptions_update(client, subscriptionToken, { subscription }));
|
|
2641
2712
|
}
|
|
2642
2713
|
};
|
|
@@ -3002,92 +3073,127 @@ function SubscriptionsListScreen({ customerId, isLoadingCustomer }) {
|
|
|
3002
3073
|
});
|
|
3003
3074
|
}
|
|
3004
3075
|
//#endregion
|
|
3005
|
-
//#region ../../subscriptions/ui/src/components/
|
|
3006
|
-
|
|
3076
|
+
//#region ../../subscriptions/ui/src/components/cancel-subscription-dialog.tsx
|
|
3077
|
+
const PAUSE_MONTH_OPTIONS = [
|
|
3078
|
+
1,
|
|
3079
|
+
2,
|
|
3080
|
+
3
|
|
3081
|
+
];
|
|
3082
|
+
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" }) {
|
|
3007
3083
|
const [isPending, setIsPending] = (0, react.useState)(false);
|
|
3084
|
+
const [selectedMonths, setSelectedMonths] = (0, react.useState)(null);
|
|
3085
|
+
(0, react.useEffect)(() => {
|
|
3086
|
+
if (!open) setSelectedMonths(null);
|
|
3087
|
+
}, [open]);
|
|
3008
3088
|
const handleConfirm = async () => {
|
|
3089
|
+
const result = onConfirm();
|
|
3090
|
+
if (!(result instanceof Promise)) {
|
|
3091
|
+
onOpenChange(false);
|
|
3092
|
+
return;
|
|
3093
|
+
}
|
|
3094
|
+
setIsPending(true);
|
|
3009
3095
|
try {
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
setIsPending(true);
|
|
3013
|
-
await result;
|
|
3014
|
-
}
|
|
3096
|
+
await result;
|
|
3097
|
+
onOpenChange(false);
|
|
3015
3098
|
} catch (error) {
|
|
3016
|
-
console.error("
|
|
3099
|
+
console.error("CancelSubscriptionDialog: action rejected", error);
|
|
3017
3100
|
} finally {
|
|
3018
3101
|
setIsPending(false);
|
|
3019
|
-
setOpen(false);
|
|
3020
3102
|
}
|
|
3021
3103
|
};
|
|
3104
|
+
const handlePause = () => {
|
|
3105
|
+
if (!selectedMonths) return;
|
|
3106
|
+
onPauseInstead(selectedMonths);
|
|
3107
|
+
};
|
|
3022
3108
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.AlertDialog, {
|
|
3023
3109
|
open,
|
|
3024
|
-
onOpenChange: (v) => !isPending &&
|
|
3025
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.AlertDialogContent, { children: [
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3110
|
+
onOpenChange: (v) => !isPending && onOpenChange(v),
|
|
3111
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.AlertDialogContent, { children: [
|
|
3112
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.AlertDialogHeader, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.AlertDialogTitle, { children: title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.AlertDialogDescription, { children: description })] }),
|
|
3113
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3114
|
+
className: "border-border space-y-2 rounded-md border p-3",
|
|
3115
|
+
children: [
|
|
3116
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3117
|
+
className: "text-foreground text-sm font-medium",
|
|
3118
|
+
children: pauseQuestion
|
|
3119
|
+
}),
|
|
3120
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3121
|
+
htmlFor: "cancel-pause-months",
|
|
3122
|
+
className: "text-foreground text-sm font-semibold",
|
|
3123
|
+
children: "Pause for"
|
|
3124
|
+
}),
|
|
3125
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Select, {
|
|
3126
|
+
value: selectedMonths ? String(selectedMonths) : void 0,
|
|
3127
|
+
onValueChange: (value) => setSelectedMonths(value ? Number(value) : null),
|
|
3128
|
+
disabled: isPending,
|
|
3129
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectTrigger, {
|
|
3130
|
+
id: "cancel-pause-months",
|
|
3131
|
+
className: "w-full",
|
|
3132
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectValue, { placeholder: "Select duration" })
|
|
3133
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectContent, { children: PAUSE_MONTH_OPTIONS.map((months) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.SelectItem, {
|
|
3134
|
+
value: String(months),
|
|
3135
|
+
children: [
|
|
3136
|
+
months,
|
|
3137
|
+
" ",
|
|
3138
|
+
months === 1 ? "month" : "months"
|
|
3139
|
+
]
|
|
3140
|
+
}, months)) })]
|
|
3141
|
+
}),
|
|
3142
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3143
|
+
variant: "outline",
|
|
3144
|
+
onClick: handlePause,
|
|
3145
|
+
disabled: isPending || !selectedMonths,
|
|
3146
|
+
className: "w-full",
|
|
3147
|
+
children: pauseButtonText
|
|
3148
|
+
})
|
|
3149
|
+
]
|
|
3150
|
+
}),
|
|
3151
|
+
errorMessage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3152
|
+
className: "text-destructive text-left text-sm",
|
|
3153
|
+
children: errorMessage
|
|
3154
|
+
}),
|
|
3155
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.AlertDialogFooter, {
|
|
3156
|
+
className: "flex-col gap-2 sm:flex-row sm:justify-end",
|
|
3157
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.AlertDialogCancel, {
|
|
3158
|
+
disabled: isPending,
|
|
3159
|
+
children: cancelButtonText
|
|
3160
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3161
|
+
variant: "destructive",
|
|
3162
|
+
onClick: handleConfirm,
|
|
3163
|
+
disabled: isPending,
|
|
3164
|
+
autoFocus: true,
|
|
3165
|
+
children: isPending ? "..." : actionButtonText
|
|
3166
|
+
})]
|
|
3167
|
+
})
|
|
3168
|
+
] })
|
|
3034
3169
|
});
|
|
3035
3170
|
}
|
|
3036
3171
|
//#endregion
|
|
3037
|
-
//#region ../../subscriptions/ui/src/lib/parse-iso-date.ts
|
|
3038
|
-
const ISO_DATE = "yyyy-MM-dd";
|
|
3039
|
-
/**
|
|
3040
|
-
* Parse an ISO date string as local midnight. Accepts either a bare
|
|
3041
|
-
* "yyyy-MM-dd" or a full ISO timestamp — both are sliced to the date
|
|
3042
|
-
* portion first so the result lands on the intended calendar day
|
|
3043
|
-
* regardless of the viewer's timezone.
|
|
3044
|
-
*/
|
|
3045
|
-
function parseIsoDate(value) {
|
|
3046
|
-
return parse(value.slice(0, 10), ISO_DATE, /* @__PURE__ */ new Date());
|
|
3047
|
-
}
|
|
3048
|
-
//#endregion
|
|
3049
3172
|
//#region ../../subscriptions/ui/src/components/pause-subscription-dialog.tsx
|
|
3050
3173
|
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" }) {
|
|
3051
|
-
const [pauseType, setPauseType] = (0, react.useState)("
|
|
3052
|
-
const [selectedDate, setSelectedDate] = (0, react.useState)(void 0);
|
|
3053
|
-
const [calendarOpen, setCalendarOpen] = (0, react.useState)(false);
|
|
3174
|
+
const [pauseType, setPauseType] = (0, react.useState)("indefinite");
|
|
3054
3175
|
const [selectedOrderCount, setSelectedOrderCount] = (0, react.useState)(null);
|
|
3055
|
-
const today = /* @__PURE__ */ new Date();
|
|
3056
|
-
today.setHours(0, 0, 0, 0);
|
|
3057
|
-
const minDate = require_format.addDays(today, 1);
|
|
3058
3176
|
const orderCountOptions = Array.from({ length: 99 }, (_, i) => i + 1);
|
|
3059
3177
|
const calculatedResumeDate = selectedOrderCount && currentNextBillDate ? calculateResumeDate(billingInterval, billingIntervalUnit, selectedOrderCount, currentNextBillDate) : null;
|
|
3060
3178
|
(0, react.useEffect)(() => {
|
|
3061
3179
|
if (!open) return;
|
|
3062
|
-
setPauseType("
|
|
3180
|
+
setPauseType("indefinite");
|
|
3063
3181
|
setSelectedOrderCount(null);
|
|
3064
|
-
|
|
3065
|
-
const initial = parseIsoDate(currentNextBillDate);
|
|
3066
|
-
setSelectedDate(initial < minDate ? minDate : initial);
|
|
3067
|
-
} else setSelectedDate(void 0);
|
|
3068
|
-
}, [open, currentNextBillDate]);
|
|
3182
|
+
}, [open]);
|
|
3069
3183
|
const handleConfirm = () => {
|
|
3070
3184
|
if (pauseType === "indefinite") {
|
|
3071
3185
|
onConfirm({ type: "indefinite" });
|
|
3072
3186
|
return;
|
|
3073
3187
|
}
|
|
3074
|
-
if (pauseType === "order_count" && selectedOrderCount) {
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
numberOfOrders: selectedOrderCount
|
|
3078
|
-
});
|
|
3079
|
-
return;
|
|
3080
|
-
}
|
|
3081
|
-
if (pauseType === "specific" && selectedDate) onConfirm({
|
|
3082
|
-
type: "specific",
|
|
3083
|
-
nextBillDate: require_format.format(selectedDate, "yyyy-MM-dd")
|
|
3188
|
+
if (pauseType === "order_count" && selectedOrderCount) onConfirm({
|
|
3189
|
+
type: "order_count",
|
|
3190
|
+
numberOfOrders: selectedOrderCount
|
|
3084
3191
|
});
|
|
3085
3192
|
};
|
|
3086
3193
|
const handleDismiss = (next) => {
|
|
3087
3194
|
if (!next) {
|
|
3088
|
-
setPauseType("
|
|
3195
|
+
setPauseType("indefinite");
|
|
3089
3196
|
setSelectedOrderCount(null);
|
|
3090
|
-
setSelectedDate(void 0);
|
|
3091
3197
|
}
|
|
3092
3198
|
onOpenChange(next);
|
|
3093
3199
|
};
|
|
@@ -3097,29 +3203,24 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3097
3203
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: "Resume" }),
|
|
3098
3204
|
" from your account."
|
|
3099
3205
|
] });
|
|
3100
|
-
if (
|
|
3101
|
-
let displayDate;
|
|
3102
|
-
if (pauseType === "order_count" && calculatedResumeDate) displayDate = require_format.format(calculatedResumeDate, "MMMM d, yyyy");
|
|
3103
|
-
else if (pauseType === "specific" && selectedDate) displayDate = require_format.format(selectedDate, "MMMM d, yyyy");
|
|
3104
|
-
else if (currentNextBillDate) displayDate = require_format.format(parseIsoDate(currentNextBillDate), "MMMM d, yyyy");
|
|
3105
|
-
else displayDate = "a future date";
|
|
3206
|
+
if (!selectedOrderCount) return null;
|
|
3106
3207
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3107
3208
|
"You won't be charged until your subscription resumes on",
|
|
3108
3209
|
" ",
|
|
3109
3210
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3110
3211
|
className: "font-semibold",
|
|
3111
|
-
children:
|
|
3212
|
+
children: calculatedResumeDate ? require_isAfter.format(calculatedResumeDate, "MMMM d, yyyy") : "a future date"
|
|
3112
3213
|
}),
|
|
3113
3214
|
"."
|
|
3114
3215
|
] });
|
|
3115
3216
|
})();
|
|
3116
|
-
const isActionDisabled = pauseType === "
|
|
3217
|
+
const isActionDisabled = pauseType === "order_count" && !selectedOrderCount;
|
|
3117
3218
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Dialog, {
|
|
3118
3219
|
open,
|
|
3119
3220
|
onOpenChange: handleDismiss,
|
|
3120
3221
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.DialogContent, {
|
|
3121
3222
|
"aria-describedby": "pause-subscription-dialog-description",
|
|
3122
|
-
className: "
|
|
3223
|
+
className: "rounded",
|
|
3123
3224
|
children: [
|
|
3124
3225
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DialogHeader, {
|
|
3125
3226
|
className: "flex flex-row justify-between",
|
|
@@ -3186,57 +3287,6 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3186
3287
|
})]
|
|
3187
3288
|
})]
|
|
3188
3289
|
}),
|
|
3189
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3190
|
-
className: "space-y-2",
|
|
3191
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3192
|
-
className: "flex items-center space-x-2",
|
|
3193
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3194
|
-
id: "pause-until-date",
|
|
3195
|
-
type: "radio",
|
|
3196
|
-
checked: pauseType === "specific",
|
|
3197
|
-
onChange: () => setPauseType("specific"),
|
|
3198
|
-
className: "border-border accent-primary h-4 w-4 focus:ring-0"
|
|
3199
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3200
|
-
htmlFor: "pause-until-date",
|
|
3201
|
-
className: "text-foreground cursor-pointer text-sm font-medium",
|
|
3202
|
-
children: "Pause until a specific date"
|
|
3203
|
-
})]
|
|
3204
|
-
}), pauseType === "specific" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3205
|
-
className: "ml-6",
|
|
3206
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Popover, {
|
|
3207
|
-
open: calendarOpen,
|
|
3208
|
-
onOpenChange: setCalendarOpen,
|
|
3209
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PopoverTrigger, {
|
|
3210
|
-
asChild: true,
|
|
3211
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
3212
|
-
variant: "outline",
|
|
3213
|
-
className: require_src.cn("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"),
|
|
3214
|
-
children: [selectedDate ? require_format.format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "mm/dd/yyyy" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarIcon, { className: "text-muted-foreground ml-auto h-4 w-4" })]
|
|
3215
|
-
})
|
|
3216
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PopoverContent, {
|
|
3217
|
-
className: "bg-popover w-auto rounded-md border p-0 shadow-lg",
|
|
3218
|
-
align: "start",
|
|
3219
|
-
sideOffset: 4,
|
|
3220
|
-
style: { zIndex: 9999 },
|
|
3221
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Calendar, {
|
|
3222
|
-
mode: "single",
|
|
3223
|
-
selected: selectedDate,
|
|
3224
|
-
onSelect: (date) => {
|
|
3225
|
-
setSelectedDate(date);
|
|
3226
|
-
setCalendarOpen(false);
|
|
3227
|
-
},
|
|
3228
|
-
disabled: (date) => date < minDate,
|
|
3229
|
-
defaultMonth: selectedDate ?? (currentNextBillDate ? parseIsoDate(currentNextBillDate) : void 0),
|
|
3230
|
-
modifiersStyles: { selected: {
|
|
3231
|
-
backgroundColor: "var(--primary)",
|
|
3232
|
-
color: "var(--primary-foreground)"
|
|
3233
|
-
} },
|
|
3234
|
-
initialFocus: true
|
|
3235
|
-
})
|
|
3236
|
-
})]
|
|
3237
|
-
})
|
|
3238
|
-
})]
|
|
3239
|
-
}),
|
|
3240
3290
|
statusMessage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3241
3291
|
className: "text-muted-foreground text-xs",
|
|
3242
3292
|
children: statusMessage
|
|
@@ -3251,12 +3301,13 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3251
3301
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DialogFooter, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3252
3302
|
className: "flex w-full flex-row justify-between space-x-2",
|
|
3253
3303
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3254
|
-
|
|
3304
|
+
variant: "outline",
|
|
3305
|
+
className: "h-10 min-w-[70px] rounded p-3",
|
|
3255
3306
|
onClick: () => handleDismiss(false),
|
|
3256
3307
|
children: "Cancel"
|
|
3257
3308
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3258
3309
|
type: "button",
|
|
3259
|
-
className: "
|
|
3310
|
+
className: "h-10 min-w-[70px] rounded p-3",
|
|
3260
3311
|
onClick: handleConfirm,
|
|
3261
3312
|
disabled: isActionDisabled || isLoading,
|
|
3262
3313
|
children: isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) : actionText
|
|
@@ -3267,13 +3318,25 @@ function PauseSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, err
|
|
|
3267
3318
|
});
|
|
3268
3319
|
}
|
|
3269
3320
|
//#endregion
|
|
3321
|
+
//#region ../../subscriptions/ui/src/lib/parse-iso-date.ts
|
|
3322
|
+
const ISO_DATE = "yyyy-MM-dd";
|
|
3323
|
+
/**
|
|
3324
|
+
* Parse an ISO date string as local midnight. Accepts either a bare
|
|
3325
|
+
* "yyyy-MM-dd" or a full ISO timestamp — both are sliced to the date
|
|
3326
|
+
* portion first so the result lands on the intended calendar day
|
|
3327
|
+
* regardless of the viewer's timezone.
|
|
3328
|
+
*/
|
|
3329
|
+
function parseIsoDate(value) {
|
|
3330
|
+
return parse(value.slice(0, 10), ISO_DATE, /* @__PURE__ */ new Date());
|
|
3331
|
+
}
|
|
3332
|
+
//#endregion
|
|
3270
3333
|
//#region ../../subscriptions/ui/src/components/resume-subscription-dialog.tsx
|
|
3271
3334
|
function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, errorMessage, defaultNextBillDate, title = "Resume subscription", description = "Choose the date your subscription should resume.", actionText = "Resume" }) {
|
|
3272
3335
|
const [selectedDate, setSelectedDate] = (0, react.useState)(void 0);
|
|
3273
3336
|
const [calendarOpen, setCalendarOpen] = (0, react.useState)(false);
|
|
3274
3337
|
const today = /* @__PURE__ */ new Date();
|
|
3275
3338
|
today.setHours(0, 0, 0, 0);
|
|
3276
|
-
const minDate =
|
|
3339
|
+
const minDate = require_isAfter.addDays(today, 1);
|
|
3277
3340
|
(0, react.useEffect)(() => {
|
|
3278
3341
|
if (!open) return;
|
|
3279
3342
|
if (defaultNextBillDate) {
|
|
@@ -3283,7 +3346,7 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3283
3346
|
}, [open, defaultNextBillDate]);
|
|
3284
3347
|
const handleConfirm = () => {
|
|
3285
3348
|
if (!selectedDate) return;
|
|
3286
|
-
onConfirm(
|
|
3349
|
+
onConfirm(require_isAfter.format(selectedDate, "yyyy-MM-dd"));
|
|
3287
3350
|
};
|
|
3288
3351
|
const handleDismiss = (next) => {
|
|
3289
3352
|
if (!next) setSelectedDate(void 0);
|
|
@@ -3294,7 +3357,7 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3294
3357
|
onOpenChange: handleDismiss,
|
|
3295
3358
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.DialogContent, {
|
|
3296
3359
|
"aria-describedby": "resume-subscription-dialog-description",
|
|
3297
|
-
className: "
|
|
3360
|
+
className: "rounded",
|
|
3298
3361
|
children: [
|
|
3299
3362
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DialogHeader, {
|
|
3300
3363
|
className: "flex flex-row justify-between",
|
|
@@ -3324,7 +3387,7 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3324
3387
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
3325
3388
|
variant: "outline",
|
|
3326
3389
|
className: require_src.cn("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"),
|
|
3327
|
-
children: [selectedDate ?
|
|
3390
|
+
children: [selectedDate ? require_isAfter.format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "mm/dd/yyyy" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarIcon, { className: "text-muted-foreground ml-auto h-4 w-4" })]
|
|
3328
3391
|
})
|
|
3329
3392
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PopoverContent, {
|
|
3330
3393
|
className: "bg-popover w-auto rounded-md border p-0 shadow-lg",
|
|
@@ -3355,7 +3418,7 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3355
3418
|
" ",
|
|
3356
3419
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3357
3420
|
className: "font-semibold",
|
|
3358
|
-
children:
|
|
3421
|
+
children: require_isAfter.format(selectedDate, "MMMM d, yyyy")
|
|
3359
3422
|
}),
|
|
3360
3423
|
"."
|
|
3361
3424
|
]
|
|
@@ -3386,6 +3449,255 @@ function ResumeSubscriptionDialog({ open, onOpenChange, onConfirm, isLoading, er
|
|
|
3386
3449
|
});
|
|
3387
3450
|
}
|
|
3388
3451
|
//#endregion
|
|
3452
|
+
//#region ../../subscriptions/ui/src/components/edit-bill-date-dialog.tsx
|
|
3453
|
+
function advanceByInterval(date, interval, unit) {
|
|
3454
|
+
const step = Math.max(1, interval);
|
|
3455
|
+
switch (unit.toLowerCase()) {
|
|
3456
|
+
case "day": return require_isAfter.addDays(date, step);
|
|
3457
|
+
case "week": return addWeeks(date, step);
|
|
3458
|
+
case "year": return addYears(date, step);
|
|
3459
|
+
default: return require_isAfter.addMonths(date, step);
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
const SUBSCRIPTION_COLORS = [
|
|
3463
|
+
"#3b82f6",
|
|
3464
|
+
"#f97316",
|
|
3465
|
+
"#10b981",
|
|
3466
|
+
"#a855f7",
|
|
3467
|
+
"#ec4899",
|
|
3468
|
+
"#eab308",
|
|
3469
|
+
"#14b8a6",
|
|
3470
|
+
"#ef4444",
|
|
3471
|
+
"#0ea5e9",
|
|
3472
|
+
"#84cc16"
|
|
3473
|
+
];
|
|
3474
|
+
const MAX_PROJECTIONS_PER_SUB = 104;
|
|
3475
|
+
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" }) {
|
|
3476
|
+
const [selectedDate, setSelectedDate] = (0, react.useState)(void 0);
|
|
3477
|
+
const [calendarOpen, setCalendarOpen] = (0, react.useState)(false);
|
|
3478
|
+
const today = /* @__PURE__ */ new Date();
|
|
3479
|
+
today.setHours(0, 0, 0, 0);
|
|
3480
|
+
const minDate = require_isAfter.addDays(today, 1);
|
|
3481
|
+
const subscriptionsWithColor = (0, react.useMemo)(() => (otherSubscriptions ?? []).map((sub, idx) => ({
|
|
3482
|
+
...sub,
|
|
3483
|
+
color: SUBSCRIPTION_COLORS[idx % SUBSCRIPTION_COLORS.length]
|
|
3484
|
+
})), [otherSubscriptions]);
|
|
3485
|
+
const billingColorsByDate = (0, react.useMemo)(() => {
|
|
3486
|
+
const m = /* @__PURE__ */ new Map();
|
|
3487
|
+
const horizon = addYears(/* @__PURE__ */ new Date(), 2);
|
|
3488
|
+
for (const sub of subscriptionsWithColor) {
|
|
3489
|
+
if (!sub.nextBillDate) continue;
|
|
3490
|
+
let d = parseIsoDate(sub.nextBillDate);
|
|
3491
|
+
let count = 0;
|
|
3492
|
+
while (!require_isAfter.isAfter(d, horizon) && count < MAX_PROJECTIONS_PER_SUB) {
|
|
3493
|
+
const key = require_isAfter.format(d, "yyyy-MM-dd");
|
|
3494
|
+
const arr = m.get(key) ?? [];
|
|
3495
|
+
arr.push(sub.color);
|
|
3496
|
+
m.set(key, arr);
|
|
3497
|
+
d = advanceByInterval(d, sub.billingInterval, sub.billingIntervalUnit);
|
|
3498
|
+
count++;
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3501
|
+
return m;
|
|
3502
|
+
}, [subscriptionsWithColor]);
|
|
3503
|
+
const calendarComponents = (0, react.useMemo)(() => ({
|
|
3504
|
+
DayContent: ({ date }) => {
|
|
3505
|
+
const key = require_isAfter.format(date, "yyyy-MM-dd");
|
|
3506
|
+
const colors = billingColorsByDate.get(key) ?? [];
|
|
3507
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3508
|
+
className: "flex h-full w-full flex-col items-center justify-center",
|
|
3509
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3510
|
+
className: "leading-none",
|
|
3511
|
+
children: date.getDate()
|
|
3512
|
+
}), colors.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3513
|
+
className: "mt-0.5 flex items-center justify-center gap-0.5",
|
|
3514
|
+
children: colors.map((c, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3515
|
+
className: "h-1 w-1 rounded-[1px]",
|
|
3516
|
+
style: { backgroundColor: c }
|
|
3517
|
+
}, `${key}-${i}`))
|
|
3518
|
+
})]
|
|
3519
|
+
});
|
|
3520
|
+
},
|
|
3521
|
+
IconLeft: ({ className: iconClassName, ...iconProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronLeft, {
|
|
3522
|
+
className: require_src.cn("h-4 w-4", iconClassName),
|
|
3523
|
+
...iconProps
|
|
3524
|
+
}),
|
|
3525
|
+
IconRight: ({ className: iconClassName, ...iconProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, {
|
|
3526
|
+
className: require_src.cn("h-4 w-4", iconClassName),
|
|
3527
|
+
...iconProps
|
|
3528
|
+
})
|
|
3529
|
+
}), [billingColorsByDate]);
|
|
3530
|
+
(0, react.useEffect)(() => {
|
|
3531
|
+
if (!open) return;
|
|
3532
|
+
if (currentNextBillDate) {
|
|
3533
|
+
const initial = parseIsoDate(currentNextBillDate);
|
|
3534
|
+
setSelectedDate(initial < minDate ? minDate : initial);
|
|
3535
|
+
} else setSelectedDate(void 0);
|
|
3536
|
+
}, [open, currentNextBillDate]);
|
|
3537
|
+
const handleConfirm = () => {
|
|
3538
|
+
if (!selectedDate) return;
|
|
3539
|
+
onConfirm(require_isAfter.format(selectedDate, "yyyy-MM-dd"));
|
|
3540
|
+
};
|
|
3541
|
+
const handleDismiss = (next) => {
|
|
3542
|
+
if (!next) setSelectedDate(void 0);
|
|
3543
|
+
onOpenChange(next);
|
|
3544
|
+
};
|
|
3545
|
+
const previewDate = selectedDate ? require_isAfter.format(selectedDate, "MMMM d, yyyy") : currentNextBillDate ? require_isAfter.format(parseIsoDate(currentNextBillDate), "MMMM d, yyyy") : "a future date";
|
|
3546
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Dialog, {
|
|
3547
|
+
open,
|
|
3548
|
+
onOpenChange: handleDismiss,
|
|
3549
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.DialogContent, {
|
|
3550
|
+
"aria-describedby": "edit-bill-date-dialog-description",
|
|
3551
|
+
className: "rounded",
|
|
3552
|
+
children: [
|
|
3553
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DialogHeader, {
|
|
3554
|
+
className: "flex flex-row justify-between",
|
|
3555
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DialogTitle, {
|
|
3556
|
+
className: "text-md w-full text-left font-medium",
|
|
3557
|
+
children: title
|
|
3558
|
+
})
|
|
3559
|
+
}),
|
|
3560
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3561
|
+
className: "space-y-4",
|
|
3562
|
+
children: [
|
|
3563
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3564
|
+
id: "edit-bill-date-dialog-description",
|
|
3565
|
+
className: "text-muted-foreground text-sm",
|
|
3566
|
+
children: description
|
|
3567
|
+
}),
|
|
3568
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3569
|
+
className: "space-y-2",
|
|
3570
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3571
|
+
className: "text-foreground text-sm font-semibold",
|
|
3572
|
+
children: "Next bill date"
|
|
3573
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Popover, {
|
|
3574
|
+
open: calendarOpen,
|
|
3575
|
+
onOpenChange: setCalendarOpen,
|
|
3576
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PopoverTrigger, {
|
|
3577
|
+
asChild: true,
|
|
3578
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
3579
|
+
variant: "outline",
|
|
3580
|
+
className: require_src.cn("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"),
|
|
3581
|
+
children: [selectedDate ? require_isAfter.format(selectedDate, "MM/dd/yyyy") : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "mm/dd/yyyy" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarIcon, { className: "text-muted-foreground ml-auto h-4 w-4" })]
|
|
3582
|
+
})
|
|
3583
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PopoverContent, {
|
|
3584
|
+
className: "bg-popover z-[9999] w-auto rounded-md border p-0 shadow-lg",
|
|
3585
|
+
align: "start",
|
|
3586
|
+
sideOffset: 4,
|
|
3587
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Calendar, {
|
|
3588
|
+
mode: "single",
|
|
3589
|
+
selected: selectedDate,
|
|
3590
|
+
onSelect: (date) => {
|
|
3591
|
+
setSelectedDate(date);
|
|
3592
|
+
setCalendarOpen(false);
|
|
3593
|
+
},
|
|
3594
|
+
disabled: (date) => date < minDate,
|
|
3595
|
+
defaultMonth: selectedDate ?? (currentNextBillDate ? parseIsoDate(currentNextBillDate) : void 0),
|
|
3596
|
+
components: calendarComponents,
|
|
3597
|
+
initialFocus: true
|
|
3598
|
+
})
|
|
3599
|
+
})]
|
|
3600
|
+
})]
|
|
3601
|
+
}),
|
|
3602
|
+
selectedDate && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3603
|
+
className: "text-muted-foreground text-xs",
|
|
3604
|
+
children: [
|
|
3605
|
+
"Your next bill will be on",
|
|
3606
|
+
" ",
|
|
3607
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3608
|
+
className: "font-semibold",
|
|
3609
|
+
children: previewDate
|
|
3610
|
+
}),
|
|
3611
|
+
"."
|
|
3612
|
+
]
|
|
3613
|
+
}),
|
|
3614
|
+
subscriptionsWithColor.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3615
|
+
className: "space-y-2",
|
|
3616
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Label, {
|
|
3617
|
+
className: "text-foreground text-sm font-semibold",
|
|
3618
|
+
children: "Your other subscriptions"
|
|
3619
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3620
|
+
className: "border-border max-h-40 overflow-auto rounded-md border",
|
|
3621
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
|
|
3622
|
+
className: "w-full table-fixed text-sm",
|
|
3623
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", {
|
|
3624
|
+
className: "bg-muted text-muted-foreground sticky top-0",
|
|
3625
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
3626
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
3627
|
+
className: "w-6 px-2 py-2",
|
|
3628
|
+
"aria-label": "Color"
|
|
3629
|
+
}),
|
|
3630
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
3631
|
+
className: "px-3 py-2 text-left font-medium",
|
|
3632
|
+
children: "Product"
|
|
3633
|
+
}),
|
|
3634
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
3635
|
+
className: "w-28 px-3 py-2 text-left font-medium",
|
|
3636
|
+
children: "Bill Date"
|
|
3637
|
+
})
|
|
3638
|
+
] })
|
|
3639
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", {
|
|
3640
|
+
className: "divide-border divide-y",
|
|
3641
|
+
children: subscriptionsWithColor.map((sub) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
3642
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
3643
|
+
className: "px-2 py-2",
|
|
3644
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3645
|
+
"aria-hidden": true,
|
|
3646
|
+
className: "inline-block h-2.5 w-2.5 rounded-full",
|
|
3647
|
+
style: { backgroundColor: sub.color }
|
|
3648
|
+
})
|
|
3649
|
+
}),
|
|
3650
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
3651
|
+
className: "overflow-hidden px-3 py-2",
|
|
3652
|
+
title: sub.productTitle,
|
|
3653
|
+
children: onNavigateToSubscription ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3654
|
+
type: "button",
|
|
3655
|
+
onClick: () => {
|
|
3656
|
+
onNavigateToSubscription(sub.token);
|
|
3657
|
+
handleDismiss(false);
|
|
3658
|
+
},
|
|
3659
|
+
className: "text-primary block w-full truncate text-left hover:underline",
|
|
3660
|
+
children: sub.productTitle
|
|
3661
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3662
|
+
className: "text-foreground block truncate",
|
|
3663
|
+
children: sub.productTitle
|
|
3664
|
+
})
|
|
3665
|
+
}),
|
|
3666
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
3667
|
+
className: "text-muted-foreground px-3 py-2 whitespace-nowrap",
|
|
3668
|
+
children: sub.nextBillDate ? require_isAfter.format(parseIsoDate(sub.nextBillDate), "MMM d, yyyy") : "—"
|
|
3669
|
+
})
|
|
3670
|
+
] }, sub.token))
|
|
3671
|
+
})]
|
|
3672
|
+
})
|
|
3673
|
+
})]
|
|
3674
|
+
})
|
|
3675
|
+
]
|
|
3676
|
+
}),
|
|
3677
|
+
errorMessage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3678
|
+
className: "text-destructive text-left text-sm",
|
|
3679
|
+
children: errorMessage
|
|
3680
|
+
}),
|
|
3681
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DialogFooter, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3682
|
+
className: "flex w-full flex-row justify-between space-x-2",
|
|
3683
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3684
|
+
variant: "outline",
|
|
3685
|
+
className: "h-10 min-w-[70px] rounded p-3",
|
|
3686
|
+
onClick: () => handleDismiss(false),
|
|
3687
|
+
children: "Cancel"
|
|
3688
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
|
|
3689
|
+
type: "button",
|
|
3690
|
+
className: "h-10 min-w-[70px] rounded p-3",
|
|
3691
|
+
onClick: handleConfirm,
|
|
3692
|
+
disabled: !selectedDate || isLoading,
|
|
3693
|
+
children: isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent" }) : actionText
|
|
3694
|
+
})]
|
|
3695
|
+
}) })
|
|
3696
|
+
]
|
|
3697
|
+
})
|
|
3698
|
+
});
|
|
3699
|
+
}
|
|
3700
|
+
//#endregion
|
|
3389
3701
|
//#region ../../subscriptions/ui/src/components/subscription-detail.tsx
|
|
3390
3702
|
function SubscriptionDetailSkeleton() {
|
|
3391
3703
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -3451,7 +3763,7 @@ function SubscriptionDetailSkeleton() {
|
|
|
3451
3763
|
})]
|
|
3452
3764
|
});
|
|
3453
3765
|
}
|
|
3454
|
-
function SubscriptionItemsSection({ subscription, displayQuantity, canEditQuantity = false, onQuantityChange, isUpdatingQuantity = false }) {
|
|
3766
|
+
function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBillDate, canEditQuantity = false, onQuantityChange, isUpdatingQuantity = false }) {
|
|
3455
3767
|
const variant = subscription.variant;
|
|
3456
3768
|
const product = variant?.product;
|
|
3457
3769
|
const quantity = displayQuantity ?? subscription.quantity;
|
|
@@ -3460,7 +3772,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, canEditQuanti
|
|
|
3460
3772
|
const discount = subscription.original_price != null ? subscription.original_price - subscription.price : 0;
|
|
3461
3773
|
const subtotal = discount > 0 ? formatCurrency(subscription.original_price * quantity) : totalPrice;
|
|
3462
3774
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
3463
|
-
className: "bg-muted flex w-full flex-col items-center px-8 lg:col-span-4",
|
|
3775
|
+
className: "bg-muted flex w-full flex-col items-center rounded-lg px-8 lg:col-span-4 lg:self-start",
|
|
3464
3776
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3465
3777
|
className: "flex w-full max-w-lg flex-col",
|
|
3466
3778
|
children: [
|
|
@@ -3480,17 +3792,27 @@ function SubscriptionItemsSection({ subscription, displayQuantity, canEditQuanti
|
|
|
3480
3792
|
children: "Next Order Date"
|
|
3481
3793
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3482
3794
|
className: "text-foreground text-2xl font-bold",
|
|
3483
|
-
children: getNextBillDisplay(
|
|
3795
|
+
children: getNextBillDisplay(displayNextBillDate ? {
|
|
3796
|
+
...subscription,
|
|
3797
|
+
next_bill_date: displayNextBillDate
|
|
3798
|
+
} : subscription)
|
|
3484
3799
|
})]
|
|
3485
3800
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3486
3801
|
className: "pl-4",
|
|
3487
|
-
children: [
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3802
|
+
children: [
|
|
3803
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3804
|
+
className: "text-muted-foreground mb-1 text-sm",
|
|
3805
|
+
children: "Next Bill Amount"
|
|
3806
|
+
}),
|
|
3807
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3808
|
+
className: "text-foreground text-2xl font-bold",
|
|
3809
|
+
children: formatCurrency(subscription.price * quantity)
|
|
3810
|
+
}),
|
|
3811
|
+
(displayNextBillDate ?? subscription.next_bill_date) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3812
|
+
className: "text-muted-foreground mt-1 text-xs",
|
|
3813
|
+
children: formatDate(displayNextBillDate ?? subscription.next_bill_date ?? "")
|
|
3814
|
+
})
|
|
3815
|
+
]
|
|
3494
3816
|
})]
|
|
3495
3817
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", { className: "border-border mt-4" })]
|
|
3496
3818
|
})]
|
|
@@ -3603,7 +3925,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, canEditQuanti
|
|
|
3603
3925
|
})
|
|
3604
3926
|
});
|
|
3605
3927
|
}
|
|
3606
|
-
function SubscriptionManagementSection({ subscription, isActive, isPaused, isCancelled, isMutating, onSkip, onPause, onResume, onCancel, onReactivate, renderPaymentMethod }) {
|
|
3928
|
+
function SubscriptionManagementSection({ subscription, isActive, isPaused, isCancelled, isMutating, onSkip, onPause, onResume, onCancel, onReactivate, onEditBillDate, displayNextBillDate, renderPaymentMethod, renderShippingAddress }) {
|
|
3607
3929
|
const plan = subscription.subscription_plan;
|
|
3608
3930
|
const quantity = subscription.quantity;
|
|
3609
3931
|
const totalPrice = formatCurrency(subscription.price * quantity);
|
|
@@ -3635,22 +3957,22 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
3635
3957
|
}),
|
|
3636
3958
|
isActive && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
3637
3959
|
variant: "outline",
|
|
3638
|
-
onClick:
|
|
3960
|
+
onClick: onEditBillDate,
|
|
3639
3961
|
disabled: isMutating,
|
|
3640
3962
|
className: actionButtonClass,
|
|
3641
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.
|
|
3963
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarDays, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3642
3964
|
className: "truncate",
|
|
3643
|
-
children: "
|
|
3965
|
+
children: "Edit Bill Date"
|
|
3644
3966
|
})]
|
|
3645
3967
|
}),
|
|
3646
|
-
|
|
3968
|
+
isActive && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
3647
3969
|
variant: "outline",
|
|
3648
|
-
onClick:
|
|
3970
|
+
onClick: onPause,
|
|
3649
3971
|
disabled: isMutating,
|
|
3650
3972
|
className: actionButtonClass,
|
|
3651
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.
|
|
3973
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Pause, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3652
3974
|
className: "truncate",
|
|
3653
|
-
children: "
|
|
3975
|
+
children: "Pause Subscription"
|
|
3654
3976
|
})]
|
|
3655
3977
|
}),
|
|
3656
3978
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
@@ -3660,7 +3982,17 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
3660
3982
|
className: actionButtonClass,
|
|
3661
3983
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.XCircle, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3662
3984
|
className: "truncate",
|
|
3663
|
-
children: isCancelled ? "Cancelled" : "Cancel Subscription"
|
|
3985
|
+
children: isCancelled ? "Cancelled Subscription" : "Cancel Subscription"
|
|
3986
|
+
})]
|
|
3987
|
+
}),
|
|
3988
|
+
isPaused && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
3989
|
+
variant: "outline",
|
|
3990
|
+
onClick: onResume,
|
|
3991
|
+
disabled: isMutating,
|
|
3992
|
+
className: actionButtonClass,
|
|
3993
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Play, { className: "h-3 w-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3994
|
+
className: "truncate",
|
|
3995
|
+
children: "Resume Subscription"
|
|
3664
3996
|
})]
|
|
3665
3997
|
}),
|
|
3666
3998
|
isCancelled && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
|
|
@@ -3702,13 +4034,20 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
3702
4034
|
}),
|
|
3703
4035
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3704
4036
|
className: "flex-1 px-4",
|
|
3705
|
-
children: [
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
4037
|
+
children: [
|
|
4038
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4039
|
+
className: "text-muted-foreground text-sm",
|
|
4040
|
+
children: "Next Payment"
|
|
4041
|
+
}),
|
|
4042
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4043
|
+
className: "text-foreground font-medium",
|
|
4044
|
+
children: totalPrice
|
|
4045
|
+
}),
|
|
4046
|
+
(displayNextBillDate ?? subscription.next_bill_date) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4047
|
+
className: "text-muted-foreground text-xs",
|
|
4048
|
+
children: formatDate(displayNextBillDate ?? subscription.next_bill_date ?? "")
|
|
4049
|
+
})
|
|
4050
|
+
]
|
|
3712
4051
|
}),
|
|
3713
4052
|
subscription.last_bill_date && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3714
4053
|
className: "flex-1 pl-4 text-right",
|
|
@@ -3730,7 +4069,12 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
3730
4069
|
children: "Payment & Shipping"
|
|
3731
4070
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3732
4071
|
className: "flex flex-col",
|
|
3733
|
-
children: [
|
|
4072
|
+
children: [renderShippingAddress ? renderShippingAddress({
|
|
4073
|
+
address: subscription.address ?? null,
|
|
4074
|
+
subscriptionToken: subscription.subscription_token,
|
|
4075
|
+
customerId: subscription.customer?.id ?? 0,
|
|
4076
|
+
countryCode: subscription.address?.country_code ?? "US"
|
|
4077
|
+
}) : subscription.address && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3734
4078
|
className: "border-border mb-6 border-b pb-4",
|
|
3735
4079
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3736
4080
|
className: "text-muted-foreground mt-3 mb-1 text-sm",
|
|
@@ -3754,7 +4098,9 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
3754
4098
|
})]
|
|
3755
4099
|
}), paymentMethod && (renderPaymentMethod ? renderPaymentMethod({
|
|
3756
4100
|
paymentMethod,
|
|
3757
|
-
subscriptionToken: subscription.subscription_token
|
|
4101
|
+
subscriptionToken: subscription.subscription_token,
|
|
4102
|
+
customerId: subscription.customer?.id ?? 0,
|
|
4103
|
+
countryCode: subscription.address?.country_code ?? "US"
|
|
3758
4104
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3759
4105
|
className: "border-border mb-6 border-b pb-4",
|
|
3760
4106
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -3773,71 +4119,87 @@ function SubscriptionManagementSection({ subscription, isActive, isPaused, isCan
|
|
|
3773
4119
|
})]
|
|
3774
4120
|
}))]
|
|
3775
4121
|
})]
|
|
3776
|
-
}),
|
|
3777
|
-
subscription.orders.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3778
|
-
className: "border-border mb-4 border-b pb-4",
|
|
3779
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
3780
|
-
className: "text-foreground mb-3 text-sm/6 font-semibold",
|
|
3781
|
-
children: "Order History"
|
|
3782
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3783
|
-
className: "overflow-x-auto",
|
|
3784
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
|
|
3785
|
-
className: "divide-border min-w-full divide-y text-sm",
|
|
3786
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
3787
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
3788
|
-
className: "text-muted-foreground py-2 pr-3 text-left font-medium",
|
|
3789
|
-
children: "Order"
|
|
3790
|
-
}),
|
|
3791
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
3792
|
-
className: "text-muted-foreground px-3 py-2 text-left font-medium",
|
|
3793
|
-
children: "Date"
|
|
3794
|
-
}),
|
|
3795
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
3796
|
-
className: "text-muted-foreground px-3 py-2 text-left font-medium",
|
|
3797
|
-
children: "Status"
|
|
3798
|
-
}),
|
|
3799
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
3800
|
-
className: "text-muted-foreground py-2 pl-3 text-right font-medium",
|
|
3801
|
-
children: "Amount"
|
|
3802
|
-
})
|
|
3803
|
-
] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", {
|
|
3804
|
-
className: "divide-border divide-y",
|
|
3805
|
-
children: subscription.orders.map((order) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
3806
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
3807
|
-
className: "text-foreground py-2 pr-3 font-medium",
|
|
3808
|
-
children: order.order_number ?? `#${order.id}`
|
|
3809
|
-
}),
|
|
3810
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
3811
|
-
className: "text-muted-foreground px-3 py-2",
|
|
3812
|
-
children: formatDate(order.created_at.split("T")[0] ?? "")
|
|
3813
|
-
}),
|
|
3814
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
3815
|
-
className: "px-3 py-2",
|
|
3816
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusPill, {
|
|
3817
|
-
status: order.status,
|
|
3818
|
-
children: startCase(order.status)
|
|
3819
|
-
})
|
|
3820
|
-
}),
|
|
3821
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
3822
|
-
className: "text-foreground py-2 pl-3 text-right",
|
|
3823
|
-
children: order.amount != null ? formatCurrency(Number(order.amount)) : "N/A"
|
|
3824
|
-
})
|
|
3825
|
-
] }, order.id))
|
|
3826
|
-
})]
|
|
3827
|
-
})
|
|
3828
|
-
})]
|
|
3829
4122
|
})
|
|
3830
4123
|
]
|
|
3831
4124
|
})
|
|
3832
4125
|
});
|
|
3833
4126
|
}
|
|
3834
|
-
function
|
|
4127
|
+
function OrderHistorySection({ subscription }) {
|
|
4128
|
+
if (subscription.orders.length === 0) return null;
|
|
4129
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
4130
|
+
className: "mt-6 px-8 pt-6 pb-8",
|
|
4131
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
4132
|
+
className: "text-foreground mb-3 text-sm/6 font-semibold",
|
|
4133
|
+
children: "Subscription Order History"
|
|
4134
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4135
|
+
className: "border-border overflow-x-auto rounded-md border",
|
|
4136
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
|
|
4137
|
+
className: "divide-border min-w-full divide-y text-sm",
|
|
4138
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", {
|
|
4139
|
+
className: "bg-muted",
|
|
4140
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
4141
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
4142
|
+
className: "text-muted-foreground py-2 pr-3 pl-3 text-left font-medium",
|
|
4143
|
+
children: "Order"
|
|
4144
|
+
}),
|
|
4145
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
4146
|
+
className: "text-muted-foreground px-3 py-2 text-left font-medium",
|
|
4147
|
+
children: "Date"
|
|
4148
|
+
}),
|
|
4149
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
4150
|
+
className: "text-muted-foreground px-3 py-2 text-left font-medium",
|
|
4151
|
+
children: "Status"
|
|
4152
|
+
}),
|
|
4153
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
4154
|
+
className: "text-muted-foreground py-2 pr-3 pl-3 text-right font-medium",
|
|
4155
|
+
children: "Amount"
|
|
4156
|
+
})
|
|
4157
|
+
] })
|
|
4158
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", {
|
|
4159
|
+
className: "divide-border divide-y",
|
|
4160
|
+
children: subscription.orders.map((order) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
4161
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
4162
|
+
className: "text-foreground py-2 pr-3 pl-3 font-medium",
|
|
4163
|
+
children: order.order_number ?? `#${order.id}`
|
|
4164
|
+
}),
|
|
4165
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
4166
|
+
className: "text-muted-foreground px-3 py-2",
|
|
4167
|
+
children: formatDate(order.created_at.split("T")[0] ?? "")
|
|
4168
|
+
}),
|
|
4169
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
4170
|
+
className: "px-3 py-2",
|
|
4171
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusPill, {
|
|
4172
|
+
status: order.status,
|
|
4173
|
+
children: startCase(order.status)
|
|
4174
|
+
})
|
|
4175
|
+
}),
|
|
4176
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
4177
|
+
className: "text-foreground py-2 pr-3 pl-3 text-right",
|
|
4178
|
+
children: order.amount != null ? formatCurrency(Number(order.amount)) : "N/A"
|
|
4179
|
+
})
|
|
4180
|
+
] }, order.id))
|
|
4181
|
+
})]
|
|
4182
|
+
})
|
|
4183
|
+
})]
|
|
4184
|
+
});
|
|
4185
|
+
}
|
|
4186
|
+
function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationError, onNavigateToSubscription, renderPaymentMethod, renderShippingAddress }) {
|
|
3835
4187
|
const [showCancelModal, setShowCancelModal] = (0, react.useState)(false);
|
|
3836
4188
|
const [showPauseModal, setShowPauseModal] = (0, react.useState)(false);
|
|
3837
4189
|
const [showResumeModal, setShowResumeModal] = (0, react.useState)(false);
|
|
4190
|
+
const [showEditBillDateModal, setShowEditBillDateModal] = (0, react.useState)(false);
|
|
4191
|
+
const [pendingNextBillDate, setPendingNextBillDate] = (0, react.useState)(null);
|
|
3838
4192
|
const { data, isLoading, error } = useSubscription(token);
|
|
3839
4193
|
const subscription = data?.subscription;
|
|
3840
4194
|
const customerId = subscription?.customer?.id ?? 0;
|
|
4195
|
+
const customerSubscriptionsQuery = useSubscriptions({ perPage: 100 }, { enabled: showEditBillDateModal });
|
|
4196
|
+
const otherSubscriptionsForBillDate = (0, react.useMemo)(() => (customerSubscriptionsQuery.data?.subscriptions ?? []).filter((s) => s.subscription_token !== token).map((s) => ({
|
|
4197
|
+
token: s.subscription_token,
|
|
4198
|
+
productTitle: s.variant?.product?.title ?? "Subscription",
|
|
4199
|
+
nextBillDate: s.next_bill_date,
|
|
4200
|
+
billingInterval: s.subscription_plan?.billing_interval ?? 1,
|
|
4201
|
+
billingIntervalUnit: s.subscription_plan?.billing_interval_unit ?? "month"
|
|
4202
|
+
})), [customerSubscriptionsQuery.data, token]);
|
|
3841
4203
|
const pauseMutation = usePauseSubscription({
|
|
3842
4204
|
onSuccess: () => onSuccess?.("Subscription paused"),
|
|
3843
4205
|
onError: (err) => onMutationError?.("Failed to pause subscription", err)
|
|
@@ -3872,6 +4234,20 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
3872
4234
|
onMutationError?.("Failed to update quantity", err);
|
|
3873
4235
|
}
|
|
3874
4236
|
});
|
|
4237
|
+
const editBillDateMutation = useUpdateSubscriptionInfo({
|
|
4238
|
+
onSuccess: () => {
|
|
4239
|
+
onSuccess?.("Bill date updated");
|
|
4240
|
+
setShowEditBillDateModal(false);
|
|
4241
|
+
},
|
|
4242
|
+
onError: (err) => {
|
|
4243
|
+
setPendingNextBillDate(null);
|
|
4244
|
+
onMutationError?.("Failed to update bill date", err);
|
|
4245
|
+
}
|
|
4246
|
+
});
|
|
4247
|
+
const serverNextBillDate = data?.subscription.next_bill_date ?? null;
|
|
4248
|
+
(0, react.useEffect)(() => {
|
|
4249
|
+
if (pendingNextBillDate != null && serverNextBillDate != null && serverNextBillDate.startsWith(pendingNextBillDate)) setPendingNextBillDate(null);
|
|
4250
|
+
}, [pendingNextBillDate, serverNextBillDate]);
|
|
3875
4251
|
const serverQuantity = data?.subscription.quantity;
|
|
3876
4252
|
(0, react.useEffect)(() => {
|
|
3877
4253
|
if (pendingQuantity != null && serverQuantity === pendingQuantity) setPendingQuantity(null);
|
|
@@ -3919,11 +4295,10 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
3919
4295
|
const isActive = subscription.status === "active";
|
|
3920
4296
|
const isPaused = subscription.status === "paused";
|
|
3921
4297
|
const isCancelled = subscription.status === "cancelled";
|
|
3922
|
-
const isMutating = pauseMutation.isPending || resumeMutation.isPending || skipMutation.isPending || cancelMutation.isPending || reactivateMutation.isPending;
|
|
4298
|
+
const isMutating = pauseMutation.isPending || resumeMutation.isPending || skipMutation.isPending || cancelMutation.isPending || reactivateMutation.isPending || editBillDateMutation.isPending;
|
|
3923
4299
|
const handlePauseConfirm = (selection) => {
|
|
3924
4300
|
const pauseParams = { customerId };
|
|
3925
4301
|
if (selection.type === "order_count") pauseParams.numberOfOrders = selection.numberOfOrders;
|
|
3926
|
-
else if (selection.type === "specific") pauseParams.nextBillDate = selection.nextBillDate;
|
|
3927
4302
|
pauseMutation.mutate({
|
|
3928
4303
|
subscriptionToken: token,
|
|
3929
4304
|
pauseParams
|
|
@@ -3966,6 +4341,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
3966
4341
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubscriptionItemsSection, {
|
|
3967
4342
|
subscription,
|
|
3968
4343
|
displayQuantity: pendingQuantity ?? void 0,
|
|
4344
|
+
displayNextBillDate: pendingNextBillDate ?? void 0,
|
|
3969
4345
|
canEditQuantity: isActive,
|
|
3970
4346
|
onQuantityChange: handleQuantityChange,
|
|
3971
4347
|
isUpdatingQuantity: quantityMutation.isPending
|
|
@@ -3980,16 +4356,46 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
3980
4356
|
onResume: () => setShowResumeModal(true),
|
|
3981
4357
|
onCancel: () => setShowCancelModal(true),
|
|
3982
4358
|
onReactivate: handleReactivate,
|
|
3983
|
-
|
|
4359
|
+
onEditBillDate: () => setShowEditBillDateModal(true),
|
|
4360
|
+
displayNextBillDate: pendingNextBillDate ?? void 0,
|
|
4361
|
+
renderPaymentMethod,
|
|
4362
|
+
renderShippingAddress
|
|
3984
4363
|
})]
|
|
3985
4364
|
}),
|
|
3986
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3987
|
-
|
|
3988
|
-
actionButtonText: "Cancel Subscription",
|
|
3989
|
-
description: "Are you sure you want to cancel this subscription? You can reactivate it later.",
|
|
4365
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OrderHistorySection, { subscription }),
|
|
4366
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CancelSubscriptionDialog, {
|
|
3990
4367
|
open: showCancelModal,
|
|
3991
|
-
|
|
3992
|
-
onConfirm: handleCancel
|
|
4368
|
+
onOpenChange: setShowCancelModal,
|
|
4369
|
+
onConfirm: handleCancel,
|
|
4370
|
+
onPauseInstead: (months) => {
|
|
4371
|
+
setShowCancelModal(false);
|
|
4372
|
+
pauseMutation.mutate({
|
|
4373
|
+
subscriptionToken: token,
|
|
4374
|
+
pauseParams: {
|
|
4375
|
+
customerId,
|
|
4376
|
+
nextBillDate: require_isAfter.format(require_isAfter.addMonths(/* @__PURE__ */ new Date(), months), "yyyy-MM-dd")
|
|
4377
|
+
}
|
|
4378
|
+
});
|
|
4379
|
+
}
|
|
4380
|
+
}),
|
|
4381
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditBillDateDialog, {
|
|
4382
|
+
open: showEditBillDateModal,
|
|
4383
|
+
onOpenChange: (next) => {
|
|
4384
|
+
if (!next) editBillDateMutation.reset();
|
|
4385
|
+
setShowEditBillDateModal(next);
|
|
4386
|
+
},
|
|
4387
|
+
onConfirm: (nextBillDate) => {
|
|
4388
|
+
setPendingNextBillDate(nextBillDate);
|
|
4389
|
+
editBillDateMutation.mutate({
|
|
4390
|
+
subscriptionToken: token,
|
|
4391
|
+
body: { next_bill_date: nextBillDate }
|
|
4392
|
+
});
|
|
4393
|
+
},
|
|
4394
|
+
isLoading: editBillDateMutation.isPending,
|
|
4395
|
+
errorMessage: editBillDateMutation.isError ? "Could not update the bill date. Please try a different date." : void 0,
|
|
4396
|
+
currentNextBillDate: subscription.next_bill_date,
|
|
4397
|
+
otherSubscriptions: otherSubscriptionsForBillDate,
|
|
4398
|
+
onNavigateToSubscription
|
|
3993
4399
|
}),
|
|
3994
4400
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PauseSubscriptionDialog, {
|
|
3995
4401
|
open: showPauseModal,
|
|
@@ -4019,7 +4425,7 @@ function SubscriptionDetail({ token, onNotFound, onError, onSuccess, onMutationE
|
|
|
4019
4425
|
}
|
|
4020
4426
|
//#endregion
|
|
4021
4427
|
//#region ../../subscriptions/ui/src/screens/SubscriptionDetailScreen.tsx
|
|
4022
|
-
function SubscriptionDetailScreen$1({ token, onNavigateToList, onNotFound, onError, onSuccess, onMutationError, renderPaymentMethod }) {
|
|
4428
|
+
function SubscriptionDetailScreen$1({ token, onNavigateToList, onNavigateToSubscription, onNotFound, onError, onSuccess, onMutationError, renderPaymentMethod, renderShippingAddress }) {
|
|
4023
4429
|
require_ScreenHeaderContext.useScreenHeaderBreadcrumbs((0, react.useMemo)(() => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Breadcrumb, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.BreadcrumbList, {
|
|
4024
4430
|
className: "text-lg",
|
|
4025
4431
|
children: [
|
|
@@ -4046,7 +4452,9 @@ function SubscriptionDetailScreen$1({ token, onNavigateToList, onNotFound, onErr
|
|
|
4046
4452
|
onError,
|
|
4047
4453
|
onSuccess,
|
|
4048
4454
|
onMutationError,
|
|
4049
|
-
|
|
4455
|
+
onNavigateToSubscription,
|
|
4456
|
+
renderPaymentMethod,
|
|
4457
|
+
renderShippingAddress
|
|
4050
4458
|
})
|
|
4051
4459
|
});
|
|
4052
4460
|
}
|
|
@@ -4321,6 +4729,7 @@ function SubscriptionDetailScreen({ token, onToast }) {
|
|
|
4321
4729
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SubscriptionDetailScreen$1, {
|
|
4322
4730
|
token,
|
|
4323
4731
|
onNavigateToList: () => navigate("subscriptions"),
|
|
4732
|
+
onNavigateToSubscription: (nextToken) => navigate(`subscriptions/${nextToken}`),
|
|
4324
4733
|
onNotFound: () => {
|
|
4325
4734
|
onToast("Subscription not found", "warning");
|
|
4326
4735
|
navigate("subscriptions");
|
|
@@ -4397,4 +4806,4 @@ Object.defineProperty(exports, "subscriptionsScreenPropertySchema", {
|
|
|
4397
4806
|
}
|
|
4398
4807
|
});
|
|
4399
4808
|
|
|
4400
|
-
//# sourceMappingURL=SubscriptionsScreen-
|
|
4809
|
+
//# sourceMappingURL=SubscriptionsScreen-BToWvdTh.cjs.map
|