@fluid-app/portal-sdk 0.1.169 → 0.1.170
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/{FluidProvider-4wg1xf_l.mjs → FluidProvider-DrGFcRlB.mjs} +23 -5
- package/dist/FluidProvider-DrGFcRlB.mjs.map +1 -0
- package/dist/{FluidProvider-MFYqEzPc.cjs → FluidProvider-n4cvVkGt.cjs} +23 -5
- package/dist/FluidProvider-n4cvVkGt.cjs.map +1 -0
- package/dist/{MessagingScreen-BodVAop8.cjs → MessagingScreen-BcN85g3v.cjs} +2 -2
- package/dist/{MessagingScreen-GU6S6vv-.mjs → MessagingScreen-Cp8RqZXv.mjs} +2 -2
- package/dist/{MessagingScreen-GU6S6vv-.mjs.map → MessagingScreen-Cp8RqZXv.mjs.map} +1 -1
- package/dist/{MessagingScreen-CEHdeWTl.cjs → MessagingScreen-Cyd_13y-.cjs} +2 -2
- package/dist/{MessagingScreen-CEHdeWTl.cjs.map → MessagingScreen-Cyd_13y-.cjs.map} +1 -1
- package/dist/{ProductsScreen-FI28Unh9.mjs → ProductsScreen-VT0vIB3p.mjs} +1 -0
- package/dist/{ProfileScreen-BfPZOdUy.cjs → ProfileScreen-Bym1xay5.cjs} +2 -2
- package/dist/{ProfileScreen-BtukJFIm.mjs → ProfileScreen-CD2lmt5S.mjs} +84 -46
- package/dist/ProfileScreen-CD2lmt5S.mjs.map +1 -0
- package/dist/{ProfileScreen-DzdtuSBv.cjs → ProfileScreen-PlDpc8RU.cjs} +84 -46
- package/dist/ProfileScreen-PlDpc8RU.cjs.map +1 -0
- package/dist/{ShareablesScreen-kr_IbX2l.mjs → ShareablesScreen-D5bAmr6m.mjs} +1 -0
- package/dist/{ShopScreen-WCUSoGt9.mjs → ShopScreen-Bq0bv8mQ.mjs} +2 -2
- package/dist/{ShopScreen-WCUSoGt9.mjs.map → ShopScreen-Bq0bv8mQ.mjs.map} +1 -1
- package/dist/{ShopScreen-BMFShhIg.cjs → ShopScreen-C6jCsDWH.cjs} +2 -2
- package/dist/{ShopScreen-DyiZc62M.cjs → ShopScreen-C9DPPESd.cjs} +2 -2
- package/dist/{ShopScreen-DyiZc62M.cjs.map → ShopScreen-C9DPPESd.cjs.map} +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.mjs +14 -14
- package/package.json +15 -15
- package/dist/FluidProvider-4wg1xf_l.mjs.map +0 -1
- package/dist/FluidProvider-MFYqEzPc.cjs.map +0 -1
- package/dist/ProfileScreen-BtukJFIm.mjs.map +0 -1
- package/dist/ProfileScreen-DzdtuSBv.cjs.map +0 -1
|
@@ -3,6 +3,7 @@ import "./account-api-context-R4VVlZdv.mjs";
|
|
|
3
3
|
import "./store-api-context-DViwxyG4.mjs";
|
|
4
4
|
import "./src-CGu9qU9G.mjs";
|
|
5
5
|
import "./ScreenHeaderContext-DbUsyd_7.mjs";
|
|
6
|
+
import "./AppNavigationContext-CAnb2Qxs.mjs";
|
|
6
7
|
import "./dist-BjehZaTg.mjs";
|
|
7
8
|
import "./SearchSort--qXK5na1.mjs";
|
|
8
9
|
import "./dist-Bo6ZG9XC.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
require("./FluidProvider-
|
|
2
|
+
require("./FluidProvider-n4cvVkGt.cjs");
|
|
3
3
|
require("./account-api-context-pr_NLnGy.cjs");
|
|
4
4
|
require("./store-api-context-Cg-VHWmM.cjs");
|
|
5
5
|
require("./mysite-api-context-DTgTIIUZ.cjs");
|
|
@@ -38,6 +38,6 @@ require("./TableWidget-UIY_vWJB.cjs");
|
|
|
38
38
|
require("./ToDoWidget-BNnAkM0Q.cjs");
|
|
39
39
|
require("./VideoWidget-BZITMub2.cjs");
|
|
40
40
|
require("./ScreenHeaderContext-DfHdr3I3.cjs");
|
|
41
|
-
const require_ProfileScreen = require("./ProfileScreen-
|
|
41
|
+
const require_ProfileScreen = require("./ProfileScreen-PlDpc8RU.cjs");
|
|
42
42
|
exports.ProfileScreen = require_ProfileScreen.ProfileScreen;
|
|
43
43
|
exports.profileScreenPropertySchema = require_ProfileScreen.profileScreenPropertySchema;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as __exportAll } from "./es-C0sscSvf.mjs";
|
|
2
|
-
import { B as usePayApi, n as useFluidContext, z as useLanguagesApi } from "./FluidProvider-
|
|
2
|
+
import { B as usePayApi, n as useFluidContext, z as useLanguagesApi } from "./FluidProvider-DrGFcRlB.mjs";
|
|
3
3
|
import { n as useAccountApi } from "./account-api-context-R4VVlZdv.mjs";
|
|
4
4
|
import { n as useCountriesApi } from "./countries-api-context-DScC_39w.mjs";
|
|
5
5
|
import { t as parseApiErrors } from "./parse-api-errors-XxGAprV3.mjs";
|
|
@@ -1072,12 +1072,27 @@ function Addresses({ addresses, isLoading = false, onCreateAddress, onDeleteAddr
|
|
|
1072
1072
|
}
|
|
1073
1073
|
//#endregion
|
|
1074
1074
|
//#region ../../profile/ui/src/components/payment-method-dropdown.tsx
|
|
1075
|
+
const PAYMENT_ICON_BASE = "https://assets.fluid.app/images/payment_icons";
|
|
1076
|
+
const GENERIC_PAYMENT_ICON = `${PAYMENT_ICON_BASE}/generic.svg`;
|
|
1077
|
+
function brandIconUrl(brand) {
|
|
1078
|
+
if (!brand) return GENERIC_PAYMENT_ICON;
|
|
1079
|
+
return `${PAYMENT_ICON_BASE}/${brand.toLowerCase().replace(/\s+/g, "_")}.svg`;
|
|
1080
|
+
}
|
|
1081
|
+
function PaymentIcon({ logoUrl, brand, alt }) {
|
|
1082
|
+
const computedSrc = logoUrl || brandIconUrl(brand);
|
|
1083
|
+
const [hasError, setHasError] = useState(false);
|
|
1084
|
+
return /* @__PURE__ */ jsx("img", {
|
|
1085
|
+
src: hasError ? GENERIC_PAYMENT_ICON : computedSrc,
|
|
1086
|
+
alt,
|
|
1087
|
+
width: 40,
|
|
1088
|
+
height: 24,
|
|
1089
|
+
className: "object-contain",
|
|
1090
|
+
onError: () => setHasError(true)
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1075
1093
|
function getCardDisplayName(paymentMethod) {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
const lastFour = paymentMethod.details.last_four;
|
|
1079
|
-
return `${brand ?? "Card"} •••• ${lastFour ?? "****"}`;
|
|
1080
|
-
}
|
|
1094
|
+
const lastFour = paymentMethod.details.last_four;
|
|
1095
|
+
if (lastFour != null || paymentMethod.payment_type === "Credit Card") return `${paymentMethod.details.card_type || "Card"} •••• ${lastFour || "••••"}`;
|
|
1081
1096
|
return paymentMethod.payment_type;
|
|
1082
1097
|
}
|
|
1083
1098
|
function getCardExpiry(paymentMethod) {
|
|
@@ -1085,27 +1100,24 @@ function getCardExpiry(paymentMethod) {
|
|
|
1085
1100
|
if (exp_month != null && exp_year != null) return `Expires ${exp_month}/${exp_year}`;
|
|
1086
1101
|
return "";
|
|
1087
1102
|
}
|
|
1088
|
-
function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList, onAddPaymentMethodClick, onEditPaymentMethod, onDeletePaymentMethod, accordionItemValue = "paymentMethods", addPaymentMethodLabel = "+ Add a payment method", showAddButton = true, borderStyle = "border-b border-
|
|
1103
|
+
function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList, onAddPaymentMethodClick, onEditPaymentMethod, onDeletePaymentMethod, accordionItemValue = "paymentMethods", addPaymentMethodLabel = "+ Add a payment method", showAddButton = true, borderStyle = "border-b border-border pb-4 mb-6", className = "", showActions = true, isLoading = false }) {
|
|
1089
1104
|
const [paymentsValue, setPaymentsValue] = useState("");
|
|
1090
|
-
const { t } = useProfileUI();
|
|
1091
1105
|
const renderPaymentMethod = (paymentMethod) => /* @__PURE__ */ jsxs("div", {
|
|
1092
1106
|
className: "flex flex-row items-center space-x-2",
|
|
1093
|
-
children: [
|
|
1094
|
-
className: "h-6 w-10 flex-shrink-0",
|
|
1095
|
-
children: /* @__PURE__ */ jsx(
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
height: 24,
|
|
1100
|
-
className: "object-contain"
|
|
1107
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1108
|
+
className: "flex h-6 w-10 flex-shrink-0 items-center justify-center",
|
|
1109
|
+
children: /* @__PURE__ */ jsx(PaymentIcon, {
|
|
1110
|
+
logoUrl: paymentMethod.details.logo_url,
|
|
1111
|
+
brand: paymentMethod.details.card_type,
|
|
1112
|
+
alt: paymentMethod.details.card_type ?? "Payment Method"
|
|
1101
1113
|
})
|
|
1102
1114
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1103
1115
|
className: "flex flex-col",
|
|
1104
1116
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1105
|
-
className: "flex items-center text-sm font-medium
|
|
1117
|
+
className: "text-foreground flex items-center text-sm font-medium capitalize",
|
|
1106
1118
|
children: getCardDisplayName(paymentMethod)
|
|
1107
1119
|
}), getCardExpiry(paymentMethod) && /* @__PURE__ */ jsx("div", {
|
|
1108
|
-
className: "text-
|
|
1120
|
+
className: "text-muted-foreground text-sm",
|
|
1109
1121
|
children: getCardExpiry(paymentMethod)
|
|
1110
1122
|
})]
|
|
1111
1123
|
})]
|
|
@@ -1125,7 +1137,7 @@ function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList,
|
|
|
1125
1137
|
/* @__PURE__ */ jsxs("div", {
|
|
1126
1138
|
className: "flex flex-row items-center justify-between",
|
|
1127
1139
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1128
|
-
className: "mt-4 mb-1 text-sm
|
|
1140
|
+
className: "text-muted-foreground mt-4 mb-1 text-sm",
|
|
1129
1141
|
children: title
|
|
1130
1142
|
}), /* @__PURE__ */ jsx(AccordionTrigger, { className: "m-0 ml-2 flex h-auto min-h-0 w-auto py-0 hover:no-underline" })]
|
|
1131
1143
|
}),
|
|
@@ -1145,7 +1157,7 @@ function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList,
|
|
|
1145
1157
|
children: /* @__PURE__ */ jsx("div", {
|
|
1146
1158
|
className: "mt-2 flex flex-col justify-between space-y-4 px-0.5",
|
|
1147
1159
|
children: isLoading ? /* @__PURE__ */ jsx(Fragment$1, { children: [1, 2].map((i) => /* @__PURE__ */ jsx("div", {
|
|
1148
|
-
className: "items-center rounded
|
|
1160
|
+
className: "bg-muted items-center rounded p-3",
|
|
1149
1161
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1150
1162
|
className: "flex flex-row items-center justify-between",
|
|
1151
1163
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -1157,38 +1169,36 @@ function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList,
|
|
|
1157
1169
|
}), /* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-6" })]
|
|
1158
1170
|
})
|
|
1159
1171
|
}, `skeleton-${i}`)) }) : paymentMethodList.map((paymentMethod, index) => /* @__PURE__ */ jsxs("div", {
|
|
1160
|
-
className: cn("flex min-h-[48px] w-full flex-row items-center justify-between space-x-2 px-2", { "items-center border-b
|
|
1172
|
+
className: cn("flex min-h-[48px] w-full flex-row items-center justify-between space-x-2 px-2", { "border-border items-center border-b p-3": paymentMethodList.length - 1 !== index }),
|
|
1161
1173
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
1162
1174
|
className: "flex flex-row items-center space-x-2",
|
|
1163
|
-
children: [
|
|
1164
|
-
className: "h-6 w-10 flex-shrink-0",
|
|
1165
|
-
children: /* @__PURE__ */ jsx(
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
height: 24,
|
|
1170
|
-
className: "object-contain"
|
|
1175
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1176
|
+
className: "flex h-6 w-10 flex-shrink-0 items-center justify-center",
|
|
1177
|
+
children: /* @__PURE__ */ jsx(PaymentIcon, {
|
|
1178
|
+
logoUrl: paymentMethod.details.logo_url,
|
|
1179
|
+
brand: paymentMethod.details.card_type,
|
|
1180
|
+
alt: paymentMethod.details.card_type ?? "Payment Method"
|
|
1171
1181
|
})
|
|
1172
1182
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1173
1183
|
className: "flex flex-col",
|
|
1174
1184
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1175
|
-
className: "flex items-center text-sm font-medium
|
|
1176
|
-
children:
|
|
1177
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
1178
|
-
className: "text-
|
|
1179
|
-
children:
|
|
1185
|
+
className: "text-foreground flex items-center text-sm font-medium capitalize",
|
|
1186
|
+
children: getCardDisplayName(paymentMethod)
|
|
1187
|
+
}), getCardExpiry(paymentMethod) && /* @__PURE__ */ jsx("div", {
|
|
1188
|
+
className: "text-muted-foreground text-sm",
|
|
1189
|
+
children: getCardExpiry(paymentMethod)
|
|
1180
1190
|
})]
|
|
1181
1191
|
})]
|
|
1182
1192
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1183
1193
|
className: "flex flex-row items-center space-x-2",
|
|
1184
1194
|
children: [paymentMethod.default && /* @__PURE__ */ jsx("p", {
|
|
1185
|
-
className: "mt-1 w-fit rounded
|
|
1186
|
-
children:
|
|
1195
|
+
className: "bg-secondary text-secondary-foreground mt-1 w-fit rounded px-2 py-0.5 text-xs font-medium",
|
|
1196
|
+
children: "Default"
|
|
1187
1197
|
}), showActions && /* @__PURE__ */ jsx(EllipsesDropdown, {
|
|
1188
1198
|
onDelete: () => onDeletePaymentMethod?.(paymentMethod),
|
|
1189
|
-
deleteLabel:
|
|
1199
|
+
deleteLabel: "Delete",
|
|
1190
1200
|
onEdit: () => onEditPaymentMethod?.(paymentMethod),
|
|
1191
|
-
editLabel:
|
|
1201
|
+
editLabel: "Edit"
|
|
1192
1202
|
})]
|
|
1193
1203
|
})]
|
|
1194
1204
|
}, paymentMethod.id))
|
|
@@ -1197,7 +1207,7 @@ function PaymentMethodDropdown({ title, displayPaymentMethod, paymentMethodList,
|
|
|
1197
1207
|
]
|
|
1198
1208
|
})
|
|
1199
1209
|
}), showAddButton && /* @__PURE__ */ jsx("button", {
|
|
1200
|
-
className: "mt-3 text-left text-sm
|
|
1210
|
+
className: "text-foreground mt-3 text-left text-sm",
|
|
1201
1211
|
onClick: onAddPaymentMethodClick,
|
|
1202
1212
|
children: addPaymentMethodLabel
|
|
1203
1213
|
})]
|
|
@@ -2618,6 +2628,10 @@ function mapAccountToCustomerAccount(raw) {
|
|
|
2618
2628
|
}
|
|
2619
2629
|
};
|
|
2620
2630
|
}
|
|
2631
|
+
function composeAddressName(firstName, lastName) {
|
|
2632
|
+
const combined = `${firstName} ${lastName}`.trim();
|
|
2633
|
+
return combined.length > 0 ? combined : null;
|
|
2634
|
+
}
|
|
2621
2635
|
function mapToFluidPayAddress(raw) {
|
|
2622
2636
|
return {
|
|
2623
2637
|
id: raw.id,
|
|
@@ -2626,7 +2640,7 @@ function mapToFluidPayAddress(raw) {
|
|
|
2626
2640
|
city: raw.city,
|
|
2627
2641
|
country_code: raw.country,
|
|
2628
2642
|
default: raw.default,
|
|
2629
|
-
name:
|
|
2643
|
+
name: raw.name,
|
|
2630
2644
|
postal_code: raw.zip,
|
|
2631
2645
|
state: raw.state,
|
|
2632
2646
|
subdivision_code: null
|
|
@@ -2644,7 +2658,15 @@ function mapToFluidPayPaymentMethod(raw) {
|
|
|
2644
2658
|
exp_month: raw.exp_month ?? void 0,
|
|
2645
2659
|
exp_year: raw.exp_year ?? void 0
|
|
2646
2660
|
},
|
|
2647
|
-
billing_address:
|
|
2661
|
+
billing_address: raw.billing_address ? {
|
|
2662
|
+
name: raw.billing_address.name,
|
|
2663
|
+
address1: raw.billing_address.street1,
|
|
2664
|
+
address2: raw.billing_address.street2,
|
|
2665
|
+
city: raw.billing_address.city,
|
|
2666
|
+
state: raw.billing_address.state,
|
|
2667
|
+
zip: raw.billing_address.zip,
|
|
2668
|
+
country_code: raw.billing_address.country
|
|
2669
|
+
} : null,
|
|
2648
2670
|
payment_type: raw.type,
|
|
2649
2671
|
source: "",
|
|
2650
2672
|
updated_at: raw.updated_at ?? ""
|
|
@@ -2676,9 +2698,9 @@ function createFluidPayShim(payApi) {
|
|
|
2676
2698
|
const response = await payApi.fetchVaultCredentials();
|
|
2677
2699
|
return {
|
|
2678
2700
|
vault: {
|
|
2679
|
-
vault_id: response.vault.
|
|
2701
|
+
vault_id: response.vault.vault_id,
|
|
2680
2702
|
environment: response.vault.environment,
|
|
2681
|
-
route_id: "",
|
|
2703
|
+
route_id: response.vault.route_id ?? "",
|
|
2682
2704
|
requires_3ds: false
|
|
2683
2705
|
},
|
|
2684
2706
|
meta: {
|
|
@@ -2767,13 +2789,28 @@ function ProfileContentScreen({ onToast, countryIso: _countryIso }) {
|
|
|
2767
2789
|
}
|
|
2768
2790
|
});
|
|
2769
2791
|
const updatePaymentMethodMutation = useMutation({
|
|
2770
|
-
mutationFn: ({ paymentMethodId, data }) => payApi.updatePaymentMethod(paymentMethodId, { payment_method: {
|
|
2792
|
+
mutationFn: ({ paymentMethodId, data }) => payApi.updatePaymentMethod(paymentMethodId, { payment_method: {
|
|
2793
|
+
default: data.set_as_default,
|
|
2794
|
+
billing_address: {
|
|
2795
|
+
name: data.billing_address.name,
|
|
2796
|
+
street1: data.billing_address.address1,
|
|
2797
|
+
street2: data.billing_address.address2 ?? null,
|
|
2798
|
+
city: data.billing_address.city,
|
|
2799
|
+
state: data.billing_address.state,
|
|
2800
|
+
zip: data.billing_address.zip,
|
|
2801
|
+
country: data.billing_address.country_code
|
|
2802
|
+
}
|
|
2803
|
+
} }),
|
|
2771
2804
|
onSuccess: () => {
|
|
2772
2805
|
queryClient.invalidateQueries({ queryKey: payKeys.paymentMethods.all });
|
|
2806
|
+
},
|
|
2807
|
+
onError: () => {
|
|
2808
|
+
onToast("Failed to update payment method", "error");
|
|
2773
2809
|
}
|
|
2774
2810
|
});
|
|
2775
2811
|
const createAddressMutation = useMutation({
|
|
2776
2812
|
mutationFn: (body) => payApi.createAddress({ address: {
|
|
2813
|
+
name: composeAddressName(body.address.first_name, body.address.last_name),
|
|
2777
2814
|
street1: body.address.address1,
|
|
2778
2815
|
street2: body.address.address2,
|
|
2779
2816
|
city: body.address.city,
|
|
@@ -2791,6 +2828,7 @@ function ProfileContentScreen({ onToast, countryIso: _countryIso }) {
|
|
|
2791
2828
|
});
|
|
2792
2829
|
const updateAddressMutation = useMutation({
|
|
2793
2830
|
mutationFn: ({ addressId, body }) => payApi.updateAddress(addressId, { address: {
|
|
2831
|
+
name: composeAddressName(body.address.first_name, body.address.last_name),
|
|
2794
2832
|
street1: body.address.address1,
|
|
2795
2833
|
street2: body.address.address2,
|
|
2796
2834
|
city: body.address.city,
|
|
@@ -2885,7 +2923,7 @@ function ProfileContentScreen({ onToast, countryIso: _countryIso }) {
|
|
|
2885
2923
|
});
|
|
2886
2924
|
},
|
|
2887
2925
|
isUpdatingPaymentMethod: updatePaymentMethodMutation.isPending,
|
|
2888
|
-
getBillingAddress: () => null,
|
|
2926
|
+
getBillingAddress: (paymentMethod) => paymentMethod.billing_address ?? null,
|
|
2889
2927
|
countries: countryOptions,
|
|
2890
2928
|
renderAddressDialog: ({ isOpen, onClose, selectedAddress }) => /* @__PURE__ */ jsx(AddressFormDialog, {
|
|
2891
2929
|
isOpen,
|
|
@@ -2986,4 +3024,4 @@ const profileScreenPropertySchema = {
|
|
|
2986
3024
|
//#endregion
|
|
2987
3025
|
export { ProfileScreen_exports as n, profileScreenPropertySchema as r, ProfileScreen as t };
|
|
2988
3026
|
|
|
2989
|
-
//# sourceMappingURL=ProfileScreen-
|
|
3027
|
+
//# sourceMappingURL=ProfileScreen-CD2lmt5S.mjs.map
|