@fluid-app/portal-sdk 0.1.248 → 0.1.249

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 (235) hide show
  1. package/dist/{fluid-pay-api-adapter-CJ7-I8k-.mjs → AddressAutocompleteInput-B0qLrCHN.mjs} +153 -3
  2. package/dist/AddressAutocompleteInput-B0qLrCHN.mjs.map +1 -0
  3. package/dist/{fluid-pay-api-adapter-D63KLi5c.cjs → AddressAutocompleteInput-CbpNjpwB.cjs} +157 -1
  4. package/dist/AddressAutocompleteInput-CbpNjpwB.cjs.map +1 -0
  5. package/dist/{AlertWidget-CbhrQa9Z.mjs → AlertWidget-CcIBGBik.mjs} +3 -3
  6. package/dist/{AlertWidget-CbhrQa9Z.mjs.map → AlertWidget-CcIBGBik.mjs.map} +1 -1
  7. package/dist/{AppDownloadScreen-DPnbWP5G.mjs → AppDownloadScreen-ZxlnSAZ6.mjs} +3 -3
  8. package/dist/{AppDownloadScreen-DPnbWP5G.mjs.map → AppDownloadScreen-ZxlnSAZ6.mjs.map} +1 -1
  9. package/dist/{AppNavigationContext-DNod9mf6.mjs → AppNavigationContext-BcZZMtV6.mjs} +1 -1
  10. package/dist/{AppNavigationContext-DNod9mf6.mjs.map → AppNavigationContext-BcZZMtV6.mjs.map} +1 -1
  11. package/dist/{BulletListWidget-qvZIZ_B-.mjs → BulletListWidget-mRwUgtzN.mjs} +3 -3
  12. package/dist/{BulletListWidget-qvZIZ_B-.mjs.map → BulletListWidget-mRwUgtzN.mjs.map} +1 -1
  13. package/dist/{CalendarWidget-C03VcDLQ.mjs → CalendarWidget-Cn3Ngl8_.mjs} +5 -5
  14. package/dist/{CalendarWidget-C03VcDLQ.mjs.map → CalendarWidget-Cn3Ngl8_.mjs.map} +1 -1
  15. package/dist/{CardWidget-2wcjCf2M.mjs → CardWidget-DHTqvQPa.mjs} +4 -4
  16. package/dist/{CardWidget-2wcjCf2M.mjs.map → CardWidget-DHTqvQPa.mjs.map} +1 -1
  17. package/dist/{CarouselWidget-Cn5P4FVN.mjs → CarouselWidget-C0X-nFyW.mjs} +5 -5
  18. package/dist/{CarouselWidget-Cn5P4FVN.mjs.map → CarouselWidget-C0X-nFyW.mjs.map} +1 -1
  19. package/dist/{CatchUpWidget-B9CI7lq0.mjs → CatchUpWidget-BkeZR91e.mjs} +5 -5
  20. package/dist/{CatchUpWidget-B9CI7lq0.mjs.map → CatchUpWidget-BkeZR91e.mjs.map} +1 -1
  21. package/dist/{ChartWidget-obje-Xj9.mjs → ChartWidget-Ci4Q0Ig-.mjs} +4 -4
  22. package/dist/{ChartWidget-obje-Xj9.mjs.map → ChartWidget-Ci4Q0Ig-.mjs.map} +1 -1
  23. package/dist/{ContactsScreen-DuhDzRtI.mjs → ContactsScreen-Bq8zrA8k.mjs} +11 -11
  24. package/dist/{ContactsScreen-DuhDzRtI.mjs.map → ContactsScreen-Bq8zrA8k.mjs.map} +1 -1
  25. package/dist/{ContainerWidget-DNenbORS.mjs → ContainerWidget-cbX_KEOQ.mjs} +4 -4
  26. package/dist/{ContainerWidget-DNenbORS.mjs.map → ContainerWidget-cbX_KEOQ.mjs.map} +1 -1
  27. package/dist/{CustomersScreen-BJOBG5f5.mjs → CustomersScreen-0uI1R9lm.mjs} +2 -2
  28. package/dist/{CustomersScreen-BJOBG5f5.mjs.map → CustomersScreen-0uI1R9lm.mjs.map} +1 -1
  29. package/dist/{EmbedWidget-LYnd3TZD.mjs → EmbedWidget-BwR9mICd.mjs} +3 -3
  30. package/dist/{EmbedWidget-LYnd3TZD.mjs.map → EmbedWidget-BwR9mICd.mjs.map} +1 -1
  31. package/dist/FluidProvider-DGxCCmVB.cjs +17240 -0
  32. package/dist/FluidProvider-DGxCCmVB.cjs.map +1 -0
  33. package/dist/FluidProvider-DS1QKy5j.mjs +6371 -0
  34. package/dist/FluidProvider-DS1QKy5j.mjs.map +1 -0
  35. package/dist/{ImageWidget-vNWT_O1E.mjs → ImageWidget-DmaAQZBK.mjs} +4 -4
  36. package/dist/{ImageWidget-vNWT_O1E.mjs.map → ImageWidget-DmaAQZBK.mjs.map} +1 -1
  37. package/dist/{InfiniteScrollSentinel-D0XRJi51.mjs → InfiniteScrollSentinel-BHIgNtHI.mjs} +2 -2
  38. package/dist/{InfiniteScrollSentinel-D0XRJi51.mjs.map → InfiniteScrollSentinel-BHIgNtHI.mjs.map} +1 -1
  39. package/dist/{LayoutWidget-UI5fbsx4.mjs → LayoutWidget-CxaMx1nd.mjs} +4 -4
  40. package/dist/{LayoutWidget-UI5fbsx4.mjs.map → LayoutWidget-CxaMx1nd.mjs.map} +1 -1
  41. package/dist/{LinkWidget-CO-Cxf7Z.mjs → LinkWidget-utkZrvAV.mjs} +5 -5
  42. package/dist/{LinkWidget-CO-Cxf7Z.mjs.map → LinkWidget-utkZrvAV.mjs.map} +1 -1
  43. package/dist/{ListWidget-f88QhcGI.mjs → ListWidget-CNAxW_3c.mjs} +6 -6
  44. package/dist/{ListWidget-f88QhcGI.mjs.map → ListWidget-CNAxW_3c.mjs.map} +1 -1
  45. package/dist/{MediaRenderer-DMdb_5xw.mjs → MediaRenderer-13Jlf38P.mjs} +1 -1
  46. package/dist/{MediaRenderer-DMdb_5xw.mjs.map → MediaRenderer-13Jlf38P.mjs.map} +1 -1
  47. package/dist/{MessagingScreen-DGhqsVXi.mjs → MessagingScreen-CJ_9yIHK.mjs} +9 -12
  48. package/dist/{MessagingScreen-DGhqsVXi.mjs.map → MessagingScreen-CJ_9yIHK.mjs.map} +1 -1
  49. package/dist/{MessagingScreen-CDiLGmMi.cjs → MessagingScreen-DeYSVcMd.cjs} +2 -2
  50. package/dist/{MessagingScreen-CDiLGmMi.cjs.map → MessagingScreen-DeYSVcMd.cjs.map} +1 -1
  51. package/dist/{MessagingScreen-BKb4mWGa.cjs → MessagingScreen-FHwytr8B.cjs} +3 -3
  52. package/dist/MessagingScreen-s7CL9vPN.mjs +47 -0
  53. package/dist/{MySiteScreen-CK84vXa9.mjs → MySiteScreen-DX8tBz8Z.mjs} +7 -7
  54. package/dist/{MySiteScreen-CK84vXa9.mjs.map → MySiteScreen-DX8tBz8Z.mjs.map} +1 -1
  55. package/dist/{MySiteWidget-CQNASVaF.mjs → MySiteWidget-C0n9cSw7.mjs} +5 -5
  56. package/dist/{MySiteWidget-CQNASVaF.mjs.map → MySiteWidget-C0n9cSw7.mjs.map} +1 -1
  57. package/dist/{NestedWidget-RuyrOrFn.mjs → NestedWidget-BMKtDP_4.mjs} +6 -6
  58. package/dist/{NestedWidget-RuyrOrFn.mjs.map → NestedWidget-BMKtDP_4.mjs.map} +1 -1
  59. package/dist/{OrdersScreen-b-ZC4_NI.mjs → OrdersScreen-B3vtWt8_.mjs} +7 -7
  60. package/dist/{OrdersScreen-b-ZC4_NI.mjs.map → OrdersScreen-B3vtWt8_.mjs.map} +1 -1
  61. package/dist/{PointsWidget-BwA6aGVZ.mjs → PointsWidget-CaWklfIH.mjs} +5 -5
  62. package/dist/{PointsWidget-BwA6aGVZ.mjs.map → PointsWidget-CaWklfIH.mjs.map} +1 -1
  63. package/dist/{PortalProductsApiProvider-BFdHFvog.mjs → PortalProductsApiProvider-CNAu2pAb.mjs} +2 -2
  64. package/dist/{PortalProductsApiProvider-BFdHFvog.mjs.map → PortalProductsApiProvider-CNAu2pAb.mjs.map} +1 -1
  65. package/dist/{PortalTenantClientProvider-CjJzBCTL.mjs → PortalTenantClientProvider-Bni6J3KS.mjs} +1 -1
  66. package/dist/{PortalTenantClientProvider-CjJzBCTL.mjs.map → PortalTenantClientProvider-Bni6J3KS.mjs.map} +1 -1
  67. package/dist/{ProfileScreen-DHv2Cjpz.cjs → ProfileScreen-BJzW-gC_.cjs} +4 -4
  68. package/dist/{ProfileScreen-BDLJgcXg.cjs → ProfileScreen-DucZeLWI.cjs} +40 -20
  69. package/dist/ProfileScreen-DucZeLWI.cjs.map +1 -0
  70. package/dist/{ProfileScreen-CmQDKNaP.mjs → ProfileScreen-IPuXlf9V.mjs} +33 -18
  71. package/dist/ProfileScreen-IPuXlf9V.mjs.map +1 -0
  72. package/dist/ProfileScreen-m3fTsHyw.mjs +48 -0
  73. package/dist/{QuickLinksWidget-CJqwiBJ7.mjs → QuickLinksWidget-D0b33oyn.mjs} +3 -3
  74. package/dist/{QuickLinksWidget-CJqwiBJ7.mjs.map → QuickLinksWidget-D0b33oyn.mjs.map} +1 -1
  75. package/dist/{QuickShareWidget-DKE7Tba2.mjs → QuickShareWidget-DJ0Y71om.mjs} +3 -3
  76. package/dist/{QuickShareWidget-DKE7Tba2.mjs.map → QuickShareWidget-DJ0Y71om.mjs.map} +1 -1
  77. package/dist/{RecentActivityWidget-D1AlZgfV.mjs → RecentActivityWidget-Rpj33TiN.mjs} +5 -5
  78. package/dist/{RecentActivityWidget-D1AlZgfV.mjs.map → RecentActivityWidget-Rpj33TiN.mjs.map} +1 -1
  79. package/dist/{ScreenHeaderContext-Cemdo7bM.mjs → ScreenHeaderContext-4WYXIqQ5.mjs} +1 -1
  80. package/dist/{ScreenHeaderContext-Cemdo7bM.mjs.map → ScreenHeaderContext-4WYXIqQ5.mjs.map} +1 -1
  81. package/dist/{ScreenRenderer-Cl2aAJ7D.mjs → ScreenRenderer-BQal-fnZ.mjs} +2 -2
  82. package/dist/{ScreenRenderer-Cl2aAJ7D.mjs.map → ScreenRenderer-BQal-fnZ.mjs.map} +1 -1
  83. package/dist/{SearchSort-CokMCrhy.mjs → SearchSort-B5Jrk5lW.mjs} +2 -2
  84. package/dist/{SearchSort-CokMCrhy.mjs.map → SearchSort-B5Jrk5lW.mjs.map} +1 -1
  85. package/dist/{SeparatorWidget-gVlyr1MV.mjs → SeparatorWidget-Bgzsloji.mjs} +3 -3
  86. package/dist/{SeparatorWidget-gVlyr1MV.mjs.map → SeparatorWidget-Bgzsloji.mjs.map} +1 -1
  87. package/dist/ShareablesScreen-Cd8chxk4.mjs +13 -0
  88. package/dist/{ShareablesScreen-BZZ-RT71.mjs → ShareablesScreen-NMoZH9ed.mjs} +14 -18
  89. package/dist/{ShareablesScreen-BZZ-RT71.mjs.map → ShareablesScreen-NMoZH9ed.mjs.map} +1 -1
  90. package/dist/ShopScreen-BvSiWgsJ.mjs +47 -0
  91. package/dist/{ShopScreen---dB03HI.cjs → ShopScreen-CM3DDvLt.cjs} +2 -2
  92. package/dist/{ShopScreen---dB03HI.cjs.map → ShopScreen-CM3DDvLt.cjs.map} +1 -1
  93. package/dist/{ShopScreen-B6ygTHDB.cjs → ShopScreen-Cz0dbkhp.cjs} +3 -3
  94. package/dist/{ShopScreen-kiVwC38W.mjs → ShopScreen-DJANOOka.mjs} +29 -34
  95. package/dist/{ShopScreen-kiVwC38W.mjs.map → ShopScreen-DJANOOka.mjs.map} +1 -1
  96. package/dist/{SpacerWidget-BY7ywGP4.mjs → SpacerWidget-C1byII28.mjs} +2 -2
  97. package/dist/{SpacerWidget-BY7ywGP4.mjs.map → SpacerWidget-C1byII28.mjs.map} +1 -1
  98. package/dist/{SubscriptionsScreen-dhnfYn4L.cjs → SubscriptionsScreen-BgKpfzi0.cjs} +3 -3
  99. package/dist/{SubscriptionsScreen-B88_dLfE.cjs → SubscriptionsScreen-DCUwHrdm.cjs} +22 -32
  100. package/dist/SubscriptionsScreen-DCUwHrdm.cjs.map +1 -0
  101. package/dist/{SubscriptionsScreen-DK9-h3Cz.mjs → SubscriptionsScreen-rZxqb0eR.mjs} +21 -31
  102. package/dist/{SubscriptionsScreen-DK9-h3Cz.mjs.map → SubscriptionsScreen-rZxqb0eR.mjs.map} +1 -1
  103. package/dist/{TableWidget-dfUvhH0S.mjs → TableWidget-CNCHDRrR.mjs} +6 -6
  104. package/dist/{TableWidget-dfUvhH0S.mjs.map → TableWidget-CNCHDRrR.mjs.map} +1 -1
  105. package/dist/{TextWidget-BteaMIsX.mjs → TextWidget-CfLUQr6V.mjs} +3 -3
  106. package/dist/{TextWidget-BteaMIsX.mjs.map → TextWidget-CfLUQr6V.mjs.map} +1 -1
  107. package/dist/{ToDoWidget-BciI_D70.mjs → ToDoWidget-C3lh-3SB.mjs} +7 -7
  108. package/dist/{ToDoWidget-BciI_D70.mjs.map → ToDoWidget-C3lh-3SB.mjs.map} +1 -1
  109. package/dist/{UpgradeScreen-X6j0_625.mjs → UpgradeScreen-D_CM1n1M.mjs} +3 -3
  110. package/dist/{UpgradeScreen-X6j0_625.mjs.map → UpgradeScreen-D_CM1n1M.mjs.map} +1 -1
  111. package/dist/{VideoWidget-Dj9wue7j.mjs → VideoWidget-DKhqN_Rx.mjs} +4 -4
  112. package/dist/{VideoWidget-Dj9wue7j.mjs.map → VideoWidget-DKhqN_Rx.mjs.map} +1 -1
  113. package/dist/{WidgetInteractionContext-B1mELhQ_.mjs → WidgetInteractionContext-pLGNr8_2.mjs} +1 -1
  114. package/dist/{WidgetInteractionContext-B1mELhQ_.mjs.map → WidgetInteractionContext-pLGNr8_2.mjs.map} +1 -1
  115. package/dist/api-context-3GmfqvIB.mjs +22 -0
  116. package/dist/api-context-3GmfqvIB.mjs.map +1 -0
  117. package/dist/api-context-BkBvyFVK.cjs +46 -0
  118. package/dist/api-context-BkBvyFVK.cjs.map +1 -0
  119. package/dist/{components-CjgEvBYG.mjs → components-D2h9u3tH.mjs} +3 -3
  120. package/dist/{components-CjgEvBYG.mjs.map → components-D2h9u3tH.mjs.map} +1 -1
  121. package/dist/{de-DWONEOZS.mjs → de-CH__cDep.mjs} +1 -1
  122. package/dist/de-CH__cDep.mjs.map +1 -0
  123. package/dist/{dist-CTLDCXCc.mjs → dist-Di1hciu4.mjs} +1 -1
  124. package/dist/{dist-CTLDCXCc.mjs.map → dist-Di1hciu4.mjs.map} +1 -1
  125. package/dist/{el-De7Ne7it.mjs → el-De9QZiqh.mjs} +1 -1
  126. package/dist/el-De9QZiqh.mjs.map +1 -0
  127. package/dist/{error-state-DYzHx8tt.mjs → error-state--Z2OlDFr.mjs} +1 -1
  128. package/dist/{error-state-DYzHx8tt.mjs.map → error-state--Z2OlDFr.mjs.map} +1 -1
  129. package/dist/{es-BXxGlAp6.mjs → es-C5dhBJ9E.mjs} +4 -39
  130. package/dist/{es-BXxGlAp6.mjs.map → es-C5dhBJ9E.mjs.map} +1 -1
  131. package/dist/{es-B5_ItPIn.mjs → es-CZLh7tET.mjs} +1 -1
  132. package/dist/es-CZLh7tET.mjs.map +1 -0
  133. package/dist/{fr-jgEDP2og.mjs → fr-CIfM_0kG.mjs} +1 -1
  134. package/dist/fr-CIfM_0kG.mjs.map +1 -0
  135. package/dist/{he-DLQdVr_g.mjs → he-BTK1iEJE.mjs} +1 -1
  136. package/dist/he-BTK1iEJE.mjs.map +1 -0
  137. package/dist/{hu-CC4QdkPb.mjs → hu-CrZGIbz9.mjs} +1 -1
  138. package/dist/hu-CrZGIbz9.mjs.map +1 -0
  139. package/dist/{id-CwGC2v1d.mjs → id-B-LeCfHj.mjs} +1 -1
  140. package/dist/id-B-LeCfHj.mjs.map +1 -0
  141. package/dist/index.cjs +16 -15
  142. package/dist/index.cjs.map +1 -1
  143. package/dist/index.d.cts +7 -0
  144. package/dist/index.d.cts.map +1 -1
  145. package/dist/index.d.mts +7 -0
  146. package/dist/index.d.mts.map +1 -1
  147. package/dist/index.mjs +86 -85
  148. package/dist/index.mjs.map +1 -1
  149. package/dist/{it-jUZZ5sjO.mjs → it-rIkFmAF3.mjs} +1 -1
  150. package/dist/it-rIkFmAF3.mjs.map +1 -0
  151. package/dist/{ja-QVQymwAE.mjs → ja--J_bhk3I.mjs} +1 -1
  152. package/dist/ja--J_bhk3I.mjs.map +1 -0
  153. package/dist/{ko-DfzzTwZI.mjs → ko-B2fghWQ9.mjs} +1 -1
  154. package/dist/ko-B2fghWQ9.mjs.map +1 -0
  155. package/dist/{nl-Dys3mUo2.mjs → nl-KgHmrRKy.mjs} +1 -1
  156. package/dist/nl-KgHmrRKy.mjs.map +1 -0
  157. package/dist/{order-status-badge-xuJ732eH.mjs → order-status-badge-CjX7Qxdk.mjs} +4 -4
  158. package/dist/{order-status-badge-xuJ732eH.mjs.map → order-status-badge-CjX7Qxdk.mjs.map} +1 -1
  159. package/dist/{parse-task-body-DEmYvdNM.mjs → parse-task-body-BK1v2806.mjs} +1 -1
  160. package/dist/{parse-task-body-DEmYvdNM.mjs.map → parse-task-body-BK1v2806.mjs.map} +1 -1
  161. package/dist/{pl-CBwEisEK.mjs → pl-BJvDPvs3.mjs} +1 -1
  162. package/dist/pl-BJvDPvs3.mjs.map +1 -0
  163. package/dist/{portal_tenant_content-CQQfNOTc.mjs → portal_tenant_content-DPLnrtOG.mjs} +38 -2
  164. package/dist/{portal_tenant_content-CQQfNOTc.mjs.map → portal_tenant_content-DPLnrtOG.mjs.map} +1 -1
  165. package/dist/{pt-D5al7xw3.mjs → pt-CmZpxftX.mjs} +1 -1
  166. package/dist/pt-CmZpxftX.mjs.map +1 -0
  167. package/dist/{purify.es-DzInNL5X.mjs → purify.es-Ba5Ug4-y.mjs} +1 -1
  168. package/dist/{purify.es-DzInNL5X.mjs.map → purify.es-Ba5Ug4-y.mjs.map} +1 -1
  169. package/dist/{query-keys-8SVs82aF.mjs → query-keys-DXle2tm8.mjs} +1 -1
  170. package/dist/{query-keys-8SVs82aF.mjs.map → query-keys-DXle2tm8.mjs.map} +1 -1
  171. package/dist/{registries-Ct8o2YRe.mjs → registries-kvRRUHcO.mjs} +1 -1
  172. package/dist/{registries-Ct8o2YRe.mjs.map → registries-kvRRUHcO.mjs.map} +1 -1
  173. package/dist/{registry-context-CTHUCfEc.mjs → registry-context-Bc-2fQnr.mjs} +1 -1
  174. package/dist/{registry-context-CTHUCfEc.mjs.map → registry-context-Bc-2fQnr.mjs.map} +1 -1
  175. package/dist/{ro-B43SoGdE.mjs → ro-C_4rHVWp.mjs} +1 -1
  176. package/dist/ro-C_4rHVWp.mjs.map +1 -0
  177. package/dist/{ru-ChwnncDc.mjs → ru-B0lzoBye.mjs} +1 -1
  178. package/dist/ru-B0lzoBye.mjs.map +1 -0
  179. package/dist/{scroll-arrows-CqDxJ0Pe.mjs → scroll-arrows-D90Miaz_.mjs} +1 -1
  180. package/dist/{scroll-arrows-CqDxJ0Pe.mjs.map → scroll-arrows-D90Miaz_.mjs.map} +1 -1
  181. package/dist/{sortable.esm-C8riJ_zv.mjs → sortable.esm-NmKxJoc7.mjs} +1 -1
  182. package/dist/{sortable.esm-C8riJ_zv.mjs.map → sortable.esm-NmKxJoc7.mjs.map} +1 -1
  183. package/dist/{src-C9vtVoJs.mjs → src-CSFJnkfN.mjs} +1 -1
  184. package/dist/{src-C9vtVoJs.mjs.map → src-CSFJnkfN.mjs.map} +1 -1
  185. package/dist/{src-pgBBOcJa.mjs → src-KINQ78Nj.mjs} +1 -1
  186. package/dist/{src-pgBBOcJa.mjs.map → src-KINQ78Nj.mjs.map} +1 -1
  187. package/dist/{th-C9S_8Tv6.mjs → th-QhoPGZ6C.mjs} +1 -1
  188. package/dist/th-QhoPGZ6C.mjs.map +1 -0
  189. package/dist/{tl-CiPbx_5F.mjs → tl-Dsfp243U.mjs} +1 -1
  190. package/dist/tl-Dsfp243U.mjs.map +1 -0
  191. package/dist/{tr-CUd4dp2u.mjs → tr-BiolaqkO.mjs} +1 -1
  192. package/dist/tr-BiolaqkO.mjs.map +1 -0
  193. package/dist/{use-account-DsTz5BlS.mjs → use-account-CGaDP8xd.mjs} +2 -2
  194. package/dist/{use-account-DsTz5BlS.mjs.map → use-account-CGaDP8xd.mjs.map} +1 -1
  195. package/dist/{use-store-C2KBIS41.mjs → use-store-BVCCB9kx.mjs} +1 -1
  196. package/dist/{use-store-C2KBIS41.mjs.map → use-store-BVCCB9kx.mjs.map} +1 -1
  197. package/dist/{zh_CN-D46-GUTP.mjs → zh_CN-DcGf3QsR.mjs} +1 -1
  198. package/dist/zh_CN-DcGf3QsR.mjs.map +1 -0
  199. package/dist/{zh_TW-XqA7UKxt.mjs → zh_TW-DFw2O0OX.mjs} +1 -1
  200. package/dist/zh_TW-DFw2O0OX.mjs.map +1 -0
  201. package/package.json +14 -13
  202. package/dist/FluidProvider-Bwg1cGSY.mjs +0 -2409
  203. package/dist/FluidProvider-Bwg1cGSY.mjs.map +0 -1
  204. package/dist/FluidProvider-DprqXNu4.cjs +0 -2520
  205. package/dist/FluidProvider-DprqXNu4.cjs.map +0 -1
  206. package/dist/ProfileScreen-BDLJgcXg.cjs.map +0 -1
  207. package/dist/ProfileScreen-CmQDKNaP.mjs.map +0 -1
  208. package/dist/SubscriptionsScreen-B88_dLfE.cjs.map +0 -1
  209. package/dist/de-DWONEOZS.mjs.map +0 -1
  210. package/dist/el-De7Ne7it.mjs.map +0 -1
  211. package/dist/es-B5_ItPIn.mjs.map +0 -1
  212. package/dist/fluid-pay-api-adapter-CJ7-I8k-.mjs.map +0 -1
  213. package/dist/fluid-pay-api-adapter-D63KLi5c.cjs.map +0 -1
  214. package/dist/fr-jgEDP2og.mjs.map +0 -1
  215. package/dist/he-DLQdVr_g.mjs.map +0 -1
  216. package/dist/hu-CC4QdkPb.mjs.map +0 -1
  217. package/dist/id-CwGC2v1d.mjs.map +0 -1
  218. package/dist/it-jUZZ5sjO.mjs.map +0 -1
  219. package/dist/ja-QVQymwAE.mjs.map +0 -1
  220. package/dist/ko-DfzzTwZI.mjs.map +0 -1
  221. package/dist/nl-Dys3mUo2.mjs.map +0 -1
  222. package/dist/pay-api-context-CqKGSXnP.mjs +0 -13
  223. package/dist/pay-api-context-CqKGSXnP.mjs.map +0 -1
  224. package/dist/pay-api-context-_o5ZEXYt.cjs +0 -25
  225. package/dist/pay-api-context-_o5ZEXYt.cjs.map +0 -1
  226. package/dist/pl-CBwEisEK.mjs.map +0 -1
  227. package/dist/pt-D5al7xw3.mjs.map +0 -1
  228. package/dist/ro-B43SoGdE.mjs.map +0 -1
  229. package/dist/ru-ChwnncDc.mjs.map +0 -1
  230. package/dist/th-C9S_8Tv6.mjs.map +0 -1
  231. package/dist/tl-CiPbx_5F.mjs.map +0 -1
  232. package/dist/tr-CUd4dp2u.mjs.map +0 -1
  233. package/dist/zh_CN-D46-GUTP.mjs.map +0 -1
  234. package/dist/zh_TW-XqA7UKxt.mjs.map +0 -1
  235. /package/dist/{fields-B_iAnFXl.mjs → fields-FTgjMOdh.mjs} +0 -0
@@ -1,2520 +0,0 @@
1
- require("./chunk-9hOWP6kD.cjs");
2
- const require_ScreenRenderer = require("./ScreenRenderer-xH01YkEQ.cjs");
3
- const require_account_api_context = require("./account-api-context-DZP9IiGg.cjs");
4
- const require_store_api_context = require("./store-api-context-D1gZn22Z.cjs");
5
- const require_pay_api_context = require("./pay-api-context-_o5ZEXYt.cjs");
6
- const require_mysite_api_context = require("./mysite-api-context-Dz4lI5Xd.cjs");
7
- const require_countries_api_context = require("./countries-api-context-C0C0K9gJ.cjs");
8
- const require_portal_tenant = require("./portal_tenant-CNmiAf_A.cjs");
9
- const require_portal_tenant_content = require("./portal_tenant_content-CswGtBvh.cjs");
10
- const require_src = require("./src-DiFCBegK.cjs");
11
- const require_PortalTenantClientProvider = require("./PortalTenantClientProvider-BT5Y4YyL.cjs");
12
- const require_registry_context = require("./registry-context-CcZYS15Q.cjs");
13
- const require_EmbedWidget = require("./EmbedWidget-DgbCzBA4.cjs");
14
- const require_error_state = require("./error-state-BDhSltIa.cjs");
15
- const require_LayoutWidget = require("./LayoutWidget-Bt2I2XMy.cjs");
16
- const require_TextWidget = require("./TextWidget-C7oY0X3r.cjs");
17
- const require_AlertWidget = require("./AlertWidget-BZ67Uqfh.cjs");
18
- const require_BulletListWidget = require("./BulletListWidget-iGJI33Ed.cjs");
19
- const require_CalendarWidget = require("./CalendarWidget-C4Dv_TUk.cjs");
20
- const require_CardWidget = require("./CardWidget-D-KEikO_.cjs");
21
- const require_CarouselWidget = require("./CarouselWidget-Cu1b3ERq.cjs");
22
- const require_CatchUpWidget = require("./CatchUpWidget-BzgybvuC.cjs");
23
- const require_ChartWidget = require("./ChartWidget-CFB4Yg0k.cjs");
24
- const require_ContainerWidget = require("./ContainerWidget-DbAhQKbY.cjs");
25
- const require_ImageWidget = require("./ImageWidget-CbQVxMe3.cjs");
26
- const require_LinkWidget = require("./LinkWidget-BoR7nVbH.cjs");
27
- const require_ListWidget = require("./ListWidget-CzljZ1LA.cjs");
28
- const require_MySiteWidget = require("./MySiteWidget-CYiH2lmX.cjs");
29
- const require_NestedWidget = require("./NestedWidget-CEoAO2sp.cjs");
30
- const require_PointsWidget = require("./PointsWidget-D1FV8l1h.cjs");
31
- const require_QuickLinksWidget = require("./QuickLinksWidget-DBH-HRvz.cjs");
32
- const require_QuickShareWidget = require("./QuickShareWidget-Btoe8CyN.cjs");
33
- const require_RecentActivityWidget = require("./RecentActivityWidget-DNyhUZNs.cjs");
34
- const require_SeparatorWidget = require("./SeparatorWidget-BCbzDxnz.cjs");
35
- const require_SpacerWidget = require("./SpacerWidget-CI3to-88.cjs");
36
- const require_TableWidget = require("./TableWidget-BIn1oRiJ.cjs");
37
- const require_ToDoWidget = require("./ToDoWidget-OxT9z59F.cjs");
38
- const require_VideoWidget = require("./VideoWidget-CDcV0J5W.cjs");
39
- let react = require("react");
40
- let _tanstack_react_query = require("@tanstack/react-query");
41
- let react_jsx_runtime = require("react/jsx-runtime");
42
- //#region ../../../node_modules/.pnpm/@tanstack+query-core@5.90.12/node_modules/@tanstack/query-core/build/modern/timeoutManager.js
43
- var defaultTimeoutProvider = {
44
- setTimeout: (callback, delay) => setTimeout(callback, delay),
45
- clearTimeout: (timeoutId) => clearTimeout(timeoutId),
46
- setInterval: (callback, delay) => setInterval(callback, delay),
47
- clearInterval: (intervalId) => clearInterval(intervalId)
48
- };
49
- var TimeoutManager = class {
50
- #provider = defaultTimeoutProvider;
51
- #providerCalled = false;
52
- setTimeoutProvider(provider) {
53
- if (process.env.NODE_ENV !== "production") {
54
- if (this.#providerCalled && provider !== this.#provider) console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`, {
55
- previous: this.#provider,
56
- provider
57
- });
58
- }
59
- this.#provider = provider;
60
- if (process.env.NODE_ENV !== "production") this.#providerCalled = false;
61
- }
62
- setTimeout(callback, delay) {
63
- if (process.env.NODE_ENV !== "production") this.#providerCalled = true;
64
- return this.#provider.setTimeout(callback, delay);
65
- }
66
- clearTimeout(timeoutId) {
67
- this.#provider.clearTimeout(timeoutId);
68
- }
69
- setInterval(callback, delay) {
70
- if (process.env.NODE_ENV !== "production") this.#providerCalled = true;
71
- return this.#provider.setInterval(callback, delay);
72
- }
73
- clearInterval(intervalId) {
74
- this.#provider.clearInterval(intervalId);
75
- }
76
- };
77
- new TimeoutManager();
78
- function systemSetTimeoutZero(callback) {
79
- setTimeout(callback, 0);
80
- }
81
- typeof window === "undefined" || "Deno" in globalThis;
82
- function matchQuery(filters, query) {
83
- const { type = "all", exact, fetchStatus, predicate, queryKey, stale } = filters;
84
- if (queryKey) {
85
- if (exact) {
86
- if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) return false;
87
- } else if (!partialMatchKey(query.queryKey, queryKey)) return false;
88
- }
89
- if (type !== "all") {
90
- const isActive = query.isActive();
91
- if (type === "active" && !isActive) return false;
92
- if (type === "inactive" && isActive) return false;
93
- }
94
- if (typeof stale === "boolean" && query.isStale() !== stale) return false;
95
- if (fetchStatus && fetchStatus !== query.state.fetchStatus) return false;
96
- if (predicate && !predicate(query)) return false;
97
- return true;
98
- }
99
- function hashQueryKeyByOptions(queryKey, options) {
100
- return (options?.queryKeyHashFn || hashKey)(queryKey);
101
- }
102
- function hashKey(queryKey) {
103
- return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
104
- result[key] = val[key];
105
- return result;
106
- }, {}) : val);
107
- }
108
- function partialMatchKey(a, b) {
109
- if (a === b) return true;
110
- if (typeof a !== typeof b) return false;
111
- if (a && b && typeof a === "object" && typeof b === "object") return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
112
- return false;
113
- }
114
- function isPlainObject(o) {
115
- if (!hasObjectPrototype(o)) return false;
116
- const ctor = o.constructor;
117
- if (ctor === void 0) return true;
118
- const prot = ctor.prototype;
119
- if (!hasObjectPrototype(prot)) return false;
120
- if (!prot.hasOwnProperty("isPrototypeOf")) return false;
121
- if (Object.getPrototypeOf(o) !== Object.prototype) return false;
122
- return true;
123
- }
124
- function hasObjectPrototype(o) {
125
- return Object.prototype.toString.call(o) === "[object Object]";
126
- }
127
- //#endregion
128
- //#region ../../../node_modules/.pnpm/@tanstack+query-core@5.90.12/node_modules/@tanstack/query-core/build/modern/notifyManager.js
129
- var defaultScheduler = systemSetTimeoutZero;
130
- function createNotifyManager() {
131
- let queue = [];
132
- let transactions = 0;
133
- let notifyFn = (callback) => {
134
- callback();
135
- };
136
- let batchNotifyFn = (callback) => {
137
- callback();
138
- };
139
- let scheduleFn = defaultScheduler;
140
- const schedule = (callback) => {
141
- if (transactions) queue.push(callback);
142
- else scheduleFn(() => {
143
- notifyFn(callback);
144
- });
145
- };
146
- const flush = () => {
147
- const originalQueue = queue;
148
- queue = [];
149
- if (originalQueue.length) scheduleFn(() => {
150
- batchNotifyFn(() => {
151
- originalQueue.forEach((callback) => {
152
- notifyFn(callback);
153
- });
154
- });
155
- });
156
- };
157
- return {
158
- batch: (callback) => {
159
- let result;
160
- transactions++;
161
- try {
162
- result = callback();
163
- } finally {
164
- transactions--;
165
- if (!transactions) flush();
166
- }
167
- return result;
168
- },
169
- batchCalls: (callback) => {
170
- return (...args) => {
171
- schedule(() => {
172
- callback(...args);
173
- });
174
- };
175
- },
176
- schedule,
177
- setNotifyFunction: (fn) => {
178
- notifyFn = fn;
179
- },
180
- setBatchNotifyFunction: (fn) => {
181
- batchNotifyFn = fn;
182
- },
183
- setScheduler: (fn) => {
184
- scheduleFn = fn;
185
- }
186
- };
187
- }
188
- var notifyManager = createNotifyManager();
189
- //#endregion
190
- //#region ../../../node_modules/.pnpm/@tanstack+query-persist-client-core@5.91.11/node_modules/@tanstack/query-persist-client-core/build/modern/createPersister.js
191
- var PERSISTER_KEY_PREFIX = "tanstack-query";
192
- function experimental_createQueryPersister({ storage, buster = "", maxAge = 1e3 * 60 * 60 * 24, serialize = JSON.stringify, deserialize = JSON.parse, prefix = PERSISTER_KEY_PREFIX, refetchOnRestore = true, filters }) {
193
- function isExpiredOrBusted(persistedQuery) {
194
- if (persistedQuery.state.dataUpdatedAt) {
195
- const expired = Date.now() - persistedQuery.state.dataUpdatedAt > maxAge;
196
- const busted = persistedQuery.buster !== buster;
197
- if (expired || busted) return true;
198
- return false;
199
- }
200
- return true;
201
- }
202
- async function retrieveQuery(queryHash, afterRestoreMacroTask) {
203
- if (storage != null) {
204
- const storageKey = `${prefix}-${queryHash}`;
205
- try {
206
- const storedData = await storage.getItem(storageKey);
207
- if (storedData) {
208
- const persistedQuery = await deserialize(storedData);
209
- if (isExpiredOrBusted(persistedQuery)) await storage.removeItem(storageKey);
210
- else {
211
- if (afterRestoreMacroTask) notifyManager.schedule(() => afterRestoreMacroTask(persistedQuery));
212
- return persistedQuery.state.data;
213
- }
214
- }
215
- } catch (err) {
216
- if (process.env.NODE_ENV === "development") {
217
- console.error(err);
218
- console.warn("Encountered an error attempting to restore query cache from persisted location.");
219
- }
220
- await storage.removeItem(storageKey);
221
- }
222
- }
223
- }
224
- async function persistQueryByKey(queryKey, queryClient) {
225
- if (storage != null) {
226
- const query = queryClient.getQueryCache().find({ queryKey });
227
- if (query) await persistQuery(query);
228
- else if (process.env.NODE_ENV === "development") console.warn("Could not find query to be persisted. QueryKey:", JSON.stringify(queryKey));
229
- }
230
- }
231
- async function persistQuery(query) {
232
- if (storage != null) {
233
- const storageKey = `${prefix}-${query.queryHash}`;
234
- storage.setItem(storageKey, await serialize({
235
- state: query.state,
236
- queryKey: query.queryKey,
237
- queryHash: query.queryHash,
238
- buster
239
- }));
240
- }
241
- }
242
- async function persisterFn(queryFn, ctx, query) {
243
- const matchesFilter = filters ? matchQuery(filters, query) : true;
244
- if (matchesFilter && query.state.data === void 0 && storage != null) {
245
- const restoredData = await retrieveQuery(query.queryHash, (persistedQuery) => {
246
- query.setState({
247
- dataUpdatedAt: persistedQuery.state.dataUpdatedAt,
248
- errorUpdatedAt: persistedQuery.state.errorUpdatedAt
249
- });
250
- if (refetchOnRestore === "always" || refetchOnRestore === true && query.isStale()) query.fetch();
251
- });
252
- if (restoredData !== void 0) return Promise.resolve(restoredData);
253
- }
254
- const queryFnResult = await queryFn(ctx);
255
- if (matchesFilter && storage != null) notifyManager.schedule(() => {
256
- persistQuery(query);
257
- });
258
- return Promise.resolve(queryFnResult);
259
- }
260
- async function persisterGc() {
261
- if (storage?.entries) {
262
- const entries = await storage.entries();
263
- for (const [key, value] of entries) if (key.startsWith(prefix)) {
264
- if (isExpiredOrBusted(await deserialize(value))) await storage.removeItem(key);
265
- }
266
- } else if (process.env.NODE_ENV === "development") throw new Error("Provided storage does not implement `entries` method. Garbage collection is not possible without ability to iterate over storage items.");
267
- }
268
- async function restoreQueries(queryClient, filters2 = {}) {
269
- const { exact, queryKey } = filters2;
270
- if (storage?.entries) {
271
- const entries = await storage.entries();
272
- for (const [key, value] of entries) if (key.startsWith(prefix)) {
273
- const persistedQuery = await deserialize(value);
274
- if (isExpiredOrBusted(persistedQuery)) {
275
- await storage.removeItem(key);
276
- continue;
277
- }
278
- if (queryKey) {
279
- if (exact) {
280
- if (persistedQuery.queryHash !== hashKey(queryKey)) continue;
281
- } else if (!partialMatchKey(persistedQuery.queryKey, queryKey)) continue;
282
- }
283
- queryClient.setQueryData(persistedQuery.queryKey, persistedQuery.state.data, { updatedAt: persistedQuery.state.dataUpdatedAt });
284
- }
285
- } else if (process.env.NODE_ENV === "development") throw new Error("Provided storage does not implement `entries` method. Restoration of all stored entries is not possible without ability to iterate over storage items.");
286
- }
287
- return {
288
- persisterFn,
289
- persistQuery,
290
- persistQueryByKey,
291
- retrieveQuery,
292
- persisterGc,
293
- restoreQueries
294
- };
295
- }
296
- //#endregion
297
- //#region ../../platform/query-persister/src/persister.ts
298
- const DB_NAME = "fluid_tanstack_query_cache";
299
- const STORE_NAME = "fluid_queries";
300
- const VERSION = 1;
301
- let dbPromise = null;
302
- async function deleteDatabase(reason = "error") {
303
- return new Promise((resolve, reject) => {
304
- console.warn(`[IDB] Deleting database due to ${reason}`);
305
- const req = indexedDB.deleteDatabase(DB_NAME);
306
- req.onsuccess = () => {
307
- console.log("[IDB] Database deleted successfully");
308
- dbPromise = null;
309
- resolve();
310
- };
311
- req.onerror = () => {
312
- console.error("[IDB] Failed to delete database:", req.error);
313
- reject(req.error ?? /* @__PURE__ */ new Error("deleteDatabase failed"));
314
- };
315
- req.onblocked = () => {
316
- console.warn("[IDB] Delete blocked: close all tabs using this database");
317
- dbPromise = null;
318
- resolve();
319
- };
320
- });
321
- }
322
- function openDatabase() {
323
- return new Promise((resolve, reject) => {
324
- const req = indexedDB.open(DB_NAME, VERSION);
325
- req.onupgradeneeded = () => {
326
- const upgradeDb = req.result;
327
- if (!upgradeDb.objectStoreNames.contains(STORE_NAME)) upgradeDb.createObjectStore(STORE_NAME);
328
- };
329
- req.onsuccess = () => {
330
- const conn = req.result;
331
- conn.onversionchange = () => {
332
- console.trace("[IDB] version change – closing connection");
333
- conn.close();
334
- dbPromise = null;
335
- };
336
- resolve(conn);
337
- };
338
- req.onblocked = () => {
339
- console.warn("[IDB] open blocked: another connection is holding the DB");
340
- };
341
- req.onerror = () => {
342
- reject(req.error instanceof Error ? req.error : /* @__PURE__ */ new Error(`IndexedDB open failed: ${String(req.error)}`));
343
- };
344
- });
345
- }
346
- async function getDbWithRecovery() {
347
- try {
348
- return await openDatabase();
349
- } catch (err) {
350
- console.warn("[IDB] Initial open failed, attempting recovery:", err);
351
- try {
352
- await deleteDatabase();
353
- console.log("[IDB] Retrying database open after deletion");
354
- return await openDatabase();
355
- } catch (retryErr) {
356
- console.error("[IDB] Recovery failed:", retryErr);
357
- throw retryErr;
358
- }
359
- }
360
- }
361
- function getDb() {
362
- if (dbPromise) return dbPromise;
363
- dbPromise = getDbWithRecovery().catch((err) => {
364
- dbPromise = null;
365
- throw err;
366
- });
367
- return dbPromise;
368
- }
369
- const storage = {
370
- async getItem(key) {
371
- try {
372
- const db = await getDb();
373
- return new Promise((res) => {
374
- try {
375
- const r = db.transaction(STORE_NAME, "readonly").objectStore(STORE_NAME).get(key);
376
- r.onsuccess = () => res(r.result);
377
- r.onerror = () => {
378
- console.trace("[IDB] getItem error:", r.error);
379
- res(void 0);
380
- };
381
- } catch (txErr) {
382
- console.trace("[IDB] getItem transaction error:", txErr);
383
- res(void 0);
384
- }
385
- });
386
- } catch (err) {
387
- console.trace("[IDB] getItem getDb error:", err);
388
- try {
389
- const db = await getDb();
390
- return new Promise((res) => {
391
- try {
392
- const r = db.transaction(STORE_NAME, "readonly").objectStore(STORE_NAME).get(key);
393
- r.onsuccess = () => res(r.result);
394
- r.onerror = () => {
395
- console.trace("[IDB] getItem retry error:", r.error);
396
- res(void 0);
397
- };
398
- } catch (txErr) {
399
- console.trace("[IDB] getItem retry transaction error:", txErr);
400
- res(void 0);
401
- }
402
- });
403
- } catch (recoveryErr) {
404
- console.trace("[IDB] getItem recovery failed:", recoveryErr);
405
- }
406
- return;
407
- }
408
- },
409
- async setItem(key, value) {
410
- const cloneableValue = JSON.parse(JSON.stringify(value));
411
- try {
412
- const db = await getDb();
413
- if (!db) return;
414
- await new Promise((resolve) => {
415
- try {
416
- const req = db.transaction(STORE_NAME, "readwrite").objectStore(STORE_NAME).put(cloneableValue, key);
417
- req.onsuccess = () => resolve();
418
- req.onerror = () => {
419
- console.trace("[IDB] setItem error:", req.error);
420
- resolve();
421
- };
422
- } catch (txErr) {
423
- console.trace("[IDB] setItem transaction error:", txErr);
424
- resolve();
425
- }
426
- });
427
- } catch (err) {
428
- console.trace("[IDB] setItem getDb error:", err);
429
- try {
430
- const db = await getDb();
431
- await new Promise((resolve) => {
432
- try {
433
- const req = db.transaction(STORE_NAME, "readwrite").objectStore(STORE_NAME).put(cloneableValue, key);
434
- req.onsuccess = () => resolve();
435
- req.onerror = () => {
436
- console.trace("[IDB] setItem retry error:", req.error);
437
- resolve();
438
- };
439
- } catch (txErr) {
440
- console.trace("[IDB] setItem retry transaction error:", txErr);
441
- resolve();
442
- }
443
- });
444
- } catch (recoveryErr) {
445
- console.trace("[IDB] setItem recovery failed:", recoveryErr);
446
- }
447
- }
448
- },
449
- async removeItem(key) {
450
- try {
451
- const db = await getDb();
452
- if (!db) return;
453
- await new Promise((resolve) => {
454
- try {
455
- const req = db.transaction(STORE_NAME, "readwrite").objectStore(STORE_NAME).delete(key);
456
- req.onsuccess = () => resolve();
457
- req.onerror = () => {
458
- console.trace("[IDB] removeItem error:", req.error);
459
- resolve();
460
- };
461
- } catch (txErr) {
462
- console.trace("[IDB] removeItem transaction error:", txErr);
463
- resolve();
464
- }
465
- });
466
- } catch (err) {
467
- console.trace("[IDB] removeItem getDb error:", err);
468
- try {
469
- const db = await getDb();
470
- await new Promise((resolve) => {
471
- try {
472
- const req = db.transaction(STORE_NAME, "readwrite").objectStore(STORE_NAME).delete(key);
473
- req.onsuccess = () => resolve();
474
- req.onerror = () => {
475
- console.trace("[IDB] removeItem retry error:", req.error);
476
- resolve();
477
- };
478
- } catch (txErr) {
479
- console.trace("[IDB] removeItem retry transaction error:", txErr);
480
- resolve();
481
- }
482
- });
483
- } catch (recoveryErr) {
484
- console.trace("[IDB] removeItem recovery failed:", recoveryErr);
485
- }
486
- }
487
- }
488
- };
489
- function createPersister() {
490
- return experimental_createQueryPersister({
491
- storage,
492
- serialize: (persistedQuery) => persistedQuery,
493
- deserialize: (cached) => cached
494
- });
495
- }
496
- //#endregion
497
- //#region ../core/src/app-definition-api-context.ts
498
- const AppDefinitionApiContext = (0, react.createContext)(null);
499
- const AppDefinitionApiProvider = AppDefinitionApiContext.Provider;
500
- function useAppDefinitionApi() {
501
- const api = (0, react.useContext)(AppDefinitionApiContext);
502
- if (!api) throw new Error("useAppDefinitionApi must be used within an AppDefinitionApiProvider");
503
- return api;
504
- }
505
- //#endregion
506
- //#region ../../store/core/src/languages-api-context.ts
507
- const LanguagesApiContext = (0, react.createContext)(null);
508
- const LanguagesApiProvider = LanguagesApiContext.Provider;
509
- function useLanguagesApi() {
510
- const api = (0, react.useContext)(LanguagesApiContext);
511
- if (!api) throw new Error("useLanguagesApi must be used within a LanguagesApiProvider");
512
- return api;
513
- }
514
- //#endregion
515
- //#region ../../platform/api-client-core/src/fetch-client.ts
516
- /**
517
- * API Error class compatible with fluid-admin's ApiError
518
- */
519
- var ApiError = class ApiError extends Error {
520
- status;
521
- data;
522
- constructor(message, status, data) {
523
- super(message);
524
- this.name = "ApiError";
525
- this.status = status;
526
- this.data = data;
527
- if ("captureStackTrace" in Error) Error.captureStackTrace(this, ApiError);
528
- }
529
- toJSON() {
530
- return {
531
- name: this.name,
532
- message: this.message,
533
- status: this.status,
534
- data: this.data
535
- };
536
- }
537
- };
538
- /**
539
- * Creates a configured fetch client instance
540
- */
541
- function createFetchClient(config) {
542
- const { baseUrl, getAuthToken, onAuthError, defaultHeaders = {}, credentials } = config;
543
- /**
544
- * Build headers for a request
545
- */
546
- async function buildHeaders(customHeaders) {
547
- const headers = {
548
- Accept: "application/json",
549
- "Content-Type": "application/json",
550
- ...defaultHeaders,
551
- ...customHeaders
552
- };
553
- if (getAuthToken) {
554
- const token = await getAuthToken();
555
- if (token) headers.Authorization = `Bearer ${token}`;
556
- }
557
- return headers;
558
- }
559
- /**
560
- * Join baseUrl + endpoint via string concatenation (matches fetchApi).
561
- * Using `new URL(endpoint, baseUrl)` would strip any path prefix from
562
- * baseUrl (e.g. "/api") when the endpoint starts with "/".
563
- */
564
- function joinUrl(endpoint) {
565
- return `${baseUrl}${endpoint}`;
566
- }
567
- /**
568
- * Build URL with query parameters for GET requests
569
- * Compatible with fluid-admin's query param handling
570
- */
571
- function buildUrl(endpoint, params) {
572
- const fullUrl = joinUrl(endpoint);
573
- if (!params || Object.keys(params).length === 0) return fullUrl;
574
- const queryString = new URLSearchParams();
575
- Object.entries(params).forEach(([key, value]) => {
576
- if (value === void 0 || value === null) return;
577
- if (Array.isArray(value)) value.forEach((item) => queryString.append(`${key}[]`, String(item)));
578
- else if (typeof value === "object") Object.entries(value).forEach(([subKey, subValue]) => {
579
- if (subValue === void 0 || subValue === null) return;
580
- if (Array.isArray(subValue)) subValue.forEach((item) => queryString.append(`${key}[${subKey}][]`, String(item)));
581
- else queryString.append(`${key}[${subKey}]`, String(subValue));
582
- });
583
- else queryString.append(key, String(value));
584
- });
585
- const qs = queryString.toString();
586
- return qs ? `${fullUrl}?${qs}` : fullUrl;
587
- }
588
- /**
589
- * Shared response handler for both JSON and FormData requests.
590
- * Handles auth errors, non-OK responses, 204 No Content, and JSON parsing.
591
- */
592
- async function handleResponse(response, method, _url) {
593
- if (response.status === 401 && onAuthError) onAuthError();
594
- if (!response.ok) {
595
- const errorText = await response.text().catch(() => "");
596
- if (response.headers.get("content-type")?.includes("application/json")) {
597
- let data;
598
- try {
599
- data = JSON.parse(errorText);
600
- } catch {
601
- throw new ApiError(errorText.slice(0, 200) || `${method} request failed with status ${response.status}`, response.status, null);
602
- }
603
- throw new ApiError(data.message || data.error_message || `${method} request failed`, response.status, data.errors || data);
604
- } else throw new ApiError(`${method} request failed with status ${response.status}`, response.status, null);
605
- }
606
- if (response.status === 204 || response.headers.get("content-length") === "0") return null;
607
- if (response.headers.get("content-type")?.includes("application/json")) try {
608
- return await response.json();
609
- } catch {
610
- try {
611
- return await response.text();
612
- } catch {
613
- return null;
614
- }
615
- }
616
- return null;
617
- }
618
- /**
619
- * Main request function
620
- */
621
- async function request(endpoint, options = {}) {
622
- const { method = "GET", headers: customHeaders, params, body, signal } = options;
623
- const url = params ? buildUrl(endpoint, params) : joinUrl(endpoint);
624
- const headers = await buildHeaders(customHeaders);
625
- let response;
626
- try {
627
- const fetchOptions = {
628
- method,
629
- headers
630
- };
631
- if (credentials) fetchOptions.credentials = credentials;
632
- const serializedBody = body && method !== "GET" ? JSON.stringify(body) : null;
633
- if (serializedBody) fetchOptions.body = serializedBody;
634
- if (signal) fetchOptions.signal = signal;
635
- response = await fetch(url, fetchOptions);
636
- } catch (networkError) {
637
- throw new ApiError(`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`, 0, null);
638
- }
639
- return handleResponse(response, method, url);
640
- }
641
- /**
642
- * Request with FormData (for file uploads)
643
- */
644
- async function requestWithFormData(endpoint, formData, options = {}) {
645
- const { method = "POST", headers: customHeaders, signal } = options;
646
- const url = joinUrl(endpoint);
647
- const headers = await buildHeaders(customHeaders);
648
- delete headers["Content-Type"];
649
- let response;
650
- try {
651
- const fetchOptions = {
652
- method,
653
- headers,
654
- body: formData
655
- };
656
- if (credentials) fetchOptions.credentials = credentials;
657
- if (signal) fetchOptions.signal = signal;
658
- response = await fetch(url, fetchOptions);
659
- } catch (networkError) {
660
- throw new ApiError(`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`, 0, null);
661
- }
662
- return handleResponse(response, method, url);
663
- }
664
- return {
665
- request,
666
- requestWithFormData,
667
- get: (endpoint, params, options) => request(endpoint, {
668
- ...options,
669
- method: "GET",
670
- ...params && { params }
671
- }),
672
- post: (endpoint, body, options) => request(endpoint, {
673
- ...options,
674
- method: "POST",
675
- body
676
- }),
677
- put: (endpoint, body, options) => request(endpoint, {
678
- ...options,
679
- method: "PUT",
680
- body
681
- }),
682
- patch: (endpoint, body, options) => request(endpoint, {
683
- ...options,
684
- method: "PATCH",
685
- body
686
- }),
687
- delete: (endpoint, options) => request(endpoint, {
688
- ...options,
689
- method: "DELETE"
690
- })
691
- };
692
- }
693
- //#endregion
694
- //#region src/adapters/data-source-api-adapter.ts
695
- /**
696
- * Throws an AbortError if the signal is already aborted. Used as a manual
697
- * guard around the generated client calls since they don't yet accept
698
- * RequestOptions.signal — this at least short-circuits before and after
699
- * the network call so stale results don't overwrite fresh ones.
700
- */
701
- function throwIfAborted(signal) {
702
- if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
703
- }
704
- function bffNotSupported(op) {
705
- throw new Error(`[portal-tenant-adapter] "${op}" is not available on the portal-tenant BFF. Wire the legacy adapter for this feature, or re-add the endpoint to the BFF spec.`);
706
- }
707
- function isProduction() {
708
- return globalThis.process?.env?.NODE_ENV === "production";
709
- }
710
- function narrowPeriod(value) {
711
- if (value === "7d" || value === "30d" || value === "90d" || value === "1y" || value === "all") return value;
712
- if (value !== void 0 && !isProduction()) console.warn(`[portal-sdk] narrowPeriod: unknown value "${value}" dropped`);
713
- }
714
- const SHAREABLE_TYPE_DISCRIMINATOR = {
715
- products: "Product",
716
- media: "Medium",
717
- libraries: "Playlist",
718
- pages: "Page",
719
- enrollment_packs: "EnrollmentPack",
720
- promotions: "Promotion"
721
- };
722
- function withShareableType(resources, type) {
723
- const discriminator = SHAREABLE_TYPE_DISCRIMINATOR[type];
724
- return (resources ?? []).map((r) => ({
725
- ...r,
726
- id: r.id ?? 0,
727
- shareable_type: discriminator
728
- }));
729
- }
730
- async function fetchShareVisited(shareableType, client, contentClient, query) {
731
- switch (shareableType) {
732
- case "products": return withShareableType((await require_portal_tenant.product_by_shares(client, query)).resources, shareableType);
733
- case "media": return withShareableType((await require_portal_tenant_content.content_media_by_shares(contentClient, query)).resources, shareableType);
734
- case "libraries": return withShareableType((await require_portal_tenant_content.content_playlists_by_shares(contentClient, query)).resources, shareableType);
735
- case "pages": return withShareableType((await require_portal_tenant_content.content_pages_by_shares(contentClient, query)).resources, shareableType);
736
- case "enrollment_packs": return withShareableType((await require_portal_tenant.enrollment_pack_by_shares(client, query)).resources, shareableType);
737
- case "promotions": bffNotSupported(`fetchMostShared(${shareableType})`);
738
- }
739
- }
740
- async function fetchVisited(shareableType, client, contentClient, query) {
741
- switch (shareableType) {
742
- case "products": return withShareableType((await require_portal_tenant.product_by_visits(client, query)).resources, shareableType);
743
- case "media": return withShareableType((await require_portal_tenant_content.content_media_by_visits(contentClient, query)).resources, shareableType);
744
- case "libraries": return withShareableType((await require_portal_tenant_content.content_playlists_by_visits(contentClient, query)).resources, shareableType);
745
- case "pages": return withShareableType((await require_portal_tenant_content.content_pages_by_visits(contentClient, query)).resources, shareableType);
746
- case "enrollment_packs": return withShareableType((await require_portal_tenant.enrollment_pack_by_visits(client, query)).resources, shareableType);
747
- case "promotions": bffNotSupported(`fetchMostViewed(${shareableType})`);
748
- }
749
- }
750
- function toMetricsQuery(options) {
751
- const query = {};
752
- const period = narrowPeriod(options.period);
753
- if (period) query.period = period;
754
- if (options.limit != null) query.limit = options.limit;
755
- return query;
756
- }
757
- /**
758
- * Map a BFF order response to the port's NormalizedOrder shape.
759
- * Centralizes the boundary between BFF wire format and our canonical type
760
- * so schema drift surfaces at compile time rather than producing silent
761
- * `undefined`s in the consumer transformer.
762
- *
763
- * Field mapping: BFF `id` → `order_number` (numeric identifier displayed in
764
- * lists, matches portal-builder behaviour), `total` → `amount`/`total_display_amount`,
765
- * `line_items[0]` → `first_item` (first product, including its image_url).
766
- */
767
- function toNormalizedOrder(raw) {
768
- const firstLineItem = raw.line_items?.[0];
769
- return {
770
- id: raw.id ?? 0,
771
- order_number: raw.id != null ? String(raw.id) : void 0,
772
- amount: raw.total ?? void 0,
773
- total_display_amount: raw.total ?? void 0,
774
- status: raw.status ?? void 0,
775
- created_at: raw.created_at ?? void 0,
776
- first_item: firstLineItem ? {
777
- title: firstLineItem.product_name ?? void 0,
778
- image_url: firstLineItem.image_url ?? void 0
779
- } : void 0,
780
- token: raw.token ?? void 0
781
- };
782
- }
783
- /**
784
- * Map a BFF subscription response to the port's NormalizedSubscription shape.
785
- * Field name mapping: BFF `token` → `subscription_token`, `total` → `price`,
786
- * `next_billing_date` → `next_bill_date`, top-level `product` → `variant.product`.
787
- */
788
- function toNormalizedSubscription(raw) {
789
- const product = raw.product ?? void 0;
790
- return {
791
- id: raw.id ?? 0,
792
- subscription_token: raw.token ?? void 0,
793
- price: raw.total ?? void 0,
794
- status: raw.status ?? void 0,
795
- next_bill_date: raw.next_billing_date ?? void 0,
796
- variant: product ? { product: {
797
- title: product.name ?? void 0,
798
- image_url: product.image_url ?? void 0,
799
- price_in_currency: raw.original_price ?? void 0
800
- } } : void 0
801
- };
802
- }
803
- /**
804
- * Creates a DataSourceApi adapter backed by portal-tenant BFF clients.
805
- * Uses cookie-based auth (credentials: "include") — no explicit auth headers.
806
- */
807
- function createDataSourceApiAdapter(client, contentClient) {
808
- return {
809
- async fetchMostShared(_repId, options) {
810
- throwIfAborted(options.signal);
811
- const query = toMetricsQuery(options);
812
- const result = await fetchShareVisited(options.shareableType, client, contentClient, query);
813
- throwIfAborted(options.signal);
814
- return result;
815
- },
816
- async fetchMostViewed(_repId, options) {
817
- throwIfAborted(options.signal);
818
- const query = toMetricsQuery(options);
819
- const result = await fetchVisited(options.shareableType, client, contentClient, query);
820
- throwIfAborted(options.signal);
821
- return result;
822
- },
823
- async fetchOrders(_customerId, options) {
824
- throwIfAborted(options?.signal);
825
- const params = {};
826
- if (options?.limit != null) params["page[limit]"] = options.limit;
827
- if (options?.status && options.status !== "all") params.status = options.status;
828
- const response = await require_portal_tenant.orders_list(client, params);
829
- throwIfAborted(options?.signal);
830
- return (response.orders ?? []).map(toNormalizedOrder);
831
- },
832
- async fetchSubscriptions(_customerId, options) {
833
- throwIfAborted(options?.signal);
834
- const params = {};
835
- if (options?.limit != null) params["page[limit]"] = options.limit;
836
- if (options?.status && options.status !== "all") params.status = options.status;
837
- const response = await require_portal_tenant.subscriptions_list(client, params);
838
- throwIfAborted(options?.signal);
839
- return (response.subscriptions ?? []).map(toNormalizedSubscription);
840
- },
841
- async fetchResource(type, id, signal) {
842
- throwIfAborted(signal);
843
- switch (type) {
844
- case "Product": {
845
- const response = await require_portal_tenant.products_show(client, id);
846
- throwIfAborted(signal);
847
- const product = response.product;
848
- if (!product) throw new Error(`Product ${id} not found`);
849
- return {
850
- ...product,
851
- id: product.id ?? 0,
852
- shareable_type: "Product"
853
- };
854
- }
855
- case "Medium": {
856
- const response = await require_portal_tenant_content.media_show(contentClient, id);
857
- throwIfAborted(signal);
858
- const media = response.media;
859
- if (!media) throw new Error(`Medium ${id} not found`);
860
- return {
861
- ...media,
862
- id: media.id ?? 0,
863
- shareable_type: "Medium"
864
- };
865
- }
866
- case "EnrollmentPack": {
867
- const response = await require_portal_tenant.enrollment_packs_show(client, id);
868
- throwIfAborted(signal);
869
- const pack = response.enrollment_pack;
870
- if (!pack) throw new Error(`EnrollmentPack ${id} not found`);
871
- return {
872
- ...pack,
873
- id: pack.id ?? 0,
874
- shareable_type: "EnrollmentPack"
875
- };
876
- }
877
- case "Page": {
878
- const response = await require_portal_tenant_content.pages_show(contentClient, id);
879
- throwIfAborted(signal);
880
- const page = response.page;
881
- if (!page) throw new Error(`Page ${id} not found`);
882
- return {
883
- ...page,
884
- id: page.id ?? 0,
885
- shareable_type: "Page"
886
- };
887
- }
888
- case "Library": {
889
- const response = await require_portal_tenant_content.playlists_show(contentClient, id);
890
- throwIfAborted(signal);
891
- const playlist = response.playlist;
892
- if (!playlist) throw new Error(`Library ${id} not found`);
893
- return {
894
- ...playlist,
895
- id: playlist.id ?? 0,
896
- shareable_type: "Library"
897
- };
898
- }
899
- default: throw new Error(`Unknown resource type: ${type}`);
900
- }
901
- },
902
- async fetchProductsByFilter(filterType, filterId, signal) {
903
- throwIfAborted(signal);
904
- if (filterType === "tags") throw new Error("Tags data source is not yet supported.");
905
- const params = filterType === "collections" ? { collection_id: Number(filterId) } : { category_id: Number(filterId) };
906
- const response = await require_portal_tenant.products_list(client, params);
907
- throwIfAborted(signal);
908
- return withShareableType(response.products, "products");
909
- }
910
- };
911
- }
912
- //#endregion
913
- //#region src/adapters/app-definition-api-adapter.ts
914
- /**
915
- * Creates an AppDefinitionApi adapter backed by the portal-tenant BFF client.
916
- *
917
- * Maps the generated `app_manifest_show` response to the `AppDefinitionApi`
918
- * port, applying runtime defaults for optional BFF fields so TypeScript
919
- * catches schema drift at compile time via `satisfies`.
920
- */
921
- function createAppDefinitionApiAdapter(client) {
922
- async function fetchManifest() {
923
- const response = await require_portal_tenant.app_manifest_show(client);
924
- return {
925
- manifest: response.manifest,
926
- meta: {
927
- request_id: response.meta?.request_id ?? "",
928
- timestamp: response.meta?.timestamp ?? ""
929
- }
930
- };
931
- }
932
- return {
933
- fetchManifest,
934
- fetchDefinition: async () => {
935
- const { manifest, meta } = await fetchManifest();
936
- return {
937
- definition: mapManifestToDefinition(manifest),
938
- meta
939
- };
940
- }
941
- };
942
- }
943
- /**
944
- * Synthesize the legacy `{ definition }` shape from the new manifest
945
- * response. Retained only so deprecated callers keep building.
946
- */
947
- function mapManifestToDefinition(manifest) {
948
- return {
949
- id: manifest.definition_id ?? 0,
950
- name: manifest.name ?? "",
951
- version: manifest.published_version?.toString() ?? null,
952
- components: [],
953
- active: true
954
- };
955
- }
956
- //#endregion
957
- //#region src/adapters/account-api-adapter.ts
958
- function mapAccount(raw) {
959
- return {
960
- id: raw.id ?? 0,
961
- member_type: raw.member_type ?? "rep",
962
- first_name: raw.first_name ?? "",
963
- last_name: raw.last_name ?? "",
964
- email: raw.email ?? "",
965
- phone: raw.phone ?? null,
966
- bio: raw.bio ?? null,
967
- avatar_url: raw.avatar_url ?? null,
968
- slug: raw.slug ?? "",
969
- social_links: raw.social_links ?? null,
970
- recipient_id: raw.recipient_id ?? null
971
- };
972
- }
973
- function createAccountApiAdapter(client) {
974
- return {
975
- fetchAccount: async () => {
976
- const response = await require_portal_tenant.account_show(client);
977
- return {
978
- account: mapAccount(response.account ?? {}),
979
- meta: {
980
- request_id: response.meta?.request_id ?? "",
981
- timestamp: response.meta?.timestamp ?? ""
982
- }
983
- };
984
- },
985
- updateAccount: async (body) => {
986
- const response = await require_portal_tenant.account_update(client, body);
987
- return {
988
- account: mapAccount(response.account ?? {}),
989
- meta: {
990
- request_id: response.meta?.request_id ?? "",
991
- timestamp: response.meta?.timestamp ?? ""
992
- }
993
- };
994
- }
995
- };
996
- }
997
- //#endregion
998
- //#region src/adapters/store-api-adapter.ts
999
- function mapStore(raw) {
1000
- return {
1001
- id: raw.id ?? 0,
1002
- name: raw.name ?? "",
1003
- subdomain: raw.subdomain ?? "",
1004
- logo_url: raw.logo_url ?? null,
1005
- icon_url: raw.icon_url ?? null,
1006
- appstore_url: raw.appstore_url ?? null,
1007
- playstore_url: raw.playstore_url ?? null
1008
- };
1009
- }
1010
- function createStoreApiAdapter(client) {
1011
- return { fetchStore: async () => {
1012
- const response = await require_portal_tenant.store_show(client);
1013
- return {
1014
- store: mapStore(response.store ?? {}),
1015
- meta: {
1016
- request_id: response.meta?.request_id ?? "",
1017
- timestamp: response.meta?.timestamp ?? ""
1018
- }
1019
- };
1020
- } };
1021
- }
1022
- //#endregion
1023
- //#region ../../api-clients/portal-tenant-pay/src/namespaces/portal_tenant_pay.ts
1024
- /**
1025
- * List addresses
1026
- * Returns addresses associated with the member's customer record in this tenant.
1027
- *
1028
- * @param client - Fetch client instance
1029
- * @param [params] - params
1030
- */
1031
- async function addresses_list(client, params) {
1032
- return client.get(`/api/pay/addresses`, params);
1033
- }
1034
- /**
1035
- * Create an address
1036
- * Adds a new address to the member's customer record. If an identical address already exists it is returned instead of creating a duplicate.
1037
- *
1038
- * @param client - Fetch client instance
1039
- * @param body - body
1040
- */
1041
- async function addresses_create(client, body) {
1042
- return client.post(`/api/pay/addresses`, body);
1043
- }
1044
- /**
1045
- * Update an address
1046
- * Creates a new address with the merged attributes and discards the old one, preserving references from existing orders.
1047
- *
1048
- * @param client - Fetch client instance
1049
- * @param id - id
1050
- * @param body - body
1051
- */
1052
- async function addresses_update(client, id, body) {
1053
- return client.patch(`/api/pay/addresses/${id}`, body);
1054
- }
1055
- /**
1056
- * Delete an address
1057
- * Removes an address from the member's customer record. The default address cannot be removed.
1058
- *
1059
- * @param client - Fetch client instance
1060
- * @param id - id
1061
- */
1062
- async function addresses_destroy(client, id) {
1063
- return client.delete(`/api/pay/addresses/${id}`);
1064
- }
1065
- /**
1066
- * List payment methods
1067
- * Returns displayable payment methods on the member's customer record, excluding Apple Pay sources.
1068
- *
1069
- * @param client - Fetch client instance
1070
- * @param [params] - params
1071
- */
1072
- async function payment_methods_list(client, params) {
1073
- return client.get(`/api/pay/payment_methods`, params);
1074
- }
1075
- /**
1076
- * Create a payment method
1077
- * Tokenizes and stores a new payment method via the vault provider. Requires a vault token obtained from the vault credentials endpoint.
1078
- *
1079
- * @param client - Fetch client instance
1080
- * @param body - body
1081
- */
1082
- async function payment_methods_create(client, body) {
1083
- return client.post(`/api/pay/payment_methods`, body);
1084
- }
1085
- /**
1086
- * Update a payment method
1087
- * Updates a payment method's attributes. Supports setting as default and replacing the card's billing address.
1088
- *
1089
- * @param client - Fetch client instance
1090
- * @param id - id
1091
- * @param body - body
1092
- */
1093
- async function payment_methods_update(client, id, body) {
1094
- return client.patch(`/api/pay/payment_methods/${id}`, body);
1095
- }
1096
- /**
1097
- * Delete a payment method
1098
- * Removes a payment method from the member's customer record. If the removed method was the default, the default is cleared.
1099
- *
1100
- * @param client - Fetch client instance
1101
- * @param id - id
1102
- */
1103
- async function payment_methods_destroy(client, id) {
1104
- return client.delete(`/api/pay/payment_methods/${id}`);
1105
- }
1106
- /**
1107
- * Get vault credentials
1108
- * Returns a short-lived vault token and environment identifier for initializing the client-side payment vault SDK.
1109
- *
1110
- * @param client - Fetch client instance
1111
-
1112
- */
1113
- async function payment_methods_vault_show(client) {
1114
- return client.get(`/api/pay/payment_methods/vault`);
1115
- }
1116
- /**
1117
- * List points ledger entries
1118
- * Returns loyalty points ledger entries for the member's customer record in this tenant, ordered by most recent first. Returns 403 if the company does not have reward points enabled.
1119
- *
1120
- * @param client - Fetch client instance
1121
- * @param [params] - params
1122
- */
1123
- async function points_ledgers_list(client, params) {
1124
- return client.get(`/api/pay/points_ledgers`, params);
1125
- }
1126
- //#endregion
1127
- //#region src/adapters/pay-api-adapter.ts
1128
- function mapAddress(raw) {
1129
- return {
1130
- id: raw.id ?? 0,
1131
- name: raw.name ?? null,
1132
- street1: raw.street1 ?? "",
1133
- street2: raw.street2 ?? null,
1134
- city: raw.city ?? "",
1135
- state: raw.state ?? "",
1136
- zip: raw.zip ?? "",
1137
- country: raw.country ?? "",
1138
- default: raw.default ?? false,
1139
- created_at: raw.created_at ?? null,
1140
- updated_at: raw.updated_at ?? null
1141
- };
1142
- }
1143
- function mapBillingAddress(raw) {
1144
- return {
1145
- id: raw.id ?? 0,
1146
- name: raw.name ?? null,
1147
- street1: raw.street1 ?? "",
1148
- street2: raw.street2 ?? null,
1149
- city: raw.city ?? "",
1150
- state: raw.state ?? "",
1151
- zip: raw.zip ?? "",
1152
- country: raw.country ?? "",
1153
- default: false,
1154
- created_at: raw.created_at ?? null,
1155
- updated_at: raw.updated_at ?? null
1156
- };
1157
- }
1158
- function mapPaymentMethod(raw) {
1159
- return {
1160
- id: raw.id ?? 0,
1161
- type: raw.type ?? "card",
1162
- brand: raw.brand ?? null,
1163
- last_four: raw.last_four ?? "",
1164
- exp_month: raw.exp_month ?? null,
1165
- exp_year: raw.exp_year ?? null,
1166
- default: raw.default ?? false,
1167
- billing_address: raw.billing_address ? mapBillingAddress(raw.billing_address) : null,
1168
- created_at: raw.created_at ?? null,
1169
- updated_at: raw.updated_at ?? null
1170
- };
1171
- }
1172
- function createPortalTenantPayAdapter(client) {
1173
- return {
1174
- fetchAddresses: async () => {
1175
- const response = await addresses_list(client);
1176
- return {
1177
- addresses: (response.addresses ?? []).map(mapAddress),
1178
- meta: {
1179
- request_id: response.meta?.request_id ?? "",
1180
- timestamp: response.meta?.timestamp ?? ""
1181
- }
1182
- };
1183
- },
1184
- createAddress: async (body) => {
1185
- await addresses_create(client, body);
1186
- },
1187
- updateAddress: async (addressId, body) => {
1188
- await addresses_update(client, addressId, body);
1189
- },
1190
- deleteAddress: async (addressId) => {
1191
- await addresses_destroy(client, addressId);
1192
- },
1193
- fetchPaymentMethods: async () => {
1194
- const response = await payment_methods_list(client);
1195
- return {
1196
- payment_methods: (response.payment_methods ?? []).map(mapPaymentMethod),
1197
- meta: {
1198
- request_id: response.meta?.request_id ?? "",
1199
- timestamp: response.meta?.timestamp ?? ""
1200
- }
1201
- };
1202
- },
1203
- createPaymentMethod: async (body) => {
1204
- await payment_methods_create(client, body);
1205
- },
1206
- updatePaymentMethod: async (paymentMethodId, body) => {
1207
- await payment_methods_update(client, paymentMethodId, body);
1208
- },
1209
- deletePaymentMethod: async (paymentMethodId) => {
1210
- await payment_methods_destroy(client, paymentMethodId);
1211
- },
1212
- fetchVaultCredentials: async () => {
1213
- const response = await payment_methods_vault_show(client);
1214
- return {
1215
- vault: {
1216
- vault_id: response.vault?.vault_id ?? "",
1217
- environment: response.vault?.environment ?? "sandbox",
1218
- route_id: response.vault?.route_id ?? null
1219
- },
1220
- meta: {
1221
- request_id: response.meta?.request_id ?? "",
1222
- timestamp: response.meta?.timestamp ?? ""
1223
- }
1224
- };
1225
- },
1226
- fetchPointsLedgers: async () => {
1227
- const response = await points_ledgers_list(client);
1228
- return {
1229
- points_ledgers: (response.points_ledgers ?? []).map((entry) => ({
1230
- id: entry.id ?? 0,
1231
- amount: entry.amount ?? 0,
1232
- total_balance: entry.total_balance ?? 0,
1233
- metadata: entry.metadata ?? null,
1234
- created_at: entry.created_at ?? ""
1235
- })),
1236
- meta: {
1237
- request_id: response.meta?.request_id ?? "",
1238
- timestamp: response.meta?.timestamp ?? ""
1239
- }
1240
- };
1241
- }
1242
- };
1243
- }
1244
- //#endregion
1245
- //#region ../../api-clients/portal-tenant-store/src/namespaces/portal_tenant_store.ts
1246
- /**
1247
- * List available countries
1248
- * Returns countries enabled for the tenant store, each with its ISO 3166 subdivisions (states/provinces).
1249
- *
1250
- * @param client - Fetch client instance
1251
- * @param [params] - params
1252
- */
1253
- async function countries_list(client, params) {
1254
- return client.get(`/api/store/countries`, params);
1255
- }
1256
- /**
1257
- * List available languages
1258
- * Returns languages enabled for the tenant store, sorted by name.
1259
- *
1260
- * @param client - Fetch client instance
1261
- * @param [params] - params
1262
- */
1263
- async function languages_list(client, params) {
1264
- return client.get(`/api/store/languages`, params);
1265
- }
1266
- //#endregion
1267
- //#region src/adapters/countries-api-adapter.ts
1268
- /**
1269
- * Maps a BFF state to the port's State shape.
1270
- */
1271
- function mapState(raw) {
1272
- return {
1273
- code: raw.code ?? "",
1274
- name: raw.name ?? ""
1275
- };
1276
- }
1277
- /**
1278
- * Maps a BFF country to the port's Country shape.
1279
- */
1280
- function mapCountry(raw) {
1281
- return {
1282
- code: raw.code ?? "",
1283
- name: raw.name ?? "",
1284
- currency_code: raw.currency_code ?? "",
1285
- states: (raw.states ?? []).map(mapState)
1286
- };
1287
- }
1288
- /**
1289
- * Maps the BFF meta envelope to the port's ApiMeta shape.
1290
- */
1291
- function mapMeta$1(raw) {
1292
- return {
1293
- request_id: raw?.request_id ?? null,
1294
- timestamp: raw?.timestamp ?? "",
1295
- pagination: raw?.pagination ? {
1296
- cursor: raw.pagination.cursor ?? null,
1297
- limit: raw.pagination.limit,
1298
- next_cursor: raw.pagination.next_cursor ?? null,
1299
- prev_cursor: raw.pagination.prev_cursor ?? null
1300
- } : void 0
1301
- };
1302
- }
1303
- /**
1304
- * Creates a CountriesApi adapter backed by the portal-tenant store BFF.
1305
- *
1306
- * Maps the generated portal-tenant-store namespace functions to the abstract
1307
- * CountriesApi port, closing over the FetchClient so consumers don't need
1308
- * to pass it per-call.
1309
- */
1310
- function createCountriesApiAdapter(client) {
1311
- return { listCountries: async (params) => {
1312
- const response = await countries_list(client, {
1313
- "page[cursor]": params?.cursor,
1314
- "page[limit]": params?.limit
1315
- });
1316
- return {
1317
- countries: (response.countries ?? []).map(mapCountry),
1318
- meta: mapMeta$1(response.meta)
1319
- };
1320
- } };
1321
- }
1322
- //#endregion
1323
- //#region src/adapters/languages-api-adapter.ts
1324
- /**
1325
- * Maps a BFF language to the port's Language shape.
1326
- */
1327
- function mapLanguage(raw) {
1328
- return {
1329
- code: raw.code ?? "",
1330
- name: raw.name ?? ""
1331
- };
1332
- }
1333
- /**
1334
- * Maps the BFF meta envelope to the port's ApiMeta shape.
1335
- */
1336
- function mapMeta(raw) {
1337
- return {
1338
- request_id: raw?.request_id ?? null,
1339
- timestamp: raw?.timestamp ?? "",
1340
- pagination: raw?.pagination ? {
1341
- cursor: raw.pagination.cursor ?? null,
1342
- limit: raw.pagination.limit,
1343
- next_cursor: raw.pagination.next_cursor ?? null,
1344
- prev_cursor: raw.pagination.prev_cursor ?? null
1345
- } : void 0
1346
- };
1347
- }
1348
- /**
1349
- * Creates a LanguagesApi adapter backed by the portal-tenant store BFF.
1350
- *
1351
- * Maps the generated portal-tenant-store namespace functions to the abstract
1352
- * LanguagesApi port, closing over the FetchClient so consumers don't need
1353
- * to pass it per-call.
1354
- */
1355
- function createLanguagesApiAdapter(client) {
1356
- return { listLanguages: async (params) => {
1357
- const response = await languages_list(client, {
1358
- "page[cursor]": params?.cursor,
1359
- "page[limit]": params?.limit
1360
- });
1361
- return {
1362
- languages: (response.languages ?? []).map(mapLanguage),
1363
- meta: mapMeta(response.meta)
1364
- };
1365
- } };
1366
- }
1367
- //#endregion
1368
- //#region ../../api-clients/portal-tenant-mysite/src/namespaces/portal_tenant_mysite.ts
1369
- /**
1370
- * Get MySite profile for the current user
1371
- * Returns the member's MySite profile.
1372
- *
1373
- * @param client - Fetch client instance
1374
-
1375
- */
1376
- async function mysite_profile_show(client) {
1377
- return client.get(`/api/mysite/profile`);
1378
- }
1379
- /**
1380
- * Update MySite profile
1381
- * Updates the member's MySite profile fields.
1382
- *
1383
- * @param client - Fetch client instance
1384
- * @param body - body
1385
- */
1386
- async function mysite_profile_update(client, body) {
1387
- return client.put(`/api/mysite/profile`, body);
1388
- }
1389
- /**
1390
- * List available MySite themes
1391
- * Returns available MySite themes.
1392
- *
1393
- * @param client - Fetch client instance
1394
- * @param [params] - params
1395
- */
1396
- async function mysite_themes_list(client, params) {
1397
- return client.get(`/api/mysite/themes`, params);
1398
- }
1399
- /**
1400
- * Update MySite settings
1401
- * Updates the member's MySite settings.
1402
- *
1403
- * @param client - Fetch client instance
1404
- * @param body - body
1405
- */
1406
- async function mysite_settings_update(client, body) {
1407
- return client.put(`/api/mysite/settings`, body);
1408
- }
1409
- /**
1410
- * List MySite links for the current user
1411
- * Returns the member's MySite links, ordered by position.
1412
- *
1413
- * @param client - Fetch client instance
1414
- * @param [params] - params
1415
- */
1416
- async function mysite_links_list(client, params) {
1417
- return client.get(`/api/mysite/links`, params);
1418
- }
1419
- /**
1420
- * Create a MySite link
1421
- * Adds a new link to the member's MySite.
1422
- *
1423
- * @param client - Fetch client instance
1424
- * @param body - body
1425
- */
1426
- async function mysite_links_create(client, body) {
1427
- return client.post(`/api/mysite/links`, body);
1428
- }
1429
- /**
1430
- * Update a MySite link
1431
- * Updates an existing MySite link.
1432
- *
1433
- * @param client - Fetch client instance
1434
- * @param id - id
1435
- * @param body - body
1436
- */
1437
- async function mysite_links_update(client, id, body) {
1438
- return client.put(`/api/mysite/links/${id}`, body);
1439
- }
1440
- /**
1441
- * Delete a MySite link
1442
- * Removes a link from the member's MySite.
1443
- *
1444
- * @param client - Fetch client instance
1445
- * @param id - id
1446
- */
1447
- async function mysite_links_destroy(client, id) {
1448
- return client.delete(`/api/mysite/links/${id}`);
1449
- }
1450
- /**
1451
- * Reorder MySite links
1452
- * Reorders MySite links by providing an ordered list of IDs.
1453
- *
1454
- * @param client - Fetch client instance
1455
- * @param body - body
1456
- */
1457
- async function mysite_links_bulk_reorder(client, body) {
1458
- return client.patch(`/api/mysite/links/bulk`, body);
1459
- }
1460
- /**
1461
- * List MySite favorites
1462
- * Returns the member's MySite favorites (products, playlists, etc.).
1463
- *
1464
- * @param client - Fetch client instance
1465
- * @param [params] - params
1466
- */
1467
- async function mysite_favorites_list(client, params) {
1468
- return client.get(`/api/mysite/favorites`, params);
1469
- }
1470
- /**
1471
- * Add a product to MySite favorites
1472
- * Adds a product to the member's MySite favorites.
1473
- *
1474
- * @param client - Fetch client instance
1475
- * @param body - body
1476
- */
1477
- async function mysite_favorites_create(client, body) {
1478
- return client.post(`/api/mysite/favorites`, body);
1479
- }
1480
- /**
1481
- * Remove a product from MySite favorites
1482
- * Removes a product from the member's MySite favorites.
1483
- *
1484
- * @param client - Fetch client instance
1485
- * @param id - id
1486
- */
1487
- async function mysite_favorites_destroy(client, id) {
1488
- return client.delete(`/api/mysite/favorites/${id}`);
1489
- }
1490
- /**
1491
- * Reorder MySite favorites
1492
- * Reorders MySite favorites by providing an ordered list of IDs.
1493
- *
1494
- * @param client - Fetch client instance
1495
- * @param body - body
1496
- */
1497
- async function mysite_favorites_bulk_reorder(client, body) {
1498
- return client.patch(`/api/mysite/favorites/bulk`, body);
1499
- }
1500
- //#endregion
1501
- //#region src/adapters/mysite-api-adapter.ts
1502
- function mapProfile(raw) {
1503
- return {
1504
- id: raw.id ?? 0,
1505
- mysite_url: raw.mysite_url ?? null,
1506
- mysite_views: raw.mysite_views ?? 0,
1507
- mysite_leads: raw.mysite_leads ?? 0,
1508
- theme_id: raw.theme_id ?? null,
1509
- bio: raw.bio ?? null,
1510
- avatar_url: raw.avatar_url ?? null,
1511
- display_name: raw.display_name ?? null,
1512
- slug: raw.slug ?? null
1513
- };
1514
- }
1515
- function mapLink(raw) {
1516
- return {
1517
- id: raw.id ?? 0,
1518
- url: raw.url ?? "",
1519
- title: raw.title ?? "",
1520
- position: raw.position ?? 0
1521
- };
1522
- }
1523
- function mapFavorite(raw) {
1524
- return {
1525
- id: raw.id ?? 0,
1526
- favoriteable_id: raw.favoriteable_id ?? raw.product_id ?? 0,
1527
- favoriteable_type: raw.favoriteable_type ?? "Product",
1528
- name: raw.name ?? raw.product_name ?? null,
1529
- image_url: raw.image_url ?? raw.product_image_url ?? null,
1530
- product_id: raw.product_id ?? raw.favoriteable_id ?? 0,
1531
- product_name: raw.product_name ?? raw.name ?? null,
1532
- product_image_url: raw.product_image_url ?? raw.image_url ?? null,
1533
- position: raw.position ?? 0,
1534
- created_at: raw.created_at ?? null
1535
- };
1536
- }
1537
- function mapTheme(raw) {
1538
- return {
1539
- id: raw.id ?? 0,
1540
- name: raw.name ?? "",
1541
- preview_url: raw.preview_url ?? null
1542
- };
1543
- }
1544
- function createMySiteApiAdapter(client) {
1545
- return {
1546
- fetchProfile: async () => {
1547
- return mapProfile((await mysite_profile_show(client)).profile ?? {});
1548
- },
1549
- updateProfile: async (body) => {
1550
- return mapProfile((await mysite_profile_update(client, { profile: {
1551
- display_name: body.display_name,
1552
- bio: body.bio,
1553
- avatar_url: body.avatar_url
1554
- } })).profile ?? {});
1555
- },
1556
- updateSettings: async (body) => {
1557
- await Promise.all([body.theme_id !== void 0 ? mysite_settings_update(client, { settings: { theme_id: body.theme_id } }) : Promise.resolve(), body.slug !== void 0 ? mysite_profile_update(client, { profile: { slug: body.slug } }) : Promise.resolve()]);
1558
- },
1559
- listLinks: async () => {
1560
- return ((await mysite_links_list(client)).links ?? []).map(mapLink);
1561
- },
1562
- createLink: async (body) => {
1563
- return mapLink((await mysite_links_create(client, { link: {
1564
- title: body.title,
1565
- url: body.url
1566
- } })).link ?? {});
1567
- },
1568
- updateLink: async (linkId, body) => {
1569
- return mapLink((await mysite_links_update(client, linkId, { link: {
1570
- title: body.title,
1571
- url: body.url
1572
- } })).link ?? {});
1573
- },
1574
- deleteLink: async (linkId) => {
1575
- await mysite_links_destroy(client, linkId);
1576
- },
1577
- reorderLinks: async (orderedIds) => {
1578
- return ((await mysite_links_bulk_reorder(client, { ordered_ids: orderedIds })).links ?? []).map(mapLink);
1579
- },
1580
- listFavorites: async () => {
1581
- return ((await mysite_favorites_list(client)).favorites ?? []).map(mapFavorite);
1582
- },
1583
- addFavorite: async (body) => {
1584
- return mapFavorite((await mysite_favorites_create(client, { favorite: { product_id: body.product_id } })).favorite ?? {});
1585
- },
1586
- deleteFavorite: async (favoriteId) => {
1587
- await mysite_favorites_destroy(client, favoriteId);
1588
- },
1589
- reorderFavorites: async (orderedIds) => {
1590
- return ((await mysite_favorites_bulk_reorder(client, { ordered_ids: orderedIds })).favorites ?? []).map(mapFavorite);
1591
- },
1592
- listThemes: async () => {
1593
- return ((await mysite_themes_list(client)).themes ?? []).map(mapTheme);
1594
- }
1595
- };
1596
- }
1597
- //#endregion
1598
- //#region src/providers/FluidThemeProvider.tsx
1599
- /**
1600
- * Theme Provider for Fluid SDK
1601
- * Handles CSS variable injection using portal-core's theme engine.
1602
- * Accepts ThemeDefinition objects and resolves them into CSS via generateThemeCSS.
1603
- */
1604
- const ThemeContext = (0, react.createContext)(null);
1605
- /**
1606
- * Apply a theme to the DOM using the shared portal-core pipeline.
1607
- * Also sets data attributes on the container for CSS selector targeting.
1608
- */
1609
- function applyThemeToDOM(theme, mode, container) {
1610
- const target = container ?? document.documentElement;
1611
- require_src.applyTheme(require_src.resolveTheme(theme));
1612
- target.dataset.theme = theme.id;
1613
- if (mode) target.dataset.themeMode = mode;
1614
- else delete target.dataset.themeMode;
1615
- }
1616
- function FluidThemeProvider({ children, initialTheme, container }) {
1617
- const [currentTheme, setCurrentTheme] = (0, react.useState)(initialTheme ?? null);
1618
- const [mode, setMode] = (0, react.useState)(void 0);
1619
- (0, react.useEffect)(() => {
1620
- if (currentTheme) applyThemeToDOM(currentTheme, mode, container ?? null);
1621
- return () => {
1622
- if (currentTheme) require_src.removeTheme(currentTheme.id);
1623
- };
1624
- }, [
1625
- currentTheme,
1626
- mode,
1627
- container
1628
- ]);
1629
- const setTheme = (0, react.useCallback)((theme) => {
1630
- setCurrentTheme(theme);
1631
- }, []);
1632
- const setThemeMode = (0, react.useCallback)((newMode) => {
1633
- setMode(newMode);
1634
- }, []);
1635
- const value = (0, react.useMemo)(() => ({
1636
- currentTheme,
1637
- setTheme,
1638
- setThemeMode,
1639
- mode
1640
- }), [
1641
- currentTheme,
1642
- setTheme,
1643
- setThemeMode,
1644
- mode
1645
- ]);
1646
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeContext.Provider, {
1647
- value,
1648
- children
1649
- });
1650
- }
1651
- /**
1652
- * Hook to access theme context
1653
- * Must be used within a FluidThemeProvider
1654
- */
1655
- function useThemeContext() {
1656
- const context = (0, react.useContext)(ThemeContext);
1657
- if (!context) throw new Error("useThemeContext must be used within a FluidThemeProvider");
1658
- return context;
1659
- }
1660
- //#endregion
1661
- //#region ../../platform/i18n/src/locale-context.tsx
1662
- const LocaleCtx = (0, react.createContext)(null);
1663
- function LocaleProvider({ initialLocale, onLocaleChange, children }) {
1664
- const [locale, setLocaleState] = (0, react.useState)(initialLocale);
1665
- const value = (0, react.useMemo)(() => ({
1666
- locale,
1667
- setLocale(next) {
1668
- setLocaleState(next);
1669
- onLocaleChange?.(next);
1670
- }
1671
- }), [locale, onLocaleChange]);
1672
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LocaleCtx.Provider, {
1673
- value,
1674
- children
1675
- });
1676
- }
1677
- function useActiveLocale() {
1678
- const value = (0, react.useContext)(LocaleCtx);
1679
- if (!value) throw new Error("useActiveLocale must be used within a LocaleProvider");
1680
- return value;
1681
- }
1682
- //#endregion
1683
- //#region src/adapters/widgets-api-adapter.ts
1684
- function mapBffCalendarEvent(event) {
1685
- return {
1686
- id: event.id,
1687
- title: event.title,
1688
- color: event.color ?? null,
1689
- start: event.start,
1690
- end: event.end,
1691
- description: null,
1692
- url: null,
1693
- active: null,
1694
- timeZone: null,
1695
- status: null,
1696
- imageUrl: null,
1697
- images: null,
1698
- venue: null,
1699
- countries: null,
1700
- hasTomorrow: null,
1701
- hasYesterday: null,
1702
- isAllDay: null
1703
- };
1704
- }
1705
- function mapBffTodo(raw) {
1706
- return {
1707
- id: raw.id,
1708
- body: raw.body,
1709
- dueAt: raw.due_at ?? null,
1710
- completedAt: raw.completed_at ?? null,
1711
- createdAt: raw.created_at,
1712
- contactId: raw.contact_id ?? null,
1713
- contactName: raw.contact_name ?? null
1714
- };
1715
- }
1716
- const KNOWN_ACTIVITY_SLUGS = {
1717
- abandoned_cart: true,
1718
- announcements: true,
1719
- cart_items_added: true,
1720
- comment_reply: true,
1721
- direct_message: true,
1722
- fantasy_point: true,
1723
- new_lead: true,
1724
- order_placed: true,
1725
- page_views: true,
1726
- page_views_contact: true,
1727
- tasks: true,
1728
- upcoming_event: true,
1729
- video: true,
1730
- video_complete: true,
1731
- video_complete_contact: true,
1732
- video_contact: true,
1733
- message_received: true,
1734
- message_sent: true,
1735
- new_cart_items_added: true,
1736
- smart_link_clicked: true,
1737
- review_left: true
1738
- };
1739
- function isActivitySlug(slug) {
1740
- return Object.hasOwn(KNOWN_ACTIVITY_SLUGS, slug);
1741
- }
1742
- function mapBffActivity(raw) {
1743
- if (!isActivitySlug(raw.slug)) {
1744
- console.warn(`[portal-sdk] mapBffActivity: unknown activity slug "${raw.slug}" dropped (id=${raw.id})`);
1745
- return null;
1746
- }
1747
- return {
1748
- id: raw.id,
1749
- userName: raw.user_name,
1750
- avatarUrl: raw.avatar_url ?? null,
1751
- activityType: formatActivityType(raw.slug),
1752
- targetName: raw.target_name,
1753
- timestamp: raw.created_at,
1754
- slug: raw.slug
1755
- };
1756
- }
1757
- function mapBffCatchUp(raw) {
1758
- return {
1759
- id: raw.id,
1760
- suggestionTitle: raw.suggestion_title
1761
- };
1762
- }
1763
- function formatBffPointsDescription(ledger) {
1764
- const metadata = ledger.metadata;
1765
- if (metadata?.transaction_type) return metadata.transaction_type.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
1766
- if (metadata?.source?.reason) return metadata.source.reason;
1767
- if (ledger.created_at) return `Transaction ${new Date(ledger.created_at).toLocaleDateString("en-US", {
1768
- month: "long",
1769
- day: "numeric"
1770
- })}`;
1771
- return "Points Transaction";
1772
- }
1773
- function mapBffPointsLedger(ledgers) {
1774
- const sorted = [...ledgers].sort((a, b) => new Date(b.created_at ?? 0).getTime() - new Date(a.created_at ?? 0).getTime());
1775
- return {
1776
- balance: sorted[0]?.total_balance ?? 0,
1777
- entries: sorted.map((ledger) => ({
1778
- id: ledger.id,
1779
- description: formatBffPointsDescription(ledger),
1780
- amount: ledger.amount,
1781
- createdAt: ledger.created_at ?? ""
1782
- }))
1783
- };
1784
- }
1785
- function mapBffMySiteProfile(profile) {
1786
- return {
1787
- url: profile.mysite_url ?? null,
1788
- views: profile.mysite_views ?? 0,
1789
- leads: profile.mysite_leads ?? 0,
1790
- userName: profile.display_name ?? "User"
1791
- };
1792
- }
1793
- function createBffWidgetsAdapter(client) {
1794
- return {
1795
- async fetchCalendarEvents() {
1796
- try {
1797
- return ((await require_portal_tenant.calendar_events_list(client)).calendar_events ?? []).filter((e) => e.start && e.end).map(mapBffCalendarEvent);
1798
- } catch (error) {
1799
- throw new Error("Failed to fetch calendar events", { cause: error });
1800
- }
1801
- },
1802
- async fetchTodos() {
1803
- try {
1804
- return ((await require_portal_tenant.todos_list(client)).todos ?? []).map(mapBffTodo);
1805
- } catch (error) {
1806
- throw new Error("Failed to fetch todos", { cause: error });
1807
- }
1808
- },
1809
- async fetchActivities() {
1810
- try {
1811
- return ((await require_portal_tenant.activities_list(client)).activities ?? []).map(mapBffActivity).filter((activity) => activity !== null);
1812
- } catch (error) {
1813
- throw new Error("Failed to fetch activities", { cause: error });
1814
- }
1815
- },
1816
- async fetchCatchUps() {
1817
- try {
1818
- return ((await require_portal_tenant.catch_ups_list(client)).catch_ups ?? []).map(mapBffCatchUp);
1819
- } catch (error) {
1820
- throw new Error("Failed to fetch catch ups", { cause: error });
1821
- }
1822
- },
1823
- async updateTodo(id, completed) {
1824
- try {
1825
- return mapBffTodo((await require_portal_tenant.todos_update(client, id, { todo: { completed } })).todo);
1826
- } catch (error) {
1827
- throw new Error("Failed to update todo", { cause: error });
1828
- }
1829
- },
1830
- async fetchMySite() {
1831
- try {
1832
- return mapBffMySiteProfile((await mysite_profile_show(client)).profile ?? {});
1833
- } catch (error) {
1834
- throw new Error("Failed to fetch MySite data", { cause: error });
1835
- }
1836
- },
1837
- async fetchPointsLedger() {
1838
- try {
1839
- return mapBffPointsLedger((await points_ledgers_list(client)).points_ledgers ?? []);
1840
- } catch (error) {
1841
- throw new Error("Failed to fetch points ledger", { cause: error });
1842
- }
1843
- }
1844
- };
1845
- }
1846
- function mapCalendarEventDescription(raw) {
1847
- return {
1848
- id: raw.id,
1849
- name: raw.name,
1850
- body: raw.body,
1851
- recordType: raw.record_type,
1852
- recordId: raw.record_id,
1853
- createdAt: raw.created_at,
1854
- updatedAt: raw.updated_at,
1855
- locale: raw.locale
1856
- };
1857
- }
1858
- function mapCalendarEvent(event) {
1859
- return {
1860
- id: event.id,
1861
- title: event.title,
1862
- description: event.description ? mapCalendarEventDescription(event.description) : event.description,
1863
- color: event.color,
1864
- url: event.url,
1865
- start: event.start,
1866
- end: event.end,
1867
- active: event.active,
1868
- timeZone: event.time_zone,
1869
- status: event.status,
1870
- imageUrl: event.image_url,
1871
- images: event.images,
1872
- venue: event.venue,
1873
- countries: event.countries,
1874
- hasTomorrow: event.hasTomorrow,
1875
- hasYesterday: event.hasYesterday,
1876
- isAllDay: event.isAllDay
1877
- };
1878
- }
1879
- function mapCatchUp(raw) {
1880
- return {
1881
- id: raw.id,
1882
- suggestionTitle: raw.suggestion_title
1883
- };
1884
- }
1885
- function transformTodos(rawData) {
1886
- return rawData.map((todo) => ({
1887
- id: todo.id,
1888
- body: todo.body,
1889
- dueAt: todo.due_at,
1890
- completedAt: todo.completed_at,
1891
- createdAt: todo.created_at,
1892
- contactId: todo.contact?.id ?? null,
1893
- contactName: todo.contact ? `${todo.contact.first_name} ${todo.contact.last_name}` : null
1894
- }));
1895
- }
1896
- function formatActivityType(slug) {
1897
- return slug.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
1898
- }
1899
- function getActivityUserName(contact, visitor) {
1900
- if (contact?.full_name) return contact.full_name;
1901
- if (contact?.first_name && contact?.last_name) return `${contact.first_name} ${contact.last_name}`;
1902
- if (visitor?.city && visitor?.state) return `Visitor from ${visitor.city}, ${visitor.state}`;
1903
- return "Unknown Visitor";
1904
- }
1905
- function transformActivities(rawData) {
1906
- const itemsObj = rawData[1];
1907
- if (!itemsObj?.items) return [];
1908
- return itemsObj.items.map((activity) => ({
1909
- id: activity.id,
1910
- userName: getActivityUserName(activity.contact, activity.visitor),
1911
- avatarUrl: activity.contact?.avatar_url ?? null,
1912
- activityType: formatActivityType(activity.slug),
1913
- targetName: activity.description || activity.title,
1914
- timestamp: activity.created_at,
1915
- slug: activity.slug
1916
- })).sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
1917
- }
1918
- function formatLegacyPointsDescription(ledger) {
1919
- if (ledger.metadata?.transaction_type) return ledger.metadata.transaction_type.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
1920
- if (ledger.metadata?.source?.reason) return ledger.metadata.source.reason;
1921
- return `Transaction ${new Date(ledger.created_at).toLocaleDateString("en-US", {
1922
- month: "long",
1923
- day: "numeric"
1924
- })}`;
1925
- }
1926
- function transformLegacyPointsLedger(data) {
1927
- const sorted = [...data.points_ledgers].sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
1928
- return {
1929
- balance: sorted[0]?.total_balance ?? 0,
1930
- entries: sorted.map((ledger) => ({
1931
- id: ledger.id,
1932
- description: formatLegacyPointsDescription(ledger),
1933
- amount: ledger.amount,
1934
- createdAt: ledger.created_at
1935
- }))
1936
- };
1937
- }
1938
- function createLegacyWidgetsApiAdapter(config) {
1939
- function buildHeaders() {
1940
- return {
1941
- "content-type": "application/json",
1942
- ...config.getApiHeaders?.()
1943
- };
1944
- }
1945
- function prefix(path) {
1946
- return `${config.baseUrl ?? ""}${path}`;
1947
- }
1948
- return {
1949
- async fetchCalendarEvents(signal) {
1950
- const response = await fetch(prefix("/events.json?event_timeline=upcoming"), {
1951
- headers: buildHeaders(),
1952
- signal
1953
- });
1954
- if (!response.ok) throw new Error(`Failed to fetch calendar events: ${response.status}`);
1955
- return (await response.json()).map(mapCalendarEvent);
1956
- },
1957
- async fetchTodos(signal) {
1958
- const response = await fetch(prefix("/tasks"), {
1959
- headers: buildHeaders(),
1960
- signal
1961
- });
1962
- if (!response.ok) throw new Error(`Failed to fetch todos: ${response.status}`);
1963
- return transformTodos(await response.json());
1964
- },
1965
- async updateTodo(id, completed) {
1966
- const response = await fetch(prefix(`/tasks/${id}`), {
1967
- method: "PATCH",
1968
- headers: buildHeaders(),
1969
- body: JSON.stringify({ task: { completed_at: completed ? (/* @__PURE__ */ new Date()).toISOString() : null } })
1970
- });
1971
- if (!response.ok) throw new Error(`Failed to update todo: ${response.status}`);
1972
- const [transformed] = transformTodos([await response.json()]);
1973
- if (!transformed) throw new Error("Failed to update todo: empty response");
1974
- return transformed;
1975
- },
1976
- async fetchActivities(signal) {
1977
- const response = await fetch(prefix("/v1.1/activities.json"), {
1978
- headers: buildHeaders(),
1979
- signal
1980
- });
1981
- if (!response.ok) throw new Error(`Failed to fetch activities: ${response.status}`);
1982
- return transformActivities(await response.json());
1983
- },
1984
- async fetchCatchUps(signal) {
1985
- const response = await fetch(prefix("/affiliate_catch_up_actions.json"), {
1986
- headers: buildHeaders(),
1987
- signal
1988
- });
1989
- if (!response.ok) throw new Error(`Failed to fetch catch ups: ${response.status}`);
1990
- return (await response.json()).map(mapCatchUp);
1991
- },
1992
- async fetchMySite(signal) {
1993
- const response = await fetch(prefix("/me"), {
1994
- headers: buildHeaders(),
1995
- signal
1996
- });
1997
- if (!response.ok) throw new Error(`Failed to fetch MySite data: ${response.status}`);
1998
- const data = await response.json();
1999
- return {
2000
- url: data.mysite_url ?? null,
2001
- views: data.mysite_views ?? 0,
2002
- leads: data.mysite_leads ?? 0,
2003
- userName: data.name || data.first_name || "User"
2004
- };
2005
- },
2006
- async fetchPointsLedger(customerId, signal) {
2007
- const response = await fetch(prefix(`/v202506/customers/${customerId}/points_ledgers?page=1&per_page=100&sort_by=created_at&sort_dir=desc`), {
2008
- headers: buildHeaders(),
2009
- signal
2010
- });
2011
- if (!response.ok) throw new Error(`Failed to fetch points ledger: ${response.status}`);
2012
- return transformLegacyPointsLedger(await response.json());
2013
- }
2014
- };
2015
- }
2016
- function createPortalWidgetsApiAdapter(client, legacyConfig) {
2017
- const bff = createBffWidgetsAdapter(client);
2018
- return {
2019
- ...createLegacyWidgetsApiAdapter(legacyConfig),
2020
- ...bff
2021
- };
2022
- }
2023
- //#endregion
2024
- //#region src/widgets/PortalWidgetsApiProvider.tsx
2025
- function PortalWidgetsApiProvider({ baseUrl, getApiHeaders, children }) {
2026
- const client = require_PortalTenantClientProvider.usePortalTenantClient();
2027
- const getApiHeadersRef = (0, react.useRef)(getApiHeaders);
2028
- getApiHeadersRef.current = getApiHeaders;
2029
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_error_state.WidgetsApiProvider, {
2030
- value: (0, react.useMemo)(() => createPortalWidgetsApiAdapter(client, {
2031
- baseUrl,
2032
- getApiHeaders: () => getApiHeadersRef.current?.() ?? {}
2033
- }), [client, baseUrl]),
2034
- children
2035
- });
2036
- }
2037
- //#endregion
2038
- //#region ../core/src/widget-utils/utils.ts
2039
- function createWidgetRegistry(registry, plugins) {
2040
- if (!plugins || plugins.length === 0) return registry;
2041
- const pluginEntries = Object.fromEntries(plugins.map((p) => [p.type, p.component]));
2042
- return {
2043
- ...registry,
2044
- ...pluginEntries
2045
- };
2046
- }
2047
- function createScreen(registry, widgets) {
2048
- widgets.forEach((widget) => {
2049
- if (!(widget.type in registry)) throw new Error(`Widget type "${String(widget.type)}" not found in registry`);
2050
- });
2051
- return widgets;
2052
- }
2053
- function createWidgetFromShareable(item) {
2054
- if ((item.kind === "video" || !!item.videoUrl) && item.videoUrl) return {
2055
- type: "VideoWidget",
2056
- props: {
2057
- src: item.videoUrl,
2058
- poster: item.imageUrl,
2059
- caption: item.title
2060
- }
2061
- };
2062
- return {
2063
- type: "ImageWidget",
2064
- props: {
2065
- src: item.imageUrl,
2066
- alt: item.title || "Image",
2067
- objectFit: "cover"
2068
- }
2069
- };
2070
- }
2071
- //#endregion
2072
- //#region ../widgets/src/widgets/index.ts
2073
- const widgetPropertySchemas = {
2074
- AlertWidget: () => Promise.resolve().then(() => require("./AlertWidget-BZ67Uqfh.cjs")).then((n) => n.AlertWidget_exports).then((m) => m.alertWidgetPropertySchema),
2075
- BulletListWidget: () => Promise.resolve().then(() => require("./BulletListWidget-iGJI33Ed.cjs")).then((n) => n.BulletListWidget_exports).then((m) => m.bulletListWidgetPropertySchema),
2076
- CalendarWidget: () => Promise.resolve().then(() => require("./CalendarWidget-C4Dv_TUk.cjs")).then((n) => n.CalendarWidget_exports).then((m) => m.calendarWidgetPropertySchema),
2077
- CardWidget: () => Promise.resolve().then(() => require("./CardWidget-BQl-8Xrt.cjs")).then((m) => m.cardWidgetPropertySchema),
2078
- CarouselWidget: () => Promise.resolve().then(() => require("./CarouselWidget-Cu1b3ERq.cjs")).then((n) => n.CarouselWidget_exports).then((m) => m.carouselWidgetPropertySchema),
2079
- CatchUpWidget: () => Promise.resolve().then(() => require("./CatchUpWidget-BzgybvuC.cjs")).then((n) => n.CatchUpWidget_exports).then((m) => m.catchUpWidgetPropertySchema),
2080
- ChartWidget: () => Promise.resolve().then(() => require("./ChartWidget-BxM5urU7.cjs")).then((m) => m.chartWidgetPropertySchema),
2081
- ContainerWidget: () => Promise.resolve().then(() => require("./ContainerWidget-CDbB8c0E.cjs")).then((m) => m.containerWidgetPropertySchema),
2082
- EmbedWidget: () => Promise.resolve().then(() => require("./EmbedWidget-DgbCzBA4.cjs")).then((n) => n.EmbedWidget_exports).then((m) => m.embedWidgetPropertySchema),
2083
- ImageWidget: () => Promise.resolve().then(() => require("./ImageWidget-CbQVxMe3.cjs")).then((n) => n.ImageWidget_exports).then((m) => m.imageWidgetPropertySchema),
2084
- LayoutWidget: () => Promise.resolve().then(() => require("./LayoutWidget-DKqZgCMu.cjs")).then((m) => m.layoutWidgetPropertySchema),
2085
- LinkWidget: () => Promise.resolve().then(() => require("./LinkWidget-M9YzMJT8.cjs")).then((m) => m.linkWidgetPropertySchema),
2086
- ListWidget: () => Promise.resolve().then(() => require("./ListWidget-CuSjvwEw.cjs")).then((m) => m.listWidgetPropertySchema),
2087
- MySiteWidget: () => Promise.resolve().then(() => require("./MySiteWidget-CYiH2lmX.cjs")).then((n) => n.MySiteWidget_exports).then((m) => m.mySiteWidgetPropertySchema),
2088
- NestedWidget: () => Promise.resolve().then(() => require("./NestedWidget-CMCZjV6t.cjs")).then((m) => m.nestedWidgetPropertySchema),
2089
- PointsWidget: () => Promise.resolve().then(() => require("./PointsWidget-D1FV8l1h.cjs")).then((n) => n.PointsWidget_exports).then((m) => m.pointsWidgetPropertySchema),
2090
- QuickLinksWidget: () => Promise.resolve().then(() => require("./QuickLinksWidget-DBH-HRvz.cjs")).then((n) => n.QuickLinksWidget_exports).then((m) => m.quickLinksWidgetPropertySchema),
2091
- QuickShareWidget: () => Promise.resolve().then(() => require("./QuickShareWidget-Btoe8CyN.cjs")).then((n) => n.QuickShareWidget_exports).then((m) => m.quickShareWidgetPropertySchema),
2092
- RecentActivityWidget: () => Promise.resolve().then(() => require("./RecentActivityWidget-DNyhUZNs.cjs")).then((n) => n.RecentActivityWidget_exports).then((m) => m.recentActivityWidgetPropertySchema),
2093
- SeparatorWidget: () => Promise.resolve().then(() => require("./SeparatorWidget-BCbzDxnz.cjs")).then((n) => n.SeparatorWidget_exports).then((m) => m.separatorWidgetPropertySchema),
2094
- SpacerWidget: () => Promise.resolve().then(() => require("./SpacerWidget-CI3to-88.cjs")).then((n) => n.SpacerWidget_exports).then((m) => m.spacerWidgetPropertySchema),
2095
- TableWidget: () => Promise.resolve().then(() => require("./TableWidget-C--8TSX7.cjs")).then((m) => m.tableWidgetPropertySchema),
2096
- TextWidget: () => Promise.resolve().then(() => require("./TextWidget-C7oY0X3r.cjs")).then((n) => n.TextWidget_exports).then((m) => m.textWidgetPropertySchema),
2097
- ToDoWidget: () => Promise.resolve().then(() => require("./ToDoWidget-mSGQgnu3.cjs")).then((m) => m.toDoWidgetPropertySchema),
2098
- VideoWidget: () => Promise.resolve().then(() => require("./VideoWidget-CDcV0J5W.cjs")).then((n) => n.VideoWidget_exports).then((m) => m.videoWidgetPropertySchema)
2099
- };
2100
- //#endregion
2101
- //#region src/core/default-widget-registry.ts
2102
- const DEFAULT_SDK_WIDGET_REGISTRY = createWidgetRegistry({
2103
- AlertWidget: require_AlertWidget.AlertWidget,
2104
- BulletListWidget: require_BulletListWidget.BulletListWidget,
2105
- CalendarWidget: require_CalendarWidget.CalendarWidget,
2106
- CardWidget: require_CardWidget.CardWidget,
2107
- CarouselWidget: require_CarouselWidget.CarouselWidget,
2108
- CatchUpWidget: require_CatchUpWidget.CatchUpWidget,
2109
- ChartWidget: require_ChartWidget.ChartWidget,
2110
- ContainerWidget: require_ContainerWidget.ContainerWidget,
2111
- EmbedWidget: require_EmbedWidget.EmbedWidget,
2112
- ImageWidget: require_ImageWidget.ImageWidget,
2113
- LayoutWidget: require_LayoutWidget.LayoutWidget,
2114
- LinkWidget: require_LinkWidget.LinkWidget,
2115
- ListWidget: require_ListWidget.ListWidget,
2116
- MySiteWidget: require_MySiteWidget.MySiteWidget,
2117
- NestedWidget: require_NestedWidget.NestedWidget,
2118
- PointsWidget: require_PointsWidget.PointsWidget,
2119
- QuickLinksWidget: require_QuickLinksWidget.QuickLinksWidget,
2120
- QuickShareWidget: require_QuickShareWidget.QuickShareWidget,
2121
- RecentActivityWidget: require_RecentActivityWidget.RecentActivityWidget,
2122
- SeparatorWidget: require_SeparatorWidget.SeparatorWidget,
2123
- SpacerWidget: require_SpacerWidget.SpacerWidget,
2124
- TableWidget: require_TableWidget.TableWidget,
2125
- TextWidget: require_TextWidget.TextWidget,
2126
- ToDoWidget: require_ToDoWidget.ToDoWidget,
2127
- VideoWidget: require_VideoWidget.VideoWidget
2128
- });
2129
- //#endregion
2130
- //#region src/hooks/use-portal-active-locale.ts
2131
- const STORAGE_KEY = "portal-language";
2132
- const SUPPORTED_LANGUAGES = [
2133
- {
2134
- id: 1,
2135
- iso: "en",
2136
- name: "English"
2137
- },
2138
- {
2139
- id: 2,
2140
- iso: "es",
2141
- name: "Español (Spanish)"
2142
- },
2143
- {
2144
- id: 3,
2145
- iso: "pt",
2146
- name: "Português (Portuguese)"
2147
- },
2148
- {
2149
- id: 4,
2150
- iso: "fr",
2151
- name: "Français (French)"
2152
- },
2153
- {
2154
- id: 5,
2155
- iso: "de",
2156
- name: "Deutsch (German)"
2157
- },
2158
- {
2159
- id: 6,
2160
- iso: "it",
2161
- name: "Italiano (Italian)"
2162
- },
2163
- {
2164
- id: 7,
2165
- iso: "nl",
2166
- name: "Nederlands (Dutch)"
2167
- },
2168
- {
2169
- id: 8,
2170
- iso: "pl",
2171
- name: "Polski (Polish)"
2172
- },
2173
- {
2174
- id: 9,
2175
- iso: "hu",
2176
- name: "Magyar (Hungarian)"
2177
- },
2178
- {
2179
- id: 10,
2180
- iso: "id",
2181
- name: "Bahasa Indonesia (Indonesian)"
2182
- },
2183
- {
2184
- id: 11,
2185
- iso: "ja",
2186
- name: "日本語 (Japanese)"
2187
- },
2188
- {
2189
- id: 12,
2190
- iso: "ko",
2191
- name: "한국어 (Korean)"
2192
- },
2193
- {
2194
- id: 13,
2195
- iso: "ru",
2196
- name: "Русский (Russian)"
2197
- },
2198
- {
2199
- id: 14,
2200
- iso: "el",
2201
- name: "Ελληνικά (Greek)"
2202
- },
2203
- {
2204
- id: 15,
2205
- iso: "ro",
2206
- name: "Română (Romanian)"
2207
- },
2208
- {
2209
- id: 16,
2210
- iso: "tr",
2211
- name: "Türkçe (Turkish)"
2212
- },
2213
- {
2214
- id: 17,
2215
- iso: "he",
2216
- name: "עברית (Hebrew)"
2217
- },
2218
- {
2219
- id: 18,
2220
- iso: "tl",
2221
- name: "Tagalog"
2222
- },
2223
- {
2224
- id: 19,
2225
- iso: "th",
2226
- name: "ไทย (Thai)"
2227
- },
2228
- {
2229
- id: 20,
2230
- iso: "zh_CN",
2231
- name: "简体中文 (Chinese - Simplified)"
2232
- },
2233
- {
2234
- id: 21,
2235
- iso: "zh_TW",
2236
- name: "繁體中文 (Chinese - Traditional)"
2237
- }
2238
- ];
2239
- const SUPPORTED_CODES = SUPPORTED_LANGUAGES.map((l) => l.iso);
2240
- function getPersistedLocale() {
2241
- try {
2242
- return localStorage.getItem(STORAGE_KEY);
2243
- } catch {
2244
- return null;
2245
- }
2246
- }
2247
- function persistLocale(locale) {
2248
- try {
2249
- localStorage.setItem(STORAGE_KEY, locale);
2250
- } catch {}
2251
- }
2252
- function getBrowserLocale() {
2253
- if (typeof navigator === "undefined") return "en";
2254
- return navigator.language.replace(/-/g, "_");
2255
- }
2256
- function getOptimisticLocale() {
2257
- const persisted = getPersistedLocale();
2258
- if (persisted && SUPPORTED_CODES.includes(persisted)) return persisted;
2259
- return resolveLocale(SUPPORTED_CODES);
2260
- }
2261
- function resolveLocale(supportedCodes) {
2262
- const persisted = getPersistedLocale();
2263
- if (persisted && supportedCodes.includes(persisted)) return persisted;
2264
- const browser = getBrowserLocale();
2265
- if (supportedCodes.includes(browser)) return browser;
2266
- const browserLang = browser.split("_")[0];
2267
- const match = supportedCodes.find((c) => c === browserLang || c.startsWith(`${browserLang}_`));
2268
- if (match) return match;
2269
- return supportedCodes[0] ?? "en";
2270
- }
2271
- //#endregion
2272
- //#region src/providers/FluidProvider.tsx
2273
- /**
2274
- * Main Fluid SDK Provider
2275
- * Wraps QueryClientProvider and FluidThemeProvider
2276
- */
2277
- const FluidContext = (0, react.createContext)(null);
2278
- /**
2279
- * Main provider for the Fluid Portal SDK
2280
- *
2281
- * @example
2282
- * ```tsx
2283
- * import { FluidProvider } from "@fluid-app/portal-sdk";
2284
- *
2285
- * function App() {
2286
- * return (
2287
- * <FluidProvider
2288
- * config={{ baseUrl: "" }}
2289
- * >
2290
- * <YourApp />
2291
- * </FluidProvider>
2292
- * );
2293
- * }
2294
- * ```
2295
- */
2296
- function FluidProvider({ config, children, queryClient, initialTheme, themeContainer, widgetRegistry, variables }) {
2297
- const defaultQueryClient = (0, react.useMemo)(() => {
2298
- return new _tanstack_react_query.QueryClient({ defaultOptions: { queries: {
2299
- staleTime: 1e3 * 60,
2300
- retry: 1,
2301
- persister: (typeof window !== "undefined" && !{}.env?.DEV ? createPersister() : void 0)?.persisterFn,
2302
- refetchOnWindowFocus: false
2303
- } } });
2304
- }, []);
2305
- const configRef = (0, react.useRef)(config);
2306
- configRef.current = config;
2307
- const csrfToken = typeof document !== "undefined" ? document.querySelector("meta[name=\"csrf-token\"]")?.getAttribute("content") : null;
2308
- const portalTenantClient = (0, react.useMemo)(() => createFetchClient({
2309
- baseUrl: configRef.current.baseUrl,
2310
- onAuthError: () => configRef.current.onAuthError?.(),
2311
- credentials: "include",
2312
- defaultHeaders: { ...csrfToken ? { "X-CSRF-Token": csrfToken } : {} }
2313
- }), [config.baseUrl, csrfToken]);
2314
- const portalTenantContentClient = (0, react.useMemo)(() => createFetchClient({
2315
- baseUrl: configRef.current.baseUrl,
2316
- onAuthError: () => configRef.current.onAuthError?.(),
2317
- credentials: "include",
2318
- defaultHeaders: { ...csrfToken ? { "X-CSRF-Token": csrfToken } : {} }
2319
- }), [config.baseUrl, csrfToken]);
2320
- const dataSourceApi = (0, react.useMemo)(() => createDataSourceApiAdapter(portalTenantClient, portalTenantContentClient), [portalTenantClient, portalTenantContentClient]);
2321
- const appDefinitionApi = (0, react.useMemo)(() => createAppDefinitionApiAdapter(portalTenantClient), [portalTenantClient]);
2322
- const accountApi = (0, react.useMemo)(() => createAccountApiAdapter(portalTenantClient), [portalTenantClient]);
2323
- const storeApi = (0, react.useMemo)(() => createStoreApiAdapter(portalTenantClient), [portalTenantClient]);
2324
- const payApi = (0, react.useMemo)(() => createPortalTenantPayAdapter(portalTenantClient), [portalTenantClient]);
2325
- const countriesApi = (0, react.useMemo)(() => createCountriesApiAdapter(portalTenantClient), [portalTenantClient]);
2326
- const languagesApi = (0, react.useMemo)(() => createLanguagesApiAdapter(portalTenantClient), [portalTenantClient]);
2327
- const mysiteApi = (0, react.useMemo)(() => createMySiteApiAdapter(portalTenantClient), [portalTenantClient]);
2328
- const contextValue = (0, react.useMemo)(() => ({ config }), [config.baseUrl]);
2329
- const getApiHeaders = (0, react.useCallback)(() => {
2330
- return { "Content-Type": "application/json" };
2331
- }, []);
2332
- const dataSourceBaseUrl = (0, react.useMemo)(() => {
2333
- const base = config.baseUrl.replace(/\/+$/, "");
2334
- return base.endsWith("/api") ? base : `${base}/api`;
2335
- }, [config.baseUrl]);
2336
- const effectiveVariables = variables;
2337
- const themeProviderProps = {
2338
- ...initialTheme !== void 0 && { initialTheme },
2339
- ...themeContainer !== void 0 && { container: themeContainer }
2340
- };
2341
- const registry = widgetRegistry ?? DEFAULT_SDK_WIDGET_REGISTRY;
2342
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tanstack_react_query.QueryClientProvider, {
2343
- client: queryClient ?? defaultQueryClient,
2344
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FluidContext.Provider, {
2345
- value: contextValue,
2346
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PortalTenantClientProvider.PortalTenantClientProvider, {
2347
- value: portalTenantClient,
2348
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppDefinitionApiProvider, {
2349
- value: appDefinitionApi,
2350
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_account_api_context.AccountApiProvider, {
2351
- value: accountApi,
2352
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_store_api_context.StoreApiProvider, {
2353
- value: storeApi,
2354
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_pay_api_context.PayApiProvider, {
2355
- value: payApi,
2356
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_countries_api_context.CountriesApiProvider, {
2357
- value: countriesApi,
2358
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguagesApiProvider, {
2359
- value: languagesApi,
2360
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalLocaleProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_mysite_api_context.MySiteApiProvider, {
2361
- value: mysiteApi,
2362
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ScreenRenderer.DataSourceApiProvider, {
2363
- value: dataSourceApi,
2364
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderStack, {
2365
- baseUrl: dataSourceBaseUrl,
2366
- getApiHeaders,
2367
- variables: effectiveVariables,
2368
- registry,
2369
- themeProviderProps,
2370
- children
2371
- })
2372
- })
2373
- }) })
2374
- })
2375
- })
2376
- })
2377
- })
2378
- })
2379
- })
2380
- })
2381
- })
2382
- });
2383
- }
2384
- /**
2385
- * Inner component that sets up data source providers and theme.
2386
- * Must be rendered inside FluidContext.Provider + QueryClientProvider.
2387
- */
2388
- function ProviderStack({ baseUrl, getApiHeaders, variables, registry, themeProviderProps, children }) {
2389
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_registry_context.DataSourceRegistryProvider, {
2390
- baseUrl,
2391
- getApiHeaders,
2392
- variables,
2393
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalWidgetsApiProvider, {
2394
- baseUrl,
2395
- getApiHeaders,
2396
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ScreenRenderer.RegistryProvider, {
2397
- registry,
2398
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FluidThemeProvider, {
2399
- ...themeProviderProps,
2400
- children
2401
- })
2402
- })
2403
- })
2404
- });
2405
- }
2406
- function PortalLocaleProvider({ children }) {
2407
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LocaleProvider, {
2408
- initialLocale: getOptimisticLocale(),
2409
- onLocaleChange: persistLocale,
2410
- children
2411
- });
2412
- }
2413
- /**
2414
- * Hook to access the Fluid context
2415
- * Must be used within a FluidProvider
2416
- */
2417
- function useFluidContext() {
2418
- const context = (0, react.useContext)(FluidContext);
2419
- if (!context) throw new Error("useFluidContext must be used within a FluidProvider");
2420
- return context;
2421
- }
2422
- //#endregion
2423
- Object.defineProperty(exports, "ApiError", {
2424
- enumerable: true,
2425
- get: function() {
2426
- return ApiError;
2427
- }
2428
- });
2429
- Object.defineProperty(exports, "DEFAULT_SDK_WIDGET_REGISTRY", {
2430
- enumerable: true,
2431
- get: function() {
2432
- return DEFAULT_SDK_WIDGET_REGISTRY;
2433
- }
2434
- });
2435
- Object.defineProperty(exports, "FluidProvider", {
2436
- enumerable: true,
2437
- get: function() {
2438
- return FluidProvider;
2439
- }
2440
- });
2441
- Object.defineProperty(exports, "FluidThemeProvider", {
2442
- enumerable: true,
2443
- get: function() {
2444
- return FluidThemeProvider;
2445
- }
2446
- });
2447
- Object.defineProperty(exports, "SUPPORTED_LANGUAGES", {
2448
- enumerable: true,
2449
- get: function() {
2450
- return SUPPORTED_LANGUAGES;
2451
- }
2452
- });
2453
- Object.defineProperty(exports, "createPersister", {
2454
- enumerable: true,
2455
- get: function() {
2456
- return createPersister;
2457
- }
2458
- });
2459
- Object.defineProperty(exports, "createScreen", {
2460
- enumerable: true,
2461
- get: function() {
2462
- return createScreen;
2463
- }
2464
- });
2465
- Object.defineProperty(exports, "createWidgetFromShareable", {
2466
- enumerable: true,
2467
- get: function() {
2468
- return createWidgetFromShareable;
2469
- }
2470
- });
2471
- Object.defineProperty(exports, "createWidgetRegistry", {
2472
- enumerable: true,
2473
- get: function() {
2474
- return createWidgetRegistry;
2475
- }
2476
- });
2477
- Object.defineProperty(exports, "deleteDatabase", {
2478
- enumerable: true,
2479
- get: function() {
2480
- return deleteDatabase;
2481
- }
2482
- });
2483
- Object.defineProperty(exports, "useActiveLocale", {
2484
- enumerable: true,
2485
- get: function() {
2486
- return useActiveLocale;
2487
- }
2488
- });
2489
- Object.defineProperty(exports, "useAppDefinitionApi", {
2490
- enumerable: true,
2491
- get: function() {
2492
- return useAppDefinitionApi;
2493
- }
2494
- });
2495
- Object.defineProperty(exports, "useFluidContext", {
2496
- enumerable: true,
2497
- get: function() {
2498
- return useFluidContext;
2499
- }
2500
- });
2501
- Object.defineProperty(exports, "useLanguagesApi", {
2502
- enumerable: true,
2503
- get: function() {
2504
- return useLanguagesApi;
2505
- }
2506
- });
2507
- Object.defineProperty(exports, "useThemeContext", {
2508
- enumerable: true,
2509
- get: function() {
2510
- return useThemeContext;
2511
- }
2512
- });
2513
- Object.defineProperty(exports, "widgetPropertySchemas", {
2514
- enumerable: true,
2515
- get: function() {
2516
- return widgetPropertySchemas;
2517
- }
2518
- });
2519
-
2520
- //# sourceMappingURL=FluidProvider-DprqXNu4.cjs.map