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