@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
|
require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
const require_FluidProvider = require("./FluidProvider-
|
|
2
|
+
const require_FluidProvider = require("./FluidProvider-CiMgrTE0.cjs");
|
|
3
3
|
const require_portal_tenant_content = require("./portal_tenant_content-CrltRlMW.cjs");
|
|
4
4
|
const require_countries_api_context = require("./countries-api-context-G-NW4BoH.cjs");
|
|
5
5
|
const require_PortalTenantClientProvider = require("./PortalTenantClientProvider-OhJylQjc.cjs");
|
|
@@ -11,7 +11,7 @@ const require_query_keys = require("./query-keys-D3lK70Ea.cjs");
|
|
|
11
11
|
const require_use_account = require("./use-account-CEjH1hp5.cjs");
|
|
12
12
|
const require_AppNavigationContext = require("./AppNavigationContext-C1-hd9Rw.cjs");
|
|
13
13
|
const require_static_dict_adapter = require("./static-dict-adapter-DUeLZtek.cjs");
|
|
14
|
-
const require_AddressAutocompleteInput = require("./AddressAutocompleteInput-
|
|
14
|
+
const require_AddressAutocompleteInput = require("./AddressAutocompleteInput-BqZwiUup.cjs");
|
|
15
15
|
const require_isAfter = require("./isAfter-DXdeICis.cjs");
|
|
16
16
|
let react = require("react");
|
|
17
17
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
@@ -4555,12 +4555,21 @@ const ADDRESS_DIALOG_LABELS = {
|
|
|
4555
4555
|
first_name: "First Name",
|
|
4556
4556
|
last_name: "Last Name",
|
|
4557
4557
|
deleting: "Deleting…",
|
|
4558
|
-
tap_to_confirm: "Tap to confirm"
|
|
4558
|
+
tap_to_confirm: "Tap to confirm",
|
|
4559
|
+
add_credit_card: "Add Credit Card",
|
|
4560
|
+
add_billing_address: "Add billing address",
|
|
4561
|
+
billing_address: "Billing Address",
|
|
4562
|
+
same_as_shipping: "Same as shipping address",
|
|
4563
|
+
use_a_different_address: "Use a different address",
|
|
4564
|
+
set_as_default_payment_method: "Set as default payment method",
|
|
4565
|
+
save_card: "Save Card",
|
|
4566
|
+
saving: "Saving...",
|
|
4567
|
+
securing: "Loading secure form..."
|
|
4559
4568
|
};
|
|
4560
4569
|
function addressDialogT(key) {
|
|
4561
4570
|
return ADDRESS_DIALOG_LABELS[key] ?? key.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
4562
4571
|
}
|
|
4563
|
-
function mapToFluidPayAddress$
|
|
4572
|
+
function mapToFluidPayAddress$2(raw) {
|
|
4564
4573
|
return {
|
|
4565
4574
|
id: raw.id,
|
|
4566
4575
|
address1: raw.street1,
|
|
@@ -4588,7 +4597,7 @@ function SubscriptionsListScreenInner({ customerId, isLoadingCustomer, onToast }
|
|
|
4588
4597
|
const { data: addresses = [] } = (0, _tanstack_react_query.useQuery)({
|
|
4589
4598
|
queryKey: require_query_keys.payKeys.addresses.list(),
|
|
4590
4599
|
queryFn: async () => {
|
|
4591
|
-
return (await payApi.fetchAddresses()).addresses.map(mapToFluidPayAddress$
|
|
4600
|
+
return (await payApi.fetchAddresses()).addresses.map(mapToFluidPayAddress$2);
|
|
4592
4601
|
},
|
|
4593
4602
|
enabled: !!customerId && !isLoadingCustomer
|
|
4594
4603
|
});
|
|
@@ -4649,11 +4658,14 @@ function SubscriptionsListScreenInner({ customerId, isLoadingCustomer, onToast }
|
|
|
4649
4658
|
onError: () => onToast?.("Failed to add address", "error")
|
|
4650
4659
|
});
|
|
4651
4660
|
const addCreditCardMutation = (0, _tanstack_react_query.useMutation)({
|
|
4652
|
-
mutationFn: (data) => payApi.createPaymentMethod({
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4661
|
+
mutationFn: (data) => payApi.createPaymentMethod({
|
|
4662
|
+
payment_method: {
|
|
4663
|
+
type: "card",
|
|
4664
|
+
token: data.payment_method.token,
|
|
4665
|
+
default: data.set_as_default
|
|
4666
|
+
},
|
|
4667
|
+
billing_address_id: data.billing_address_id
|
|
4668
|
+
}),
|
|
4657
4669
|
onSuccess: () => {
|
|
4658
4670
|
queryClient.invalidateQueries({ queryKey: require_query_keys.payKeys.paymentMethods.all });
|
|
4659
4671
|
onToast?.("Payment method added", "success");
|
|
@@ -4758,17 +4770,33 @@ function SubscriptionsListScreenInner({ customerId, isLoadingCustomer, onToast }
|
|
|
4758
4770
|
} catch {}
|
|
4759
4771
|
},
|
|
4760
4772
|
isSubmitting: addCreditCardMutation.isPending,
|
|
4761
|
-
countries: countryOptions,
|
|
4762
4773
|
jwt: "",
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4774
|
+
savedAddresses: addresses,
|
|
4775
|
+
defaultBillingAddressId: addresses.find((a) => a.default)?.id,
|
|
4776
|
+
renderAddressFormDialog: ({ isOpen, onClose, onAddressCreated }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AddressAutocompleteInput.AddressFormDialog, {
|
|
4777
|
+
isOpen,
|
|
4778
|
+
onClose,
|
|
4779
|
+
selectedAddress: null,
|
|
4780
|
+
defaultCountry: addresses.find((a) => a.default)?.country_code ?? config.countryIso ?? "US",
|
|
4781
|
+
t: addressDialogT,
|
|
4782
|
+
onSubmit: async (formData) => {
|
|
4783
|
+
try {
|
|
4784
|
+
onAddressCreated(mapToFluidPayAddress$2(await createAddressMutation.mutateAsync(formData)));
|
|
4785
|
+
} catch {}
|
|
4786
|
+
},
|
|
4787
|
+
isSubmitting: createAddressMutation.isPending,
|
|
4788
|
+
countries: countryOptions,
|
|
4789
|
+
fetchStates: fetchStatesFromCountries,
|
|
4790
|
+
renderAddressAutocomplete: ({ control, setValue, countryCode }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AddressAutocompleteInput.AddressAutocompleteInput, {
|
|
4791
|
+
control,
|
|
4792
|
+
setValue,
|
|
4793
|
+
countryIso: countryCode,
|
|
4794
|
+
addressLineField: "address1",
|
|
4795
|
+
cityField: "city",
|
|
4796
|
+
stateField: "state",
|
|
4797
|
+
postalCodeField: "postal_code",
|
|
4798
|
+
placeholder: addressDialogT("address_line_1")
|
|
4799
|
+
})
|
|
4772
4800
|
})
|
|
4773
4801
|
})
|
|
4774
4802
|
] });
|
|
@@ -6467,6 +6495,20 @@ function SelectablePaymentMethodDropdown({ title, displayPaymentMethod, paymentM
|
|
|
6467
6495
|
}
|
|
6468
6496
|
//#endregion
|
|
6469
6497
|
//#region src/subscriptions/PortalSubscriptionPaymentMethodSection.tsx
|
|
6498
|
+
function mapToFluidPayAddress$1(raw) {
|
|
6499
|
+
return {
|
|
6500
|
+
id: raw.id,
|
|
6501
|
+
address1: raw.street1,
|
|
6502
|
+
address2: raw.street2,
|
|
6503
|
+
city: raw.city,
|
|
6504
|
+
country_code: raw.country,
|
|
6505
|
+
default: raw.default,
|
|
6506
|
+
name: raw.name,
|
|
6507
|
+
postal_code: raw.zip,
|
|
6508
|
+
state: raw.state,
|
|
6509
|
+
subdivision_code: null
|
|
6510
|
+
};
|
|
6511
|
+
}
|
|
6470
6512
|
function subscriptionPaymentMethodToFluidPay(raw) {
|
|
6471
6513
|
const details = raw.details;
|
|
6472
6514
|
return {
|
|
@@ -6507,6 +6549,13 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6507
6549
|
return (await payApi.fetchPaymentMethods()).payment_methods.map(require_AddressAutocompleteInput.mapToFluidPayPaymentMethod);
|
|
6508
6550
|
}
|
|
6509
6551
|
});
|
|
6552
|
+
const { data: addresses = [] } = (0, _tanstack_react_query.useQuery)({
|
|
6553
|
+
queryKey: require_query_keys.payKeys.addresses.list(),
|
|
6554
|
+
queryFn: async () => {
|
|
6555
|
+
return (await payApi.fetchAddresses()).addresses.map(mapToFluidPayAddress$1);
|
|
6556
|
+
},
|
|
6557
|
+
enabled: isAddDialogOpen
|
|
6558
|
+
});
|
|
6510
6559
|
const countriesApi = require_countries_api_context.useCountriesApi();
|
|
6511
6560
|
const { data: countriesData } = (0, _tanstack_react_query.useQuery)({
|
|
6512
6561
|
queryKey: require_query_keys.storeKeys.countries(),
|
|
@@ -6529,17 +6578,9 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6529
6578
|
payment_method: {
|
|
6530
6579
|
type: "card",
|
|
6531
6580
|
token: data.payment_method.token,
|
|
6532
|
-
default: data.
|
|
6581
|
+
default: data.set_as_default
|
|
6533
6582
|
},
|
|
6534
|
-
|
|
6535
|
-
country: data.billing_address.country_code,
|
|
6536
|
-
name: data.billing_address.name ?? null,
|
|
6537
|
-
street1: data.billing_address.address1,
|
|
6538
|
-
street2: data.billing_address.address2 ?? null,
|
|
6539
|
-
city: data.billing_address.city,
|
|
6540
|
-
state: data.billing_address.state,
|
|
6541
|
-
zip: data.billing_address.zip
|
|
6542
|
-
} }
|
|
6583
|
+
billing_address_id: data.billing_address_id
|
|
6543
6584
|
}),
|
|
6544
6585
|
onSuccess: async () => {
|
|
6545
6586
|
await queryClient.invalidateQueries({ queryKey: require_query_keys.payKeys.paymentMethods.all });
|
|
@@ -6547,6 +6588,24 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6547
6588
|
},
|
|
6548
6589
|
onError: (err) => onError?.(profileT("failed_to_add_payment_method"), err)
|
|
6549
6590
|
});
|
|
6591
|
+
const createAddressMutation = (0, _tanstack_react_query.useMutation)({
|
|
6592
|
+
mutationFn: (body) => {
|
|
6593
|
+
const combinedName = `${body.address.first_name} ${body.address.last_name}`.trim();
|
|
6594
|
+
return payApi.createAddress({ address: {
|
|
6595
|
+
name: combinedName.length > 0 ? combinedName : null,
|
|
6596
|
+
street1: body.address.address1,
|
|
6597
|
+
street2: body.address.address2,
|
|
6598
|
+
city: body.address.city,
|
|
6599
|
+
state: body.address.state,
|
|
6600
|
+
zip: body.address.postal_code,
|
|
6601
|
+
country: body.address.country_code
|
|
6602
|
+
} });
|
|
6603
|
+
},
|
|
6604
|
+
onSuccess: () => {
|
|
6605
|
+
queryClient.invalidateQueries({ queryKey: require_query_keys.payKeys.addresses.all });
|
|
6606
|
+
},
|
|
6607
|
+
onError: (err) => onError?.(profileT("failed_to_create_address"), err)
|
|
6608
|
+
});
|
|
6550
6609
|
const updatePaymentMethodMutation = (0, _tanstack_react_query.useMutation)({
|
|
6551
6610
|
mutationFn: ({ paymentMethodId, data }) => payApi.updatePaymentMethod(paymentMethodId, { payment_method: {
|
|
6552
6611
|
default: data.set_as_default,
|
|
@@ -6642,17 +6701,31 @@ function PortalSubscriptionPaymentMethodSectionInner({ paymentMethod: currentPay
|
|
|
6642
6701
|
} catch {}
|
|
6643
6702
|
},
|
|
6644
6703
|
isSubmitting: addCardMutation.isPending,
|
|
6645
|
-
countries: countryOptions,
|
|
6646
6704
|
jwt: "",
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6705
|
+
savedAddresses: addresses,
|
|
6706
|
+
defaultBillingAddressId: addresses.find((a) => a.default)?.id,
|
|
6707
|
+
renderAddressFormDialog: ({ isOpen, onClose, onAddressCreated }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AddressAutocompleteInput.AddressFormDialog, {
|
|
6708
|
+
isOpen,
|
|
6709
|
+
onClose,
|
|
6710
|
+
selectedAddress: null,
|
|
6711
|
+
t: tFn,
|
|
6712
|
+
onSubmit: async (formData) => {
|
|
6713
|
+
try {
|
|
6714
|
+
onAddressCreated(mapToFluidPayAddress$1(await createAddressMutation.mutateAsync(formData)));
|
|
6715
|
+
} catch {}
|
|
6716
|
+
},
|
|
6717
|
+
isSubmitting: createAddressMutation.isPending,
|
|
6718
|
+
countries: countryOptions,
|
|
6719
|
+
renderAddressAutocomplete: ({ control, setValue, countryCode }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AddressAutocompleteInput.AddressAutocompleteInput, {
|
|
6720
|
+
control,
|
|
6721
|
+
setValue,
|
|
6722
|
+
countryIso: countryCode,
|
|
6723
|
+
addressLineField: "address1",
|
|
6724
|
+
cityField: "city",
|
|
6725
|
+
stateField: "state",
|
|
6726
|
+
postalCodeField: "postal_code",
|
|
6727
|
+
placeholder: profileT("address_line_1")
|
|
6728
|
+
})
|
|
6656
6729
|
})
|
|
6657
6730
|
}),
|
|
6658
6731
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AddressAutocompleteInput.EditPaymentMethodDialog, {
|
|
@@ -7144,4 +7217,4 @@ Object.defineProperty(exports, "subscriptionsScreenPropertySchema", {
|
|
|
7144
7217
|
}
|
|
7145
7218
|
});
|
|
7146
7219
|
|
|
7147
|
-
//# sourceMappingURL=SubscriptionsScreen-
|
|
7220
|
+
//# sourceMappingURL=SubscriptionsScreen-CNjeVllB.cjs.map
|