@fluid-app/portal-sdk 0.1.311 → 0.1.313
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-CmbuVfD5.cjs → AddressAutocompleteInput-BqZwiUup.cjs} +212 -136
- package/dist/AddressAutocompleteInput-BqZwiUup.cjs.map +1 -0
- package/dist/{AddressAutocompleteInput-RLaGWKfq.mjs → AddressAutocompleteInput-DY0ZFQOs.mjs} +212 -136
- package/dist/AddressAutocompleteInput-DY0ZFQOs.mjs.map +1 -0
- package/dist/{ContactsScreen-C2-ScK3i.cjs → ContactsScreen-B_iTSV67.cjs} +21 -21
- package/dist/{ContactsScreen-C2-ScK3i.cjs.map → ContactsScreen-B_iTSV67.cjs.map} +1 -1
- package/dist/{ContactsScreen-9613La-4.cjs → ContactsScreen-BacGvYpU.cjs} +1 -1
- package/dist/{ContactsScreen-CAwUXMDr.mjs → ContactsScreen-D2htG3gL.mjs} +21 -21
- package/dist/{ContactsScreen-CAwUXMDr.mjs.map → ContactsScreen-D2htG3gL.mjs.map} +1 -1
- package/dist/{FluidProvider-D4T1Tfn7.mjs → FluidProvider-BdjVFM6g.mjs} +5 -3
- package/dist/{FluidProvider-D4T1Tfn7.mjs.map → FluidProvider-BdjVFM6g.mjs.map} +1 -1
- package/dist/{FluidProvider-FvdFx8ML.cjs → FluidProvider-CiMgrTE0.cjs} +5 -3
- package/dist/{FluidProvider-FvdFx8ML.cjs.map → FluidProvider-CiMgrTE0.cjs.map} +1 -1
- package/dist/{MessagingScreen-_TJsaL8I.cjs → MessagingScreen-B0nvkVRJ.cjs} +2 -2
- package/dist/{MessagingScreen-_TJsaL8I.cjs.map → MessagingScreen-B0nvkVRJ.cjs.map} +1 -1
- package/dist/{MessagingScreen-CWqnuXcd.mjs → MessagingScreen-ClnTfJPR.mjs} +2 -2
- package/dist/{MessagingScreen-CWqnuXcd.mjs.map → MessagingScreen-ClnTfJPR.mjs.map} +1 -1
- package/dist/{MessagingScreen-bUf-46H5.cjs → MessagingScreen-DckwoF5C.cjs} +2 -2
- package/dist/{MessagingScreen-DuYCzPYW.mjs → MessagingScreen-Dz57LSh8.mjs} +2 -2
- package/dist/{OrdersScreen-kVm3EyXs.cjs → OrdersScreen-Ci3ZZZKP.cjs} +2 -2
- package/dist/{OrdersScreen-kVm3EyXs.cjs.map → OrdersScreen-Ci3ZZZKP.cjs.map} +1 -1
- package/dist/{OrdersScreen-CGxEuDzh.cjs → OrdersScreen-CtzoJUXX.cjs} +2 -2
- package/dist/{OrdersScreen-D1Whz24J.mjs → OrdersScreen-DKzZQPWm.mjs} +2 -2
- package/dist/{OrdersScreen-OEk3M3Qm.mjs → OrdersScreen-zpW6p4eP.mjs} +2 -2
- package/dist/{OrdersScreen-OEk3M3Qm.mjs.map → OrdersScreen-zpW6p4eP.mjs.map} +1 -1
- package/dist/{ProfileScreen-DCrPvVaF.cjs → ProfileScreen-BRYNGS4S.cjs} +3 -3
- package/dist/{ProfileScreen-BBjsjvuj.cjs → ProfileScreen-BXZMqNcY.cjs} +30 -23
- package/dist/ProfileScreen-BXZMqNcY.cjs.map +1 -0
- package/dist/{ProfileScreen-eeXNttNa.mjs → ProfileScreen-BirNjDNw.mjs} +3 -3
- package/dist/{ProfileScreen-DeTQ4Xoo.mjs → ProfileScreen-D-Vo-_yC.mjs} +30 -23
- package/dist/ProfileScreen-D-Vo-_yC.mjs.map +1 -0
- package/dist/{ShopScreen-BGiVyKAO.cjs → ShopScreen-CBZsxycw.cjs} +2 -2
- package/dist/{ShopScreen-KF3dsnFC.mjs → ShopScreen-CC3KbNCc.mjs} +2 -2
- package/dist/{ShopScreen-KF3dsnFC.mjs.map → ShopScreen-CC3KbNCc.mjs.map} +1 -1
- package/dist/{ShopScreen-Cx-iyP99.cjs → ShopScreen-D9I_t5HX.cjs} +2 -2
- package/dist/{ShopScreen-Cx-iyP99.cjs.map → ShopScreen-D9I_t5HX.cjs.map} +1 -1
- package/dist/{ShopScreen-CH3PhvzA.mjs → ShopScreen-Jsj-2scF.mjs} +2 -2
- package/dist/{SubscriptionsScreen-BJ8yW6x3.cjs → SubscriptionsScreen-Bo4cTf0n.cjs} +3 -3
- package/dist/{SubscriptionsScreen-7DGtY49t.cjs → SubscriptionsScreen-CNjeVllB.cjs} +152 -57
- package/dist/SubscriptionsScreen-CNjeVllB.cjs.map +1 -0
- package/dist/{SubscriptionsScreen-DpcL08EP.mjs → SubscriptionsScreen-DcmKn9y1.mjs} +152 -57
- package/dist/SubscriptionsScreen-DcmKn9y1.mjs.map +1 -0
- package/dist/{SubscriptionsScreen-CHdYF4Ga.mjs → SubscriptionsScreen-s9CNAkH9.mjs} +3 -3
- package/dist/{de-5dJcGXHd.mjs → de-CZcaM1mg.mjs} +33 -1
- package/dist/de-CZcaM1mg.mjs.map +1 -0
- package/dist/{de-279qQKkW.cjs → de-DOhr1RUy.cjs} +33 -1
- package/dist/de-DOhr1RUy.cjs.map +1 -0
- package/dist/{el-DXt-pZcE.mjs → el-CFfcOTW0.mjs} +33 -1
- package/dist/el-CFfcOTW0.mjs.map +1 -0
- package/dist/{el-CFPYRWKm.cjs → el-De6RiFnZ.cjs} +33 -1
- package/dist/el-De6RiFnZ.cjs.map +1 -0
- package/dist/{es-DLfWfxCc.cjs → es-BxpjC2GW.cjs} +33 -1
- package/dist/es-BxpjC2GW.cjs.map +1 -0
- package/dist/{es-WB2frRI4.mjs → es-jVAovyyN.mjs} +33 -1
- package/dist/es-jVAovyyN.mjs.map +1 -0
- package/dist/{fr-DgmvSclY.mjs → fr-BS-JXutt.mjs} +33 -1
- package/dist/fr-BS-JXutt.mjs.map +1 -0
- package/dist/{fr-C3IQZmS6.cjs → fr-DErR5mVD.cjs} +33 -1
- package/dist/fr-DErR5mVD.cjs.map +1 -0
- package/dist/{he-XJMTsvul.cjs → he-BCoena1G.cjs} +33 -1
- package/dist/he-BCoena1G.cjs.map +1 -0
- package/dist/{he-w6k-YiLm.mjs → he-Dm3gcP5z.mjs} +33 -1
- package/dist/he-Dm3gcP5z.mjs.map +1 -0
- package/dist/{hu-BydB22cZ.cjs → hu-BzV6oL5x.cjs} +33 -1
- package/dist/hu-BzV6oL5x.cjs.map +1 -0
- package/dist/{hu-tDjFfQ9J.mjs → hu-DrbPFf-v.mjs} +33 -1
- package/dist/hu-DrbPFf-v.mjs.map +1 -0
- package/dist/{id-Dp68FLAc.mjs → id-B8lS0RIT.mjs} +33 -1
- package/dist/id-B8lS0RIT.mjs.map +1 -0
- package/dist/{id-0CifOwIm.cjs → id-BJnQbLNZ.cjs} +33 -1
- package/dist/id-BJnQbLNZ.cjs.map +1 -0
- package/dist/index.cjs +20 -20
- package/dist/index.mjs +20 -20
- package/dist/{it-DngfQciz.mjs → it-Cz92WfRO.mjs} +33 -1
- package/dist/it-Cz92WfRO.mjs.map +1 -0
- package/dist/{it-CBdazuIz.cjs → it-Dij-dYqs.cjs} +33 -1
- package/dist/it-Dij-dYqs.cjs.map +1 -0
- package/dist/{ja-CVtC1kDv.cjs → ja-CrT0URkz.cjs} +33 -1
- package/dist/ja-CrT0URkz.cjs.map +1 -0
- package/dist/{ja-CkMDVPtH.mjs → ja-DI_TV2Zj.mjs} +33 -1
- package/dist/ja-DI_TV2Zj.mjs.map +1 -0
- package/dist/{ko-R-Le9JU8.cjs → ko-Dv4sXcM3.cjs} +33 -1
- package/dist/ko-Dv4sXcM3.cjs.map +1 -0
- package/dist/{ko-B72HbkvY.mjs → ko-E9TdOA9L.mjs} +33 -1
- package/dist/ko-E9TdOA9L.mjs.map +1 -0
- package/dist/{nl-CuaJpFBW.mjs → nl-B_w0JfzN.mjs} +33 -1
- package/dist/nl-B_w0JfzN.mjs.map +1 -0
- package/dist/{nl-dE66DT9d.cjs → nl-CPxJexkh.cjs} +33 -1
- package/dist/nl-CPxJexkh.cjs.map +1 -0
- package/dist/{pl-CNTDY6Ov.mjs → pl-BTmWl6HG.mjs} +33 -1
- package/dist/pl-BTmWl6HG.mjs.map +1 -0
- package/dist/{pl-d7LeUSmm.cjs → pl-ifHwr3rd.cjs} +33 -1
- package/dist/pl-ifHwr3rd.cjs.map +1 -0
- package/dist/{pt-Cu2TCvrS.mjs → pt-C1UtoI8g.mjs} +33 -1
- package/dist/pt-C1UtoI8g.mjs.map +1 -0
- package/dist/{pt-DlWYOQB7.cjs → pt-lMkT_wS4.cjs} +33 -1
- package/dist/pt-lMkT_wS4.cjs.map +1 -0
- package/dist/{ro-IGnNpnPk.mjs → ro-CQ1vwLZl.mjs} +33 -1
- package/dist/ro-CQ1vwLZl.mjs.map +1 -0
- package/dist/{ro-CxRERiJd.cjs → ro-DDUpw1f5.cjs} +33 -1
- package/dist/ro-DDUpw1f5.cjs.map +1 -0
- package/dist/{ru-BaL7GN_2.cjs → ru-BQOLcWNV.cjs} +33 -1
- package/dist/ru-BQOLcWNV.cjs.map +1 -0
- package/dist/{ru-CDda1N4V.mjs → ru-V4rwK1qm.mjs} +33 -1
- package/dist/ru-V4rwK1qm.mjs.map +1 -0
- package/dist/{th-Bmg6T2oO.mjs → th-BBDWFncd.mjs} +33 -1
- package/dist/th-BBDWFncd.mjs.map +1 -0
- package/dist/{th-eBfuOCvu.cjs → th-BCAGq41B.cjs} +33 -1
- package/dist/th-BCAGq41B.cjs.map +1 -0
- package/dist/{tl-yM51nib5.mjs → tl-CKtTJyIH.mjs} +33 -1
- package/dist/tl-CKtTJyIH.mjs.map +1 -0
- package/dist/{tl-DorumJMB.cjs → tl-D-jPdAL3.cjs} +33 -1
- package/dist/tl-D-jPdAL3.cjs.map +1 -0
- package/dist/{tr-q4NrT_MG.mjs → tr-C1fcNn_N.mjs} +33 -1
- package/dist/tr-C1fcNn_N.mjs.map +1 -0
- package/dist/{tr-CPLe40Ae.cjs → tr-DylwTPzx.cjs} +33 -1
- package/dist/tr-DylwTPzx.cjs.map +1 -0
- package/dist/{zh_CN-DELFfbhB.mjs → zh_CN-Ctx0sPwT.mjs} +33 -1
- package/dist/zh_CN-Ctx0sPwT.mjs.map +1 -0
- package/dist/{zh_CN-Bvmrqi_G.cjs → zh_CN-DhRV2h7N.cjs} +33 -1
- package/dist/zh_CN-DhRV2h7N.cjs.map +1 -0
- package/dist/{zh_TW-CryKLufw.mjs → zh_TW-Buj0u5-2.mjs} +33 -1
- package/dist/zh_TW-Buj0u5-2.mjs.map +1 -0
- package/dist/{zh_TW-DVfX_7Is.cjs → zh_TW-N9P2PjhJ.cjs} +33 -1
- package/dist/zh_TW-N9P2PjhJ.cjs.map +1 -0
- package/package.json +14 -14
- package/dist/AddressAutocompleteInput-CmbuVfD5.cjs.map +0 -1
- package/dist/AddressAutocompleteInput-RLaGWKfq.mjs.map +0 -1
- package/dist/ProfileScreen-BBjsjvuj.cjs.map +0 -1
- package/dist/ProfileScreen-DeTQ4Xoo.mjs.map +0 -1
- package/dist/SubscriptionsScreen-7DGtY49t.cjs.map +0 -1
- package/dist/SubscriptionsScreen-DpcL08EP.mjs.map +0 -1
- package/dist/de-279qQKkW.cjs.map +0 -1
- package/dist/de-5dJcGXHd.mjs.map +0 -1
- package/dist/el-CFPYRWKm.cjs.map +0 -1
- package/dist/el-DXt-pZcE.mjs.map +0 -1
- package/dist/es-DLfWfxCc.cjs.map +0 -1
- package/dist/es-WB2frRI4.mjs.map +0 -1
- package/dist/fr-C3IQZmS6.cjs.map +0 -1
- package/dist/fr-DgmvSclY.mjs.map +0 -1
- package/dist/he-XJMTsvul.cjs.map +0 -1
- package/dist/he-w6k-YiLm.mjs.map +0 -1
- package/dist/hu-BydB22cZ.cjs.map +0 -1
- package/dist/hu-tDjFfQ9J.mjs.map +0 -1
- package/dist/id-0CifOwIm.cjs.map +0 -1
- package/dist/id-Dp68FLAc.mjs.map +0 -1
- package/dist/it-CBdazuIz.cjs.map +0 -1
- package/dist/it-DngfQciz.mjs.map +0 -1
- package/dist/ja-CVtC1kDv.cjs.map +0 -1
- package/dist/ja-CkMDVPtH.mjs.map +0 -1
- package/dist/ko-B72HbkvY.mjs.map +0 -1
- package/dist/ko-R-Le9JU8.cjs.map +0 -1
- package/dist/nl-CuaJpFBW.mjs.map +0 -1
- package/dist/nl-dE66DT9d.cjs.map +0 -1
- package/dist/pl-CNTDY6Ov.mjs.map +0 -1
- package/dist/pl-d7LeUSmm.cjs.map +0 -1
- package/dist/pt-Cu2TCvrS.mjs.map +0 -1
- package/dist/pt-DlWYOQB7.cjs.map +0 -1
- package/dist/ro-CxRERiJd.cjs.map +0 -1
- package/dist/ro-IGnNpnPk.mjs.map +0 -1
- package/dist/ru-BaL7GN_2.cjs.map +0 -1
- package/dist/ru-CDda1N4V.mjs.map +0 -1
- package/dist/th-Bmg6T2oO.mjs.map +0 -1
- package/dist/th-eBfuOCvu.cjs.map +0 -1
- package/dist/tl-DorumJMB.cjs.map +0 -1
- package/dist/tl-yM51nib5.mjs.map +0 -1
- package/dist/tr-CPLe40Ae.cjs.map +0 -1
- package/dist/tr-q4NrT_MG.mjs.map +0 -1
- package/dist/zh_CN-Bvmrqi_G.cjs.map +0 -1
- package/dist/zh_CN-DELFfbhB.mjs.map +0 -1
- package/dist/zh_TW-CryKLufw.mjs.map +0 -1
- package/dist/zh_TW-DVfX_7Is.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { at as subscriptions_reactivate, ct as subscriptions_skip, et as subscription_bundles_create, it as subscriptions_pause, lt as subscriptions_update, nt as subscriptions_cancel, ot as subscriptions_resume, rt as subscriptions_list, st as subscriptions_show, tt as subscription_bundles_list } from "./portal_tenant_content-CRrn7i-P.mjs";
|
|
2
|
-
import { B as usePayApi, n as useFluidContext } from "./FluidProvider-
|
|
2
|
+
import { B as usePayApi, n as useFluidContext } from "./FluidProvider-BdjVFM6g.mjs";
|
|
3
3
|
import { n as useCountriesApi } from "./countries-api-context-DScC_39w.mjs";
|
|
4
4
|
import { n as usePortalTenantClient } from "./PortalTenantClientProvider-_VXOs0t4.mjs";
|
|
5
5
|
import { n as useActiveLocale } from "./locale-context-DGCebJhw.mjs";
|
|
@@ -10,7 +10,7 @@ import { n as payKeys, r as storeKeys } from "./query-keys-BkMRwfNo.mjs";
|
|
|
10
10
|
import { t as useAccount } from "./use-account-GjZt_eis.mjs";
|
|
11
11
|
import { n as useAppNavigation } from "./AppNavigationContext-DNomMUij.mjs";
|
|
12
12
|
import { n as createDomainTranslations, r as useDomainDict, t as createStaticDictAdapter } from "./static-dict-adapter-CGDunURa.mjs";
|
|
13
|
-
import { a as AddressFormDialog, c as PaymentIcon, f as ConfirmActionDialog, h as useProfileTranslation, i as CreditCardFormDialog, l as getCardDisplayName, m as ProfileTranslationBridge, n as createFluidPayApiAdapter, o as EditPaymentMethodDialog, p as EllipsesDropdown, r as mapToFluidPayPaymentMethod, s as FluidPayCoreProvider, t as AddressAutocompleteInput, u as getCardExpiry } from "./AddressAutocompleteInput-
|
|
13
|
+
import { a as AddressFormDialog, c as PaymentIcon, f as ConfirmActionDialog, h as useProfileTranslation, i as CreditCardFormDialog, l as getCardDisplayName, m as ProfileTranslationBridge, n as createFluidPayApiAdapter, o as EditPaymentMethodDialog, p as EllipsesDropdown, r as mapToFluidPayPaymentMethod, s as FluidPayCoreProvider, t as AddressAutocompleteInput, u as getCardExpiry } from "./AddressAutocompleteInput-DY0ZFQOs.mjs";
|
|
14
14
|
import { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
15
15
|
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
16
16
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -2378,6 +2378,21 @@ function formatDate(dateString, isCancelled = false) {
|
|
|
2378
2378
|
};
|
|
2379
2379
|
return `${monthName} ${dayNum}${ordinalSuffix(dayNum)}, ${yearNum}`;
|
|
2380
2380
|
}
|
|
2381
|
+
function formatTime(dateString, timezone) {
|
|
2382
|
+
if (!dateString || !timezone) return "";
|
|
2383
|
+
const date = new Date(dateString);
|
|
2384
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
2385
|
+
try {
|
|
2386
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
2387
|
+
hour: "numeric",
|
|
2388
|
+
minute: "2-digit",
|
|
2389
|
+
hour12: true,
|
|
2390
|
+
timeZone: timezone
|
|
2391
|
+
}).format(date);
|
|
2392
|
+
} catch {
|
|
2393
|
+
return "";
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2381
2396
|
function getNextBillDisplay(subscription) {
|
|
2382
2397
|
if (subscription?.status === "cancelled") return "Cancelled";
|
|
2383
2398
|
if (subscription?.next_bill_date) return formatDate(subscription.next_bill_date);
|
|
@@ -2423,6 +2438,7 @@ function mapDetailSubscription(bff) {
|
|
|
2423
2438
|
original_price: safeParsePrice(bff.original_price, price),
|
|
2424
2439
|
next_bill_date: bff.next_billing_date ?? null,
|
|
2425
2440
|
last_bill_date: bff.last_billing_date ?? null,
|
|
2441
|
+
timezone: bff.timezone ?? null,
|
|
2426
2442
|
next_ship_date: null,
|
|
2427
2443
|
last_ship_date: null,
|
|
2428
2444
|
disabled: false,
|
|
@@ -4477,12 +4493,21 @@ const ADDRESS_DIALOG_LABELS = {
|
|
|
4477
4493
|
first_name: "First Name",
|
|
4478
4494
|
last_name: "Last Name",
|
|
4479
4495
|
deleting: "Deleting…",
|
|
4480
|
-
tap_to_confirm: "Tap to confirm"
|
|
4496
|
+
tap_to_confirm: "Tap to confirm",
|
|
4497
|
+
add_credit_card: "Add Credit Card",
|
|
4498
|
+
add_billing_address: "Add billing address",
|
|
4499
|
+
billing_address: "Billing Address",
|
|
4500
|
+
same_as_shipping: "Same as shipping address",
|
|
4501
|
+
use_a_different_address: "Use a different address",
|
|
4502
|
+
set_as_default_payment_method: "Set as default payment method",
|
|
4503
|
+
save_card: "Save Card",
|
|
4504
|
+
saving: "Saving...",
|
|
4505
|
+
securing: "Loading secure form..."
|
|
4481
4506
|
};
|
|
4482
4507
|
function addressDialogT(key) {
|
|
4483
4508
|
return ADDRESS_DIALOG_LABELS[key] ?? key.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
4484
4509
|
}
|
|
4485
|
-
function mapToFluidPayAddress$
|
|
4510
|
+
function mapToFluidPayAddress$2(raw) {
|
|
4486
4511
|
return {
|
|
4487
4512
|
id: raw.id,
|
|
4488
4513
|
address1: raw.street1,
|
|
@@ -4510,7 +4535,7 @@ function SubscriptionsListScreenInner({ customerId, isLoadingCustomer, onToast }
|
|
|
4510
4535
|
const { data: addresses = [] } = useQuery({
|
|
4511
4536
|
queryKey: payKeys.addresses.list(),
|
|
4512
4537
|
queryFn: async () => {
|
|
4513
|
-
return (await payApi.fetchAddresses()).addresses.map(mapToFluidPayAddress$
|
|
4538
|
+
return (await payApi.fetchAddresses()).addresses.map(mapToFluidPayAddress$2);
|
|
4514
4539
|
},
|
|
4515
4540
|
enabled: !!customerId && !isLoadingCustomer
|
|
4516
4541
|
});
|
|
@@ -4571,11 +4596,14 @@ function SubscriptionsListScreenInner({ customerId, isLoadingCustomer, onToast }
|
|
|
4571
4596
|
onError: () => onToast?.("Failed to add address", "error")
|
|
4572
4597
|
});
|
|
4573
4598
|
const addCreditCardMutation = useMutation({
|
|
4574
|
-
mutationFn: (data) => payApi.createPaymentMethod({
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4599
|
+
mutationFn: (data) => payApi.createPaymentMethod({
|
|
4600
|
+
payment_method: {
|
|
4601
|
+
type: "card",
|
|
4602
|
+
token: data.payment_method.token,
|
|
4603
|
+
default: data.set_as_default
|
|
4604
|
+
},
|
|
4605
|
+
billing_address_id: data.billing_address_id
|
|
4606
|
+
}),
|
|
4579
4607
|
onSuccess: () => {
|
|
4580
4608
|
queryClient.invalidateQueries({ queryKey: payKeys.paymentMethods.all });
|
|
4581
4609
|
onToast?.("Payment method added", "success");
|
|
@@ -4680,17 +4708,33 @@ function SubscriptionsListScreenInner({ customerId, isLoadingCustomer, onToast }
|
|
|
4680
4708
|
} catch {}
|
|
4681
4709
|
},
|
|
4682
4710
|
isSubmitting: addCreditCardMutation.isPending,
|
|
4683
|
-
countries: countryOptions,
|
|
4684
4711
|
jwt: "",
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4712
|
+
savedAddresses: addresses,
|
|
4713
|
+
defaultBillingAddressId: addresses.find((a) => a.default)?.id,
|
|
4714
|
+
renderAddressFormDialog: ({ isOpen, onClose, onAddressCreated }) => /* @__PURE__ */ jsx(AddressFormDialog, {
|
|
4715
|
+
isOpen,
|
|
4716
|
+
onClose,
|
|
4717
|
+
selectedAddress: null,
|
|
4718
|
+
defaultCountry: addresses.find((a) => a.default)?.country_code ?? config.countryIso ?? "US",
|
|
4719
|
+
t: addressDialogT,
|
|
4720
|
+
onSubmit: async (formData) => {
|
|
4721
|
+
try {
|
|
4722
|
+
onAddressCreated(mapToFluidPayAddress$2(await createAddressMutation.mutateAsync(formData)));
|
|
4723
|
+
} catch {}
|
|
4724
|
+
},
|
|
4725
|
+
isSubmitting: createAddressMutation.isPending,
|
|
4726
|
+
countries: countryOptions,
|
|
4727
|
+
fetchStates: fetchStatesFromCountries,
|
|
4728
|
+
renderAddressAutocomplete: ({ control, setValue, countryCode }) => /* @__PURE__ */ jsx(AddressAutocompleteInput, {
|
|
4729
|
+
control,
|
|
4730
|
+
setValue,
|
|
4731
|
+
countryIso: countryCode,
|
|
4732
|
+
addressLineField: "address1",
|
|
4733
|
+
cityField: "city",
|
|
4734
|
+
stateField: "state",
|
|
4735
|
+
postalCodeField: "postal_code",
|
|
4736
|
+
placeholder: addressDialogT("address_line_1")
|
|
4737
|
+
})
|
|
4694
4738
|
})
|
|
4695
4739
|
})
|
|
4696
4740
|
] });
|
|
@@ -5565,6 +5609,7 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
5565
5609
|
const quantityInputId = `subscription-${subscription.subscription_token}-quantity`;
|
|
5566
5610
|
const discount = subscription.original_price != null ? subscription.original_price - subscription.price : 0;
|
|
5567
5611
|
const subtotal = discount > 0 ? formatCurrency(subscription.original_price * quantity) : totalPrice;
|
|
5612
|
+
const nextOrderTimeOfDay = formatTime(displayNextBillDate ?? subscription.next_bill_date, subscription.timezone);
|
|
5568
5613
|
return /* @__PURE__ */ jsx("section", {
|
|
5569
5614
|
className: "bg-muted flex w-full flex-col items-center rounded-lg px-8 lg:col-span-4 lg:self-start",
|
|
5570
5615
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -5581,32 +5626,37 @@ function SubscriptionItemsSection({ subscription, displayQuantity, displayNextBi
|
|
|
5581
5626
|
className: "grid grid-cols-2 gap-4",
|
|
5582
5627
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
5583
5628
|
className: "border-border border-r pr-4",
|
|
5584
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
5585
|
-
className: "text-muted-foreground mb-1 text-sm",
|
|
5586
|
-
children: t("next_order_date")
|
|
5587
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
5588
|
-
className: "text-foreground text-2xl font-bold",
|
|
5589
|
-
children: getNextBillDisplay(displayNextBillDate ? {
|
|
5590
|
-
...subscription,
|
|
5591
|
-
next_bill_date: displayNextBillDate
|
|
5592
|
-
} : subscription)
|
|
5593
|
-
})]
|
|
5594
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
5595
|
-
className: "pl-4",
|
|
5596
5629
|
children: [
|
|
5597
5630
|
/* @__PURE__ */ jsx("div", {
|
|
5598
5631
|
className: "text-muted-foreground mb-1 text-sm",
|
|
5599
|
-
children: t("
|
|
5632
|
+
children: t("next_order_date")
|
|
5600
5633
|
}),
|
|
5601
5634
|
/* @__PURE__ */ jsx("div", {
|
|
5602
5635
|
className: "text-foreground text-2xl font-bold",
|
|
5603
|
-
children:
|
|
5636
|
+
children: getNextBillDisplay(displayNextBillDate ? {
|
|
5637
|
+
...subscription,
|
|
5638
|
+
next_bill_date: displayNextBillDate
|
|
5639
|
+
} : subscription)
|
|
5604
5640
|
}),
|
|
5605
|
-
|
|
5641
|
+
nextOrderTimeOfDay && /* @__PURE__ */ jsxs("div", {
|
|
5606
5642
|
className: "text-muted-foreground mt-1 text-xs",
|
|
5607
|
-
children:
|
|
5643
|
+
children: [
|
|
5644
|
+
nextOrderTimeOfDay,
|
|
5645
|
+
" (",
|
|
5646
|
+
subscription.timezone,
|
|
5647
|
+
")"
|
|
5648
|
+
]
|
|
5608
5649
|
})
|
|
5609
5650
|
]
|
|
5651
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
5652
|
+
className: "pl-4",
|
|
5653
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
5654
|
+
className: "text-muted-foreground mb-1 text-sm",
|
|
5655
|
+
children: t("next_bill_amount")
|
|
5656
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
5657
|
+
className: "text-foreground text-2xl font-bold",
|
|
5658
|
+
children: formatCurrency(subscription.price * quantity)
|
|
5659
|
+
})]
|
|
5610
5660
|
})]
|
|
5611
5661
|
}), /* @__PURE__ */ jsx("hr", { className: "border-border mt-4" })]
|
|
5612
5662
|
})]
|
|
@@ -6383,6 +6433,20 @@ function SelectablePaymentMethodDropdown({ title, displayPaymentMethod, paymentM
|
|
|
6383
6433
|
}
|
|
6384
6434
|
//#endregion
|
|
6385
6435
|
//#region src/subscriptions/PortalSubscriptionPaymentMethodSection.tsx
|
|
6436
|
+
function mapToFluidPayAddress$1(raw) {
|
|
6437
|
+
return {
|
|
6438
|
+
id: raw.id,
|
|
6439
|
+
address1: raw.street1,
|
|
6440
|
+
address2: raw.street2,
|
|
6441
|
+
city: raw.city,
|
|
6442
|
+
country_code: raw.country,
|
|
6443
|
+
default: raw.default,
|
|
6444
|
+
name: raw.name,
|
|
6445
|
+
postal_code: raw.zip,
|
|
6446
|
+
state: raw.state,
|
|
6447
|
+
subdivision_code: null
|
|
6448
|
+
};
|
|
6449
|
+
}
|
|
6386
6450
|
function subscriptionPaymentMethodToFluidPay(raw) {
|
|
6387
6451
|
const details = raw.details;
|
|
6388
6452
|
return {
|
|
@@ -6423,6 +6487,13 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6423
6487
|
return (await payApi.fetchPaymentMethods()).payment_methods.map(mapToFluidPayPaymentMethod);
|
|
6424
6488
|
}
|
|
6425
6489
|
});
|
|
6490
|
+
const { data: addresses = [] } = useQuery({
|
|
6491
|
+
queryKey: payKeys.addresses.list(),
|
|
6492
|
+
queryFn: async () => {
|
|
6493
|
+
return (await payApi.fetchAddresses()).addresses.map(mapToFluidPayAddress$1);
|
|
6494
|
+
},
|
|
6495
|
+
enabled: isAddDialogOpen
|
|
6496
|
+
});
|
|
6426
6497
|
const countriesApi = useCountriesApi();
|
|
6427
6498
|
const { data: countriesData } = useQuery({
|
|
6428
6499
|
queryKey: storeKeys.countries(),
|
|
@@ -6445,17 +6516,9 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6445
6516
|
payment_method: {
|
|
6446
6517
|
type: "card",
|
|
6447
6518
|
token: data.payment_method.token,
|
|
6448
|
-
default: data.
|
|
6519
|
+
default: data.set_as_default
|
|
6449
6520
|
},
|
|
6450
|
-
|
|
6451
|
-
country: data.billing_address.country_code,
|
|
6452
|
-
name: data.billing_address.name ?? null,
|
|
6453
|
-
street1: data.billing_address.address1,
|
|
6454
|
-
street2: data.billing_address.address2 ?? null,
|
|
6455
|
-
city: data.billing_address.city,
|
|
6456
|
-
state: data.billing_address.state,
|
|
6457
|
-
zip: data.billing_address.zip
|
|
6458
|
-
} }
|
|
6521
|
+
billing_address_id: data.billing_address_id
|
|
6459
6522
|
}),
|
|
6460
6523
|
onSuccess: async () => {
|
|
6461
6524
|
await queryClient.invalidateQueries({ queryKey: payKeys.paymentMethods.all });
|
|
@@ -6463,6 +6526,24 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6463
6526
|
},
|
|
6464
6527
|
onError: (err) => onError?.(profileT("failed_to_add_payment_method"), err)
|
|
6465
6528
|
});
|
|
6529
|
+
const createAddressMutation = useMutation({
|
|
6530
|
+
mutationFn: (body) => {
|
|
6531
|
+
const combinedName = `${body.address.first_name} ${body.address.last_name}`.trim();
|
|
6532
|
+
return payApi.createAddress({ address: {
|
|
6533
|
+
name: combinedName.length > 0 ? combinedName : null,
|
|
6534
|
+
street1: body.address.address1,
|
|
6535
|
+
street2: body.address.address2,
|
|
6536
|
+
city: body.address.city,
|
|
6537
|
+
state: body.address.state,
|
|
6538
|
+
zip: body.address.postal_code,
|
|
6539
|
+
country: body.address.country_code
|
|
6540
|
+
} });
|
|
6541
|
+
},
|
|
6542
|
+
onSuccess: () => {
|
|
6543
|
+
queryClient.invalidateQueries({ queryKey: payKeys.addresses.all });
|
|
6544
|
+
},
|
|
6545
|
+
onError: (err) => onError?.(profileT("failed_to_create_address"), err)
|
|
6546
|
+
});
|
|
6466
6547
|
const updatePaymentMethodMutation = useMutation({
|
|
6467
6548
|
mutationFn: ({ paymentMethodId, data }) => payApi.updatePaymentMethod(paymentMethodId, { payment_method: {
|
|
6468
6549
|
default: data.set_as_default,
|
|
@@ -6558,17 +6639,31 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6558
6639
|
} catch {}
|
|
6559
6640
|
},
|
|
6560
6641
|
isSubmitting: addCardMutation.isPending,
|
|
6561
|
-
countries: countryOptions,
|
|
6562
6642
|
jwt: "",
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6643
|
+
savedAddresses: addresses,
|
|
6644
|
+
defaultBillingAddressId: addresses.find((a) => a.default)?.id,
|
|
6645
|
+
renderAddressFormDialog: ({ isOpen, onClose, onAddressCreated }) => /* @__PURE__ */ jsx(AddressFormDialog, {
|
|
6646
|
+
isOpen,
|
|
6647
|
+
onClose,
|
|
6648
|
+
selectedAddress: null,
|
|
6649
|
+
t: tFn,
|
|
6650
|
+
onSubmit: async (formData) => {
|
|
6651
|
+
try {
|
|
6652
|
+
onAddressCreated(mapToFluidPayAddress$1(await createAddressMutation.mutateAsync(formData)));
|
|
6653
|
+
} catch {}
|
|
6654
|
+
},
|
|
6655
|
+
isSubmitting: createAddressMutation.isPending,
|
|
6656
|
+
countries: countryOptions,
|
|
6657
|
+
renderAddressAutocomplete: ({ control, setValue, countryCode }) => /* @__PURE__ */ jsx(AddressAutocompleteInput, {
|
|
6658
|
+
control,
|
|
6659
|
+
setValue,
|
|
6660
|
+
countryIso: countryCode,
|
|
6661
|
+
addressLineField: "address1",
|
|
6662
|
+
cityField: "city",
|
|
6663
|
+
stateField: "state",
|
|
6664
|
+
postalCodeField: "postal_code",
|
|
6665
|
+
placeholder: profileT("address_line_1")
|
|
6666
|
+
})
|
|
6572
6667
|
})
|
|
6573
6668
|
}),
|
|
6574
6669
|
/* @__PURE__ */ jsx(EditPaymentMethodDialog, {
|
|
@@ -7049,4 +7144,4 @@ const subscriptionsScreenPropertySchema = {
|
|
|
7049
7144
|
//#endregion
|
|
7050
7145
|
export { subscriptionsScreenPropertySchema as n, SubscriptionsScreen as t };
|
|
7051
7146
|
|
|
7052
|
-
//# sourceMappingURL=SubscriptionsScreen-
|
|
7147
|
+
//# sourceMappingURL=SubscriptionsScreen-DcmKn9y1.mjs.map
|