@fluid-app/portal-sdk 0.1.101 → 0.1.103
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/{AppDownloadScreen-rO--O0pk.mjs → AppDownloadScreen-BBpvNeFO.mjs} +2 -2
- package/dist/{AppDownloadScreen-rO--O0pk.mjs.map → AppDownloadScreen-BBpvNeFO.mjs.map} +1 -1
- package/dist/{AppDownloadScreen-BcK2snUL.cjs → AppDownloadScreen-Da79ffTK.cjs} +2 -2
- package/dist/{AppDownloadScreen-BcK2snUL.cjs.map → AppDownloadScreen-Da79ffTK.cjs.map} +1 -1
- package/dist/{AppDownloadScreen-CwLZzr-7.cjs → AppDownloadScreen-R3rcFWzL.cjs} +2 -2
- package/dist/{ContactsScreen-CkSeaPyz.cjs → ContactsScreen-CFC32ATZ.cjs} +2 -2
- package/dist/{ContactsScreen-CkSeaPyz.cjs.map → ContactsScreen-CFC32ATZ.cjs.map} +1 -1
- package/dist/{ContactsScreen-BGwqGlpV.mjs → ContactsScreen-CGyCNeZy.mjs} +2 -2
- package/dist/{ContactsScreen-BGwqGlpV.mjs.map → ContactsScreen-CGyCNeZy.mjs.map} +1 -1
- package/dist/{ContactsScreen-D4WQ59ib.cjs → ContactsScreen-D81raD2s.cjs} +2 -2
- package/dist/{FluidProvider-CWYquEIF.mjs → FluidProvider-B59bzF__.mjs} +118 -1131
- package/dist/FluidProvider-B59bzF__.mjs.map +1 -0
- package/dist/{FluidProvider-CyzA2g75.cjs → FluidProvider-DbYLBGGg.cjs} +119 -1210
- package/dist/FluidProvider-DbYLBGGg.cjs.map +1 -0
- package/dist/{MessagingScreen-CBuI3fu6.mjs → MessagingScreen-6SfuZqDC.mjs} +4 -9
- package/dist/MessagingScreen-6SfuZqDC.mjs.map +1 -0
- package/dist/{MessagingScreen-DKigg2jz.mjs → MessagingScreen-Bg-7zNye.mjs} +2 -2
- package/dist/{MessagingScreen-Cgx3jwpr.cjs → MessagingScreen-DsH-L7vB.cjs} +4 -9
- package/dist/MessagingScreen-DsH-L7vB.cjs.map +1 -0
- package/dist/{MessagingScreen-CGS7aG1A.cjs → MessagingScreen-TCOhXTPN.cjs} +2 -2
- package/dist/{MySiteScreen-BSFb-n7n.cjs → MySiteScreen-BHiMCIZ_.cjs} +2 -2
- package/dist/{MySiteScreen-BSFb-n7n.cjs.map → MySiteScreen-BHiMCIZ_.cjs.map} +1 -1
- package/dist/{MySiteScreen-Bvyx63pT.mjs → MySiteScreen-BI089vJc.mjs} +2 -2
- package/dist/{MySiteScreen-Bvyx63pT.mjs.map → MySiteScreen-BI089vJc.mjs.map} +1 -1
- package/dist/{MySiteScreen-2IzxVfpO.cjs → MySiteScreen-DDX4xcMv.cjs} +2 -2
- package/dist/{OrdersScreen-Bf4o3Kty.cjs → OrdersScreen-Cc6iUf0a.cjs} +3 -3
- package/dist/{OrdersScreen-Bf4o3Kty.cjs.map → OrdersScreen-Cc6iUf0a.cjs.map} +1 -1
- package/dist/{OrdersScreen-Djdeji9g.mjs → OrdersScreen-CdwVcUrG.mjs} +3 -3
- package/dist/{OrdersScreen-Djdeji9g.mjs.map → OrdersScreen-CdwVcUrG.mjs.map} +1 -1
- package/dist/{OrdersScreen-DCzYEgsP.cjs → OrdersScreen-CtG8_C45.cjs} +2 -2
- package/dist/{ProductsScreen-DZiugPVb.mjs → ProductsScreen-BZbpjY2G.mjs} +3 -3
- package/dist/{ProductsScreen-6J79mnIB.mjs → ProductsScreen-BcIiBPCz.mjs} +4 -4
- package/dist/{ProductsScreen-6J79mnIB.mjs.map → ProductsScreen-BcIiBPCz.mjs.map} +1 -1
- package/dist/{ProductsScreen-PJ95OcSX.cjs → ProductsScreen-W0uLKrfx.cjs} +4 -4
- package/dist/{ProductsScreen-PJ95OcSX.cjs.map → ProductsScreen-W0uLKrfx.cjs.map} +1 -1
- package/dist/{ProductsScreen-DZnKtPBp.cjs → ProductsScreen-eiMXiu0K.cjs} +3 -3
- package/dist/{ProfileScreen-CUsGRCB7.mjs → ProfileScreen-BEHwzWv1.mjs} +3 -3
- package/dist/{ProfileScreen-CUsGRCB7.mjs.map → ProfileScreen-BEHwzWv1.mjs.map} +1 -1
- package/dist/{ProfileScreen-DtmReqa8.cjs → ProfileScreen-CKuu4YAP.cjs} +3 -3
- package/dist/{ProfileScreen-DtmReqa8.cjs.map → ProfileScreen-CKuu4YAP.cjs.map} +1 -1
- package/dist/{ProfileScreen-B46jd4Ic.cjs → ProfileScreen-xD7FL-W6.cjs} +2 -2
- package/dist/{ShareablesScreen-Dk5EQGMa.cjs → ShareablesScreen-B_N1aWKn.cjs} +3 -3
- package/dist/{ShareablesScreen-DFAVIeqB.mjs → ShareablesScreen-Bvkd-M9u.mjs} +3 -3
- package/dist/{ShareablesScreen-CVT7u2hN.cjs → ShareablesScreen-M_f9a05D.cjs} +5 -5
- package/dist/{ShareablesScreen-CVT7u2hN.cjs.map → ShareablesScreen-M_f9a05D.cjs.map} +1 -1
- package/dist/{ShareablesScreen-Cy7w85IH.mjs → ShareablesScreen-Xf6w_Cri.mjs} +5 -5
- package/dist/{ShareablesScreen-Cy7w85IH.mjs.map → ShareablesScreen-Xf6w_Cri.mjs.map} +1 -1
- package/dist/{ShopScreen-AGvcqUii.mjs → ShopScreen-C9OVBv3h.mjs} +4 -4
- package/dist/{ShopScreen-AGvcqUii.mjs.map → ShopScreen-C9OVBv3h.mjs.map} +1 -1
- package/dist/{ShopScreen-DgBjP_8D.cjs → ShopScreen-CcNHTbVr.cjs} +4 -4
- package/dist/{ShopScreen-DgBjP_8D.cjs.map → ShopScreen-CcNHTbVr.cjs.map} +1 -1
- package/dist/{ShopScreen-wYtLEGXo.cjs → ShopScreen-Czot9O3w.cjs} +2 -2
- package/dist/{SubscriptionsScreen-C5YWtYfE.mjs → SubscriptionsScreen-BAwlzqnk.mjs} +3 -3
- package/dist/{SubscriptionsScreen-C5YWtYfE.mjs.map → SubscriptionsScreen-BAwlzqnk.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-BrLlvFJn.cjs → SubscriptionsScreen-BDtmlP7D.cjs} +3 -3
- package/dist/{SubscriptionsScreen-BrLlvFJn.cjs.map → SubscriptionsScreen-BDtmlP7D.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-BqOb2kYR.cjs → SubscriptionsScreen-De15MoiH.cjs} +2 -2
- package/dist/index.cjs +53 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -41
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +52 -41
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +53 -54
- package/dist/index.mjs.map +1 -1
- package/dist/{src-BrwLqPPh.mjs → src-DjlwUaws.mjs} +40 -12
- package/dist/src-DjlwUaws.mjs.map +1 -0
- package/dist/{src-Dlsw83js.cjs → src-xEfkv04t.cjs} +40 -12
- package/dist/src-xEfkv04t.cjs.map +1 -0
- package/dist/{use-account-clients-Dsqx0mKw.mjs → use-account-clients-BbT2Gfi8.mjs} +2 -2
- package/dist/{use-account-clients-Dsqx0mKw.mjs.map → use-account-clients-BbT2Gfi8.mjs.map} +1 -1
- package/dist/{use-account-clients-CkDfPpCR.cjs → use-account-clients-FORfQTn6.cjs} +2 -2
- package/dist/{use-account-clients-CkDfPpCR.cjs.map → use-account-clients-FORfQTn6.cjs.map} +1 -1
- package/dist/{use-current-user-LLJ1GtNB.cjs → use-current-user-CrHH290V.cjs} +3 -3
- package/dist/{use-current-user-LLJ1GtNB.cjs.map → use-current-user-CrHH290V.cjs.map} +1 -1
- package/dist/{use-current-user-BMI-LR9t.mjs → use-current-user-SmbdS--3.mjs} +3 -3
- package/dist/{use-current-user-BMI-LR9t.mjs.map → use-current-user-SmbdS--3.mjs.map} +1 -1
- package/dist/{use-customer-account-DzOD3vLz.mjs → use-customer-account-CXOgxyNX.mjs} +3 -3
- package/dist/{use-customer-account-DzOD3vLz.mjs.map → use-customer-account-CXOgxyNX.mjs.map} +1 -1
- package/dist/{use-customer-account-DZW_YY9d.cjs → use-customer-account-DJiCXIoH.cjs} +3 -3
- package/dist/{use-customer-account-DZW_YY9d.cjs.map → use-customer-account-DJiCXIoH.cjs.map} +1 -1
- package/dist/{use-fluid-api-Kw0AKvCs.cjs → use-fluid-api-C2evcv_D.cjs} +2 -2
- package/dist/{use-fluid-api-Kw0AKvCs.cjs.map → use-fluid-api-C2evcv_D.cjs.map} +1 -1
- package/dist/{use-fluid-api-CaSYWFuj.mjs → use-fluid-api-f1PKU6dS.mjs} +2 -2
- package/dist/{use-fluid-api-CaSYWFuj.mjs.map → use-fluid-api-f1PKU6dS.mjs.map} +1 -1
- package/package.json +8 -8
- package/dist/FluidProvider-CWYquEIF.mjs.map +0 -1
- package/dist/FluidProvider-CyzA2g75.cjs.map +0 -1
- package/dist/MessagingScreen-CBuI3fu6.mjs.map +0 -1
- package/dist/MessagingScreen-Cgx3jwpr.cjs.map +0 -1
- package/dist/src-BrwLqPPh.mjs.map +0 -1
- package/dist/src-Dlsw83js.cjs.map +0 -1
|
@@ -144,6 +144,28 @@ function useShareLink(item, shareableType, contactId, locale = "en") {
|
|
|
144
144
|
}
|
|
145
145
|
//#endregion
|
|
146
146
|
//#region ../../shareables/core/src/hooks/use-product-media-counts.ts
|
|
147
|
+
function useProductMediaCounts(productIds) {
|
|
148
|
+
const api = useShareablesApi();
|
|
149
|
+
return (0, _tanstack_react_query.useQuery)({
|
|
150
|
+
queryKey: shareablesKeys.productMedia.counts(productIds),
|
|
151
|
+
queryFn: async () => {
|
|
152
|
+
const counts = {};
|
|
153
|
+
const promises = productIds.map(async (productId) => {
|
|
154
|
+
try {
|
|
155
|
+
counts[productId] = ((await api.productMedia.getProductMedia(productId)).media || []).length;
|
|
156
|
+
} catch (error) {
|
|
157
|
+
console.warn(`Failed to fetch media count for product ${productId}:`, error);
|
|
158
|
+
counts[productId] = 0;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
await Promise.allSettled(promises);
|
|
162
|
+
return counts;
|
|
163
|
+
},
|
|
164
|
+
enabled: productIds.length > 0,
|
|
165
|
+
staleTime: 300 * 1e3,
|
|
166
|
+
gcTime: 600 * 1e3
|
|
167
|
+
});
|
|
168
|
+
}
|
|
147
169
|
function useProductMediaCount(productId) {
|
|
148
170
|
const api = useShareablesApi();
|
|
149
171
|
return (0, _tanstack_react_query.useQuery)({
|
|
@@ -499,8 +521,10 @@ function getProductImageUrl(product) {
|
|
|
499
521
|
}
|
|
500
522
|
return product.image_url ?? null;
|
|
501
523
|
}
|
|
502
|
-
function ShareProductCard({ product }) {
|
|
503
|
-
const
|
|
524
|
+
function ShareProductCard({ product, mediaCount: externalMediaCount }) {
|
|
525
|
+
const skipFetch = externalMediaCount !== void 0;
|
|
526
|
+
const { data: fetchedCount = 0, isLoading: isLoadingMediaCount } = useProductMediaCount(skipFetch ? 0 : product.id);
|
|
527
|
+
const resolvedCount = skipFetch ? externalMediaCount : fetchedCount;
|
|
504
528
|
const imageUrl = getProductImageUrl(product);
|
|
505
529
|
const isVideo = product.kind === "video" && !!product.video_url;
|
|
506
530
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShareItemCard, {
|
|
@@ -508,8 +532,8 @@ function ShareProductCard({ product }) {
|
|
|
508
532
|
imageUrl,
|
|
509
533
|
href: `product/${product.id}`,
|
|
510
534
|
badge: !isVideo ? {
|
|
511
|
-
text: `${
|
|
512
|
-
isLoading: isLoadingMediaCount
|
|
535
|
+
text: `${resolvedCount} assets`,
|
|
536
|
+
isLoading: !skipFetch && isLoadingMediaCount
|
|
513
537
|
} : void 0,
|
|
514
538
|
isVideo
|
|
515
539
|
});
|
|
@@ -578,7 +602,8 @@ function ProductsScreen({ countryCode, onNavigate }) {
|
|
|
578
602
|
observer.observe(target);
|
|
579
603
|
return () => observer.disconnect();
|
|
580
604
|
}, [handleIntersect]);
|
|
581
|
-
const products = data?.pages.flat() ?? [];
|
|
605
|
+
const products = (0, react.useMemo)(() => data?.pages.flat() ?? [], [data]);
|
|
606
|
+
const { data: mediaCounts } = useProductMediaCounts((0, react.useMemo)(() => products.map((p) => p.id), [products]));
|
|
582
607
|
if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
583
608
|
className: "space-y-6 px-4 py-4 md:px-10 md:py-6",
|
|
584
609
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -632,12 +657,15 @@ function ProductsScreen({ countryCode, onNavigate }) {
|
|
|
632
657
|
})
|
|
633
658
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
634
659
|
className: GRID_CLASS$3,
|
|
635
|
-
children: products.map((product) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShareProductCard, {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
660
|
+
children: products.map((product) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShareProductCard, {
|
|
661
|
+
product: {
|
|
662
|
+
id: product.id,
|
|
663
|
+
title: product.title ?? "",
|
|
664
|
+
image_url: product.image_url,
|
|
665
|
+
images: product.images
|
|
666
|
+
},
|
|
667
|
+
mediaCount: mediaCounts?.[product.id]
|
|
668
|
+
}, product.id))
|
|
641
669
|
}),
|
|
642
670
|
isFetchingNextPage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
643
671
|
className: "flex justify-center py-4",
|
|
@@ -8873,4 +8901,4 @@ Object.defineProperty(exports, "getFileMimeType", {
|
|
|
8873
8901
|
}
|
|
8874
8902
|
});
|
|
8875
8903
|
|
|
8876
|
-
//# sourceMappingURL=src-
|
|
8904
|
+
//# sourceMappingURL=src-xEfkv04t.cjs.map
|