@fluid-app/portal-sdk 0.1.100 → 0.1.102

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.
Files changed (92) hide show
  1. package/dist/{AppDownloadScreen-rO--O0pk.mjs → AppDownloadScreen-BUyo5t28.mjs} +2 -2
  2. package/dist/{AppDownloadScreen-rO--O0pk.mjs.map → AppDownloadScreen-BUyo5t28.mjs.map} +1 -1
  3. package/dist/{AppDownloadScreen-CwLZzr-7.cjs → AppDownloadScreen-D7TgBBNp.cjs} +2 -2
  4. package/dist/{AppDownloadScreen-BcK2snUL.cjs → AppDownloadScreen-DRXJupWZ.cjs} +2 -2
  5. package/dist/{AppDownloadScreen-BcK2snUL.cjs.map → AppDownloadScreen-DRXJupWZ.cjs.map} +1 -1
  6. package/dist/{ContactsScreen-D4WQ59ib.cjs → ContactsScreen-8yKH9Vmm.cjs} +2 -2
  7. package/dist/{ContactsScreen-BGwqGlpV.mjs → ContactsScreen-CHZ-SGpD.mjs} +2 -2
  8. package/dist/{ContactsScreen-BGwqGlpV.mjs.map → ContactsScreen-CHZ-SGpD.mjs.map} +1 -1
  9. package/dist/{ContactsScreen-CkSeaPyz.cjs → ContactsScreen-DXDkh7cU.cjs} +2 -2
  10. package/dist/{ContactsScreen-CkSeaPyz.cjs.map → ContactsScreen-DXDkh7cU.cjs.map} +1 -1
  11. package/dist/{FluidProvider-CWYquEIF.mjs → FluidProvider-BPFyPU7u.mjs} +81 -32
  12. package/dist/FluidProvider-BPFyPU7u.mjs.map +1 -0
  13. package/dist/{FluidProvider-CyzA2g75.cjs → FluidProvider-CUiOFaDp.cjs} +81 -32
  14. package/dist/FluidProvider-CUiOFaDp.cjs.map +1 -0
  15. package/dist/{MessagingScreen-Cgx3jwpr.cjs → MessagingScreen-CuVoDjwR.cjs} +4 -9
  16. package/dist/MessagingScreen-CuVoDjwR.cjs.map +1 -0
  17. package/dist/{MessagingScreen-84R1a-lD.mjs → MessagingScreen-D2GGSkix.mjs} +2 -3
  18. package/dist/{MessagingScreen-CGS7aG1A.cjs → MessagingScreen-V7ribzpo.cjs} +2 -2
  19. package/dist/{MessagingScreen-CBuI3fu6.mjs → MessagingScreen-pS-W5HIk.mjs} +4 -9
  20. package/dist/MessagingScreen-pS-W5HIk.mjs.map +1 -0
  21. package/dist/{MySiteScreen-Bvyx63pT.mjs → MySiteScreen-CSs9d6TQ.mjs} +2 -2
  22. package/dist/{MySiteScreen-Bvyx63pT.mjs.map → MySiteScreen-CSs9d6TQ.mjs.map} +1 -1
  23. package/dist/{MySiteScreen-BSFb-n7n.cjs → MySiteScreen-DjtoRz-f.cjs} +2 -2
  24. package/dist/{MySiteScreen-BSFb-n7n.cjs.map → MySiteScreen-DjtoRz-f.cjs.map} +1 -1
  25. package/dist/{MySiteScreen-2IzxVfpO.cjs → MySiteScreen-DtpHDP-m.cjs} +2 -2
  26. package/dist/{OrdersScreen-Djdeji9g.mjs → OrdersScreen-BUm_cDrS.mjs} +3 -3
  27. package/dist/{OrdersScreen-Djdeji9g.mjs.map → OrdersScreen-BUm_cDrS.mjs.map} +1 -1
  28. package/dist/{OrdersScreen-Bf4o3Kty.cjs → OrdersScreen-DNAtzcu5.cjs} +3 -3
  29. package/dist/{OrdersScreen-Bf4o3Kty.cjs.map → OrdersScreen-DNAtzcu5.cjs.map} +1 -1
  30. package/dist/{OrdersScreen-DCzYEgsP.cjs → OrdersScreen-NSLW9EyM.cjs} +2 -2
  31. package/dist/{ProductsScreen-PJ95OcSX.cjs → ProductsScreen-0K31iqTS.cjs} +4 -4
  32. package/dist/{ProductsScreen-PJ95OcSX.cjs.map → ProductsScreen-0K31iqTS.cjs.map} +1 -1
  33. package/dist/{ProductsScreen-DbHS3p4U.mjs → ProductsScreen-CQlvW2cC.mjs} +3 -7
  34. package/dist/{ProductsScreen-DZnKtPBp.cjs → ProductsScreen-CSgVSuOa.cjs} +3 -3
  35. package/dist/{ProductsScreen-6J79mnIB.mjs → ProductsScreen-Cc5LjAOS.mjs} +4 -4
  36. package/dist/{ProductsScreen-6J79mnIB.mjs.map → ProductsScreen-Cc5LjAOS.mjs.map} +1 -1
  37. package/dist/{ProfileScreen-DtmReqa8.cjs → ProfileScreen-BRSE-yT7.cjs} +3 -3
  38. package/dist/{ProfileScreen-DtmReqa8.cjs.map → ProfileScreen-BRSE-yT7.cjs.map} +1 -1
  39. package/dist/{ProfileScreen-B46jd4Ic.cjs → ProfileScreen-CxLqoYTU.cjs} +2 -2
  40. package/dist/{ProfileScreen-CUsGRCB7.mjs → ProfileScreen-DXdLGjJE.mjs} +3 -3
  41. package/dist/{ProfileScreen-CUsGRCB7.mjs.map → ProfileScreen-DXdLGjJE.mjs.map} +1 -1
  42. package/dist/{ShareablesScreen-Cy7w85IH.mjs → ShareablesScreen-C3ZUhqHP.mjs} +5 -5
  43. package/dist/{ShareablesScreen-Cy7w85IH.mjs.map → ShareablesScreen-C3ZUhqHP.mjs.map} +1 -1
  44. package/dist/{ShareablesScreen-Dk5EQGMa.cjs → ShareablesScreen-TAJ2R5pG.cjs} +3 -3
  45. package/dist/{ShareablesScreen-CVT7u2hN.cjs → ShareablesScreen-baTkO1KB.cjs} +5 -5
  46. package/dist/{ShareablesScreen-CVT7u2hN.cjs.map → ShareablesScreen-baTkO1KB.cjs.map} +1 -1
  47. package/dist/{ShareablesScreen-DUpaH8VU.mjs → ShareablesScreen-h02BeiT8.mjs} +3 -7
  48. package/dist/{ShopScreen-DgBjP_8D.cjs → ShopScreen-BI5rtJQk.cjs} +4 -4
  49. package/dist/{ShopScreen-DgBjP_8D.cjs.map → ShopScreen-BI5rtJQk.cjs.map} +1 -1
  50. package/dist/{ShopScreen-wYtLEGXo.cjs → ShopScreen-BULLgDDI.cjs} +2 -2
  51. package/dist/{ShopScreen-AGvcqUii.mjs → ShopScreen-DJUhx1ly.mjs} +4 -4
  52. package/dist/{ShopScreen-AGvcqUii.mjs.map → ShopScreen-DJUhx1ly.mjs.map} +1 -1
  53. package/dist/{SubscriptionsScreen-BrLlvFJn.cjs → SubscriptionsScreen-BYCEYtcZ.cjs} +3 -3
  54. package/dist/{SubscriptionsScreen-BrLlvFJn.cjs.map → SubscriptionsScreen-BYCEYtcZ.cjs.map} +1 -1
  55. package/dist/{SubscriptionsScreen-C5YWtYfE.mjs → SubscriptionsScreen-CWwp5Po6.mjs} +3 -3
  56. package/dist/{SubscriptionsScreen-C5YWtYfE.mjs.map → SubscriptionsScreen-CWwp5Po6.mjs.map} +1 -1
  57. package/dist/{SubscriptionsScreen-BqOb2kYR.cjs → SubscriptionsScreen-hkhnXy8j.cjs} +2 -2
  58. package/dist/index.cjs +54 -52
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.d.cts +47 -28
  61. package/dist/index.d.cts.map +1 -1
  62. package/dist/index.d.mts +47 -28
  63. package/dist/index.d.mts.map +1 -1
  64. package/dist/index.mjs +54 -52
  65. package/dist/index.mjs.map +1 -1
  66. package/dist/{src-BrwLqPPh.mjs → src-DjlwUaws.mjs} +40 -12
  67. package/dist/src-DjlwUaws.mjs.map +1 -0
  68. package/dist/{src-Dlsw83js.cjs → src-xEfkv04t.cjs} +40 -12
  69. package/dist/src-xEfkv04t.cjs.map +1 -0
  70. package/dist/{use-account-clients-Dsqx0mKw.mjs → use-account-clients-3pKJ6EI1.mjs} +2 -2
  71. package/dist/{use-account-clients-Dsqx0mKw.mjs.map → use-account-clients-3pKJ6EI1.mjs.map} +1 -1
  72. package/dist/{use-account-clients-CkDfPpCR.cjs → use-account-clients-Bqc-31kE.cjs} +2 -2
  73. package/dist/{use-account-clients-CkDfPpCR.cjs.map → use-account-clients-Bqc-31kE.cjs.map} +1 -1
  74. package/dist/{use-current-user-BMI-LR9t.mjs → use-current-user-BRmRkzNy.mjs} +3 -3
  75. package/dist/{use-current-user-BMI-LR9t.mjs.map → use-current-user-BRmRkzNy.mjs.map} +1 -1
  76. package/dist/{use-current-user-LLJ1GtNB.cjs → use-current-user-DqzI6jzQ.cjs} +3 -3
  77. package/dist/{use-current-user-LLJ1GtNB.cjs.map → use-current-user-DqzI6jzQ.cjs.map} +1 -1
  78. package/dist/{use-customer-account-DZW_YY9d.cjs → use-customer-account-CHspwp0z.cjs} +3 -3
  79. package/dist/{use-customer-account-DZW_YY9d.cjs.map → use-customer-account-CHspwp0z.cjs.map} +1 -1
  80. package/dist/{use-customer-account-DzOD3vLz.mjs → use-customer-account-D83uR5o6.mjs} +3 -3
  81. package/dist/{use-customer-account-DzOD3vLz.mjs.map → use-customer-account-D83uR5o6.mjs.map} +1 -1
  82. package/dist/{use-fluid-api-Kw0AKvCs.cjs → use-fluid-api-CRZCVY8_.cjs} +2 -2
  83. package/dist/{use-fluid-api-Kw0AKvCs.cjs.map → use-fluid-api-CRZCVY8_.cjs.map} +1 -1
  84. package/dist/{use-fluid-api-CaSYWFuj.mjs → use-fluid-api-Cap4tsCe.mjs} +2 -2
  85. package/dist/{use-fluid-api-CaSYWFuj.mjs.map → use-fluid-api-Cap4tsCe.mjs.map} +1 -1
  86. package/package.json +12 -12
  87. package/dist/FluidProvider-CWYquEIF.mjs.map +0 -1
  88. package/dist/FluidProvider-CyzA2g75.cjs.map +0 -1
  89. package/dist/MessagingScreen-CBuI3fu6.mjs.map +0 -1
  90. package/dist/MessagingScreen-Cgx3jwpr.cjs.map +0 -1
  91. package/dist/src-BrwLqPPh.mjs.map +0 -1
  92. package/dist/src-Dlsw83js.cjs.map +0 -1
@@ -142,6 +142,28 @@ function useShareLink(item, shareableType, contactId, locale = "en") {
142
142
  }
143
143
  //#endregion
144
144
  //#region ../../shareables/core/src/hooks/use-product-media-counts.ts
145
+ function useProductMediaCounts(productIds) {
146
+ const api = useShareablesApi();
147
+ return useQuery({
148
+ queryKey: shareablesKeys.productMedia.counts(productIds),
149
+ queryFn: async () => {
150
+ const counts = {};
151
+ const promises = productIds.map(async (productId) => {
152
+ try {
153
+ counts[productId] = ((await api.productMedia.getProductMedia(productId)).media || []).length;
154
+ } catch (error) {
155
+ console.warn(`Failed to fetch media count for product ${productId}:`, error);
156
+ counts[productId] = 0;
157
+ }
158
+ });
159
+ await Promise.allSettled(promises);
160
+ return counts;
161
+ },
162
+ enabled: productIds.length > 0,
163
+ staleTime: 300 * 1e3,
164
+ gcTime: 600 * 1e3
165
+ });
166
+ }
145
167
  function useProductMediaCount(productId) {
146
168
  const api = useShareablesApi();
147
169
  return useQuery({
@@ -497,8 +519,10 @@ function getProductImageUrl(product) {
497
519
  }
498
520
  return product.image_url ?? null;
499
521
  }
500
- function ShareProductCard({ product }) {
501
- const { data: mediaCount = 0, isLoading: isLoadingMediaCount } = useProductMediaCount(product.id);
522
+ function ShareProductCard({ product, mediaCount: externalMediaCount }) {
523
+ const skipFetch = externalMediaCount !== void 0;
524
+ const { data: fetchedCount = 0, isLoading: isLoadingMediaCount } = useProductMediaCount(skipFetch ? 0 : product.id);
525
+ const resolvedCount = skipFetch ? externalMediaCount : fetchedCount;
502
526
  const imageUrl = getProductImageUrl(product);
503
527
  const isVideo = product.kind === "video" && !!product.video_url;
504
528
  return /* @__PURE__ */ jsx(ShareItemCard, {
@@ -506,8 +530,8 @@ function ShareProductCard({ product }) {
506
530
  imageUrl,
507
531
  href: `product/${product.id}`,
508
532
  badge: !isVideo ? {
509
- text: `${mediaCount} assets`,
510
- isLoading: isLoadingMediaCount
533
+ text: `${resolvedCount} assets`,
534
+ isLoading: !skipFetch && isLoadingMediaCount
511
535
  } : void 0,
512
536
  isVideo
513
537
  });
@@ -576,7 +600,8 @@ function ProductsScreen({ countryCode, onNavigate }) {
576
600
  observer.observe(target);
577
601
  return () => observer.disconnect();
578
602
  }, [handleIntersect]);
579
- const products = data?.pages.flat() ?? [];
603
+ const products = useMemo(() => data?.pages.flat() ?? [], [data]);
604
+ const { data: mediaCounts } = useProductMediaCounts(useMemo(() => products.map((p) => p.id), [products]));
580
605
  if (isLoading) return /* @__PURE__ */ jsxs("div", {
581
606
  className: "space-y-6 px-4 py-4 md:px-10 md:py-6",
582
607
  children: [/* @__PURE__ */ jsxs("div", {
@@ -630,12 +655,15 @@ function ProductsScreen({ countryCode, onNavigate }) {
630
655
  })
631
656
  }) : /* @__PURE__ */ jsx("div", {
632
657
  className: GRID_CLASS$3,
633
- children: products.map((product) => /* @__PURE__ */ jsx(ShareProductCard, { product: {
634
- id: product.id,
635
- title: product.title ?? "",
636
- image_url: product.image_url,
637
- images: product.images
638
- } }, product.id))
658
+ children: products.map((product) => /* @__PURE__ */ jsx(ShareProductCard, {
659
+ product: {
660
+ id: product.id,
661
+ title: product.title ?? "",
662
+ image_url: product.image_url,
663
+ images: product.images
664
+ },
665
+ mediaCount: mediaCounts?.[product.id]
666
+ }, product.id))
639
667
  }),
640
668
  isFetchingNextPage && /* @__PURE__ */ jsx("div", {
641
669
  className: "flex justify-center py-4",
@@ -8833,4 +8861,4 @@ function ProductsApp({ countryCode, companyLogoUrl, productId: controlledProduct
8833
8861
  //#endregion
8834
8862
  export { ShareablesApiProvider as a, ShareablesUIProvider as i, ShareablesApp as n, ShareablesCoreProvider as o, getFileMimeType as r, ProductsApp as t };
8835
8863
 
8836
- //# sourceMappingURL=src-BrwLqPPh.mjs.map
8864
+ //# sourceMappingURL=src-DjlwUaws.mjs.map