@fluid-app/portal-sdk 0.1.312 → 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/{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-CwQMhw18.mjs → MessagingScreen-Dz57LSh8.mjs} +2 -3
- 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-Wrt08mBS.mjs → OrdersScreen-DKzZQPWm.mjs} +2 -4
- 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-Dd0reAiP.mjs → ProfileScreen-BirNjDNw.mjs} +3 -4
- package/dist/{ProfileScreen-DeTQ4Xoo.mjs → ProfileScreen-D-Vo-_yC.mjs} +30 -23
- package/dist/ProfileScreen-D-Vo-_yC.mjs.map +1 -0
- package/dist/{ShareablesScreen-C6OmCNlO.mjs → ShareablesScreen-3CCVMNaT.mjs} +0 -2
- 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-YlDG7ZJk.mjs → ShopScreen-Jsj-2scF.mjs} +2 -4
- package/dist/{SubscriptionsScreen-Di98lE9y.cjs → SubscriptionsScreen-Bo4cTf0n.cjs} +3 -3
- package/dist/{SubscriptionsScreen-CFEAH36q.cjs → SubscriptionsScreen-CNjeVllB.cjs} +114 -41
- package/dist/SubscriptionsScreen-CNjeVllB.cjs.map +1 -0
- package/dist/{SubscriptionsScreen-CGTKGw7C.mjs → SubscriptionsScreen-DcmKn9y1.mjs} +114 -41
- package/dist/SubscriptionsScreen-DcmKn9y1.mjs.map +1 -0
- package/dist/{SubscriptionsScreen-DBKaPLTx.mjs → SubscriptionsScreen-s9CNAkH9.mjs} +3 -5
- package/dist/index.cjs +17 -17
- package/dist/index.mjs +19 -19
- package/package.json +17 -17
- 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-CFEAH36q.cjs.map +0 -1
- package/dist/SubscriptionsScreen-CGTKGw7C.mjs.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";
|
|
@@ -4493,12 +4493,21 @@ const ADDRESS_DIALOG_LABELS = {
|
|
|
4493
4493
|
first_name: "First Name",
|
|
4494
4494
|
last_name: "Last Name",
|
|
4495
4495
|
deleting: "Deleting…",
|
|
4496
|
-
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..."
|
|
4497
4506
|
};
|
|
4498
4507
|
function addressDialogT(key) {
|
|
4499
4508
|
return ADDRESS_DIALOG_LABELS[key] ?? key.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
4500
4509
|
}
|
|
4501
|
-
function mapToFluidPayAddress$
|
|
4510
|
+
function mapToFluidPayAddress$2(raw) {
|
|
4502
4511
|
return {
|
|
4503
4512
|
id: raw.id,
|
|
4504
4513
|
address1: raw.street1,
|
|
@@ -4526,7 +4535,7 @@ function SubscriptionsListScreenInner({ customerId, isLoadingCustomer, onToast }
|
|
|
4526
4535
|
const { data: addresses = [] } = useQuery({
|
|
4527
4536
|
queryKey: payKeys.addresses.list(),
|
|
4528
4537
|
queryFn: async () => {
|
|
4529
|
-
return (await payApi.fetchAddresses()).addresses.map(mapToFluidPayAddress$
|
|
4538
|
+
return (await payApi.fetchAddresses()).addresses.map(mapToFluidPayAddress$2);
|
|
4530
4539
|
},
|
|
4531
4540
|
enabled: !!customerId && !isLoadingCustomer
|
|
4532
4541
|
});
|
|
@@ -4587,11 +4596,14 @@ function SubscriptionsListScreenInner({ customerId, isLoadingCustomer, onToast }
|
|
|
4587
4596
|
onError: () => onToast?.("Failed to add address", "error")
|
|
4588
4597
|
});
|
|
4589
4598
|
const addCreditCardMutation = useMutation({
|
|
4590
|
-
mutationFn: (data) => payApi.createPaymentMethod({
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
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
|
+
}),
|
|
4595
4607
|
onSuccess: () => {
|
|
4596
4608
|
queryClient.invalidateQueries({ queryKey: payKeys.paymentMethods.all });
|
|
4597
4609
|
onToast?.("Payment method added", "success");
|
|
@@ -4696,17 +4708,33 @@ function SubscriptionsListScreenInner({ customerId, isLoadingCustomer, onToast }
|
|
|
4696
4708
|
} catch {}
|
|
4697
4709
|
},
|
|
4698
4710
|
isSubmitting: addCreditCardMutation.isPending,
|
|
4699
|
-
countries: countryOptions,
|
|
4700
4711
|
jwt: "",
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
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
|
+
})
|
|
4710
4738
|
})
|
|
4711
4739
|
})
|
|
4712
4740
|
] });
|
|
@@ -6405,6 +6433,20 @@ function SelectablePaymentMethodDropdown({ title, displayPaymentMethod, paymentM
|
|
|
6405
6433
|
}
|
|
6406
6434
|
//#endregion
|
|
6407
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
|
+
}
|
|
6408
6450
|
function subscriptionPaymentMethodToFluidPay(raw) {
|
|
6409
6451
|
const details = raw.details;
|
|
6410
6452
|
return {
|
|
@@ -6445,6 +6487,13 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6445
6487
|
return (await payApi.fetchPaymentMethods()).payment_methods.map(mapToFluidPayPaymentMethod);
|
|
6446
6488
|
}
|
|
6447
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
|
+
});
|
|
6448
6497
|
const countriesApi = useCountriesApi();
|
|
6449
6498
|
const { data: countriesData } = useQuery({
|
|
6450
6499
|
queryKey: storeKeys.countries(),
|
|
@@ -6467,17 +6516,9 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6467
6516
|
payment_method: {
|
|
6468
6517
|
type: "card",
|
|
6469
6518
|
token: data.payment_method.token,
|
|
6470
|
-
default: data.
|
|
6519
|
+
default: data.set_as_default
|
|
6471
6520
|
},
|
|
6472
|
-
|
|
6473
|
-
country: data.billing_address.country_code,
|
|
6474
|
-
name: data.billing_address.name ?? null,
|
|
6475
|
-
street1: data.billing_address.address1,
|
|
6476
|
-
street2: data.billing_address.address2 ?? null,
|
|
6477
|
-
city: data.billing_address.city,
|
|
6478
|
-
state: data.billing_address.state,
|
|
6479
|
-
zip: data.billing_address.zip
|
|
6480
|
-
} }
|
|
6521
|
+
billing_address_id: data.billing_address_id
|
|
6481
6522
|
}),
|
|
6482
6523
|
onSuccess: async () => {
|
|
6483
6524
|
await queryClient.invalidateQueries({ queryKey: payKeys.paymentMethods.all });
|
|
@@ -6485,6 +6526,24 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6485
6526
|
},
|
|
6486
6527
|
onError: (err) => onError?.(profileT("failed_to_add_payment_method"), err)
|
|
6487
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
|
+
});
|
|
6488
6547
|
const updatePaymentMethodMutation = useMutation({
|
|
6489
6548
|
mutationFn: ({ paymentMethodId, data }) => payApi.updatePaymentMethod(paymentMethodId, { payment_method: {
|
|
6490
6549
|
default: data.set_as_default,
|
|
@@ -6580,17 +6639,31 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6580
6639
|
} catch {}
|
|
6581
6640
|
},
|
|
6582
6641
|
isSubmitting: addCardMutation.isPending,
|
|
6583
|
-
countries: countryOptions,
|
|
6584
6642
|
jwt: "",
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
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
|
+
})
|
|
6594
6667
|
})
|
|
6595
6668
|
}),
|
|
6596
6669
|
/* @__PURE__ */ jsx(EditPaymentMethodDialog, {
|
|
@@ -7071,4 +7144,4 @@ const subscriptionsScreenPropertySchema = {
|
|
|
7071
7144
|
//#endregion
|
|
7072
7145
|
export { subscriptionsScreenPropertySchema as n, SubscriptionsScreen as t };
|
|
7073
7146
|
|
|
7074
|
-
//# sourceMappingURL=SubscriptionsScreen-
|
|
7147
|
+
//# sourceMappingURL=SubscriptionsScreen-DcmKn9y1.mjs.map
|