@fluid-app/portal-sdk 0.1.131 → 0.1.133
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/{AlertWidget-WQ_XPDRo.mjs → AlertWidget-BYbcGyNr.mjs} +3 -3
- package/dist/{AlertWidget-WQ_XPDRo.mjs.map → AlertWidget-BYbcGyNr.mjs.map} +1 -1
- package/dist/{AppDownloadScreen-zNP4k8ht.cjs → AppDownloadScreen-B-i6Rydi.cjs} +1 -1
- package/dist/{AppDownloadScreen-BOfG3cqC.mjs → AppDownloadScreen-BpExiJat.mjs} +3 -3
- package/dist/{AppDownloadScreen-BOfG3cqC.mjs.map → AppDownloadScreen-BpExiJat.mjs.map} +1 -1
- package/dist/{AppDownloadScreen-BjCtTMPU.cjs → AppDownloadScreen-CIqSvpV0.cjs} +1 -1
- package/dist/{AppDownloadScreen-BjCtTMPU.cjs.map → AppDownloadScreen-CIqSvpV0.cjs.map} +1 -1
- package/dist/{BulletListWidget-BYcaQnVH.mjs → BulletListWidget-Bo5Kj1W-.mjs} +2 -2
- package/dist/{BulletListWidget-BYcaQnVH.mjs.map → BulletListWidget-Bo5Kj1W-.mjs.map} +1 -1
- package/dist/{CalendarWidget-Qb-utCFD.mjs → CalendarWidget-CCsceh_0.mjs} +2 -2
- package/dist/{CalendarWidget-Qb-utCFD.mjs.map → CalendarWidget-CCsceh_0.mjs.map} +1 -1
- package/dist/{CardWidget-zVxobZDH.mjs → CardWidget-BkOMSBQ-.mjs} +2 -2
- package/dist/{CardWidget-zVxobZDH.mjs.map → CardWidget-BkOMSBQ-.mjs.map} +1 -1
- package/dist/{CarouselWidget-dpRCljEx.mjs → CarouselWidget-B9LsTYUF.mjs} +2 -2
- package/dist/{CarouselWidget-dpRCljEx.mjs.map → CarouselWidget-B9LsTYUF.mjs.map} +1 -1
- package/dist/{CatchUpWidget-CSIXsR82.mjs → CatchUpWidget-CSJdJgs-.mjs} +2 -2
- package/dist/{CatchUpWidget-CSIXsR82.mjs.map → CatchUpWidget-CSJdJgs-.mjs.map} +1 -1
- package/dist/{ChartWidget-88hpX7ft.mjs → ChartWidget-Cpzqi6W4.mjs} +2 -2
- package/dist/{ChartWidget-88hpX7ft.mjs.map → ChartWidget-Cpzqi6W4.mjs.map} +1 -1
- package/dist/{ContactsScreen-BvoMicyB.mjs → ContactsScreen-BRmYDosJ.mjs} +5 -5
- package/dist/{ContactsScreen-BvoMicyB.mjs.map → ContactsScreen-BRmYDosJ.mjs.map} +1 -1
- package/dist/{ContainerWidget-DNS7ynby.mjs → ContainerWidget-DTchKDKw.mjs} +3 -3
- package/dist/{ContainerWidget-DNS7ynby.mjs.map → ContainerWidget-DTchKDKw.mjs.map} +1 -1
- package/dist/{CustomersScreen-xAauAB-B.mjs → CustomersScreen-Cnn-Wcza.mjs} +2 -2
- package/dist/{CustomersScreen-xAauAB-B.mjs.map → CustomersScreen-Cnn-Wcza.mjs.map} +1 -1
- package/dist/{EmbedWidget-BQYixJLj.mjs → EmbedWidget-Du9DMpSo.mjs} +2 -2
- package/dist/{EmbedWidget-BQYixJLj.mjs.map → EmbedWidget-Du9DMpSo.mjs.map} +1 -1
- package/dist/{FluidProvider-B-f_JVal.mjs → FluidProvider-BUdNsR8f.mjs} +49 -49
- package/dist/{FluidProvider-B-f_JVal.mjs.map → FluidProvider-BUdNsR8f.mjs.map} +1 -1
- package/dist/FluidProvider-CQoQjYxU.cjs.map +1 -1
- package/dist/{ImageWidget-DE9Fp_oH.mjs → ImageWidget-B1Mx3qKN.mjs} +2 -2
- package/dist/{ImageWidget-DE9Fp_oH.mjs.map → ImageWidget-B1Mx3qKN.mjs.map} +1 -1
- package/dist/{LayoutWidget-BFO_PHWw.mjs → LayoutWidget-Bgodl7eR.mjs} +2 -2
- package/dist/{LayoutWidget-BFO_PHWw.mjs.map → LayoutWidget-Bgodl7eR.mjs.map} +1 -1
- package/dist/{LinkWidget-JSoDi-ag.mjs → LinkWidget-B5PlWJHe.mjs} +2 -2
- package/dist/{LinkWidget-JSoDi-ag.mjs.map → LinkWidget-B5PlWJHe.mjs.map} +1 -1
- package/dist/{ListWidget-CBLZ8CjD.mjs → ListWidget-BWfsmVoc.mjs} +2 -2
- package/dist/{ListWidget-CBLZ8CjD.mjs.map → ListWidget-BWfsmVoc.mjs.map} +1 -1
- package/dist/{MessagingScreen-COWASb0E.mjs → MessagingScreen-CQwR5WA1.mjs} +9 -6
- package/dist/{MessagingScreen-COWASb0E.mjs.map → MessagingScreen-CQwR5WA1.mjs.map} +1 -1
- package/dist/{MySiteScreen-BasZFpx7.cjs → MySiteScreen-C00HjZdl.cjs} +1 -1
- package/dist/{MySiteScreen-B5-bV1-O.mjs → MySiteScreen-CcxWz0IH.mjs} +4 -4
- package/dist/{MySiteScreen-B5-bV1-O.mjs.map → MySiteScreen-CcxWz0IH.mjs.map} +1 -1
- package/dist/{MySiteScreen-DURa034X.cjs → MySiteScreen-D56qESn0.cjs} +1 -1
- package/dist/{MySiteScreen-DURa034X.cjs.map → MySiteScreen-D56qESn0.cjs.map} +1 -1
- package/dist/{MySiteWidget-BqtLSExC.mjs → MySiteWidget-mK0Mj3DS.mjs} +2 -2
- package/dist/{MySiteWidget-BqtLSExC.mjs.map → MySiteWidget-mK0Mj3DS.mjs.map} +1 -1
- package/dist/{NestedWidget-DIwW-wM7.mjs → NestedWidget-B6cUOyI3.mjs} +2 -2
- package/dist/{NestedWidget-DIwW-wM7.mjs.map → NestedWidget-B6cUOyI3.mjs.map} +1 -1
- package/dist/{OrdersScreen-BcFvAtJ_.mjs → OrdersScreen-CpOywVHJ.mjs} +4 -4
- package/dist/{OrdersScreen-BcFvAtJ_.mjs.map → OrdersScreen-CpOywVHJ.mjs.map} +1 -1
- package/dist/{PointsWidget-DgLGU995.mjs → PointsWidget-BlEzqgbK.mjs} +2 -2
- package/dist/{PointsWidget-DgLGU995.mjs.map → PointsWidget-BlEzqgbK.mjs.map} +1 -1
- package/dist/{ProductsScreen-Mu8doz5F.cjs → ProductsScreen-BPNdpsYm.cjs} +2 -2
- package/dist/{src-CMByt6YP.cjs → ProductsScreen-BY285fh-.cjs} +90 -31
- package/dist/ProductsScreen-BY285fh-.cjs.map +1 -0
- package/dist/ProductsScreen-DMldTDPg.mjs +42 -0
- package/dist/{src-DryOJTBW.mjs → ProductsScreen-jdy2j9_J.mjs} +86 -28
- package/dist/ProductsScreen-jdy2j9_J.mjs.map +1 -0
- package/dist/{ProfileScreen-CnQqdYBE.mjs → ProfileScreen-mAUuAFhe.mjs} +5 -5
- package/dist/{ProfileScreen-CnQqdYBE.mjs.map → ProfileScreen-mAUuAFhe.mjs.map} +1 -1
- package/dist/{QuickShareWidget-CajKauDa.mjs → QuickShareWidget-Lpox79Cq.mjs} +2 -2
- package/dist/{QuickShareWidget-CajKauDa.mjs.map → QuickShareWidget-Lpox79Cq.mjs.map} +1 -1
- package/dist/{RecentActivityWidget-BZYB21eR.mjs → RecentActivityWidget-BdPmAQq4.mjs} +2 -2
- package/dist/{RecentActivityWidget-BZYB21eR.mjs.map → RecentActivityWidget-BdPmAQq4.mjs.map} +1 -1
- package/dist/{SeparatorWidget-Lsd6juu7.mjs → SeparatorWidget-BS966Lk4.mjs} +2 -2
- package/dist/{SeparatorWidget-Lsd6juu7.mjs.map → SeparatorWidget-BS966Lk4.mjs.map} +1 -1
- package/dist/ShareablesScreen-B6tMQzuX.mjs +1314 -0
- package/dist/ShareablesScreen-B6tMQzuX.mjs.map +1 -0
- package/dist/{ShareablesScreen-oZhW2jGu.cjs → ShareablesScreen-DMBXIMMj.cjs} +2 -2
- package/dist/ShareablesScreen-d_ThfnNQ.mjs +42 -0
- package/dist/ShareablesScreen-znVUD_OK.cjs +1332 -0
- package/dist/ShareablesScreen-znVUD_OK.cjs.map +1 -0
- package/dist/{ShopScreen-B1UzSmK8.cjs → ShopScreen-BVIT_QS-.cjs} +6 -4
- package/dist/ShopScreen-BVIT_QS-.cjs.map +1 -0
- package/dist/{ShopScreen-7HWz_B6R.cjs → ShopScreen-Bsjdn-E9.cjs} +1 -1
- package/dist/{ShopScreen-D1N3RWm9.mjs → ShopScreen-C1bnhxpj.mjs} +9 -7
- package/dist/ShopScreen-C1bnhxpj.mjs.map +1 -0
- package/dist/{SpacerWidget-B3zkEePP.mjs → SpacerWidget-BimE1fjJ.mjs} +2 -2
- package/dist/{SpacerWidget-B3zkEePP.mjs.map → SpacerWidget-BimE1fjJ.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-Bw3xkq7t.mjs → SubscriptionsScreen-QHf54yD7.mjs} +5 -5
- package/dist/{SubscriptionsScreen-Bw3xkq7t.mjs.map → SubscriptionsScreen-QHf54yD7.mjs.map} +1 -1
- package/dist/{TableWidget-Xz0d4UH5.mjs → TableWidget-CfSqeNQj.mjs} +2 -2
- package/dist/{TableWidget-Xz0d4UH5.mjs.map → TableWidget-CfSqeNQj.mjs.map} +1 -1
- package/dist/{TextWidget-CzUlNmCl.mjs → TextWidget-DYpbUtQh.mjs} +2 -2
- package/dist/{TextWidget-CzUlNmCl.mjs.map → TextWidget-DYpbUtQh.mjs.map} +1 -1
- package/dist/{ToDoWidget-qyFLHU_o.mjs → ToDoWidget-DaxkgCEl.mjs} +2 -2
- package/dist/{ToDoWidget-qyFLHU_o.mjs.map → ToDoWidget-DaxkgCEl.mjs.map} +1 -1
- package/dist/{UpgradeScreen-CIiEjeTZ.cjs → UpgradeScreen--eiiE1rX.cjs} +1 -1
- package/dist/{UpgradeScreen-IaYxGm7M.cjs → UpgradeScreen-7on9GOgu.cjs} +1 -1
- package/dist/{UpgradeScreen-IaYxGm7M.cjs.map → UpgradeScreen-7on9GOgu.cjs.map} +1 -1
- package/dist/{UpgradeScreen-BZdJQxb9.mjs → UpgradeScreen-p7aAXWFM.mjs} +2 -2
- package/dist/{UpgradeScreen-BZdJQxb9.mjs.map → UpgradeScreen-p7aAXWFM.mjs.map} +1 -1
- package/dist/{VideoWidget-CpUPsOI7.mjs → VideoWidget-CHktk3hs.mjs} +2 -2
- package/dist/{VideoWidget-CpUPsOI7.mjs.map → VideoWidget-CHktk3hs.mjs.map} +1 -1
- package/dist/{dist-B1HwSrso.mjs → dist-CayuD99K.mjs} +1 -1
- package/dist/{dist-B1HwSrso.mjs.map → dist-CayuD99K.mjs.map} +1 -1
- package/dist/{es-BcjHf1ZX.mjs → es-CTLNkiWp.mjs} +38 -3
- package/dist/{es-BcjHf1ZX.mjs.map → es-CTLNkiWp.mjs.map} +1 -1
- package/dist/index.cjs +19 -19
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +70 -70
- package/dist/index.mjs.map +1 -1
- package/dist/{order-status-badge-OZ1InBwZ.mjs → order-status-badge-Bt2gMEPZ.mjs} +1 -1
- package/dist/{order-status-badge-OZ1InBwZ.mjs.map → order-status-badge-Bt2gMEPZ.mjs.map} +1 -1
- package/dist/{sortable.esm-DSrWP4x9.mjs → sortable.esm-BzPsVjTI.mjs} +1 -1
- package/dist/{sortable.esm-DSrWP4x9.mjs.map → sortable.esm-BzPsVjTI.mjs.map} +1 -1
- package/dist/{src-DIcd2_ex.cjs → src-C5GUPE_i.cjs} +37 -26
- package/dist/src-C5GUPE_i.cjs.map +1 -0
- package/dist/{src-k03GJfKt.mjs → src-DcIV4Mpe.mjs} +41 -30
- package/dist/src-DcIV4Mpe.mjs.map +1 -0
- package/dist/{use-account-clients-CZw8FqxD.mjs → use-account-clients-BjK5QVYl.mjs} +2 -2
- package/dist/{use-account-clients-CZw8FqxD.mjs.map → use-account-clients-BjK5QVYl.mjs.map} +1 -1
- package/dist/{use-current-user-C6af9r0B.mjs → use-current-user-BP_GJuQe.mjs} +3 -3
- package/dist/{use-current-user-C6af9r0B.mjs.map → use-current-user-BP_GJuQe.mjs.map} +1 -1
- package/dist/{use-fluid-api-R0Qybt_F.mjs → use-fluid-api-UtVBk6E-.mjs} +2 -2
- package/dist/{use-fluid-api-R0Qybt_F.mjs.map → use-fluid-api-UtVBk6E-.mjs.map} +1 -1
- package/dist/{use-fluid-auth-_pnjCu2c.mjs → use-fluid-auth-DrPeCmW-.mjs} +2 -2
- package/dist/{use-fluid-auth-_pnjCu2c.mjs.map → use-fluid-auth-DrPeCmW-.mjs.map} +1 -1
- package/dist/{use-portal-products-client-Bl-yd0Tl.cjs → use-portal-products-client-CIrRGIxC.cjs} +5 -14
- package/dist/use-portal-products-client-CIrRGIxC.cjs.map +1 -0
- package/dist/{use-portal-products-client-tJi4q54S.mjs → use-portal-products-client-dV5jIXpp.mjs} +6 -15
- package/dist/use-portal-products-client-dV5jIXpp.mjs.map +1 -0
- package/package.json +18 -18
- package/dist/MessagingScreen-CWm4iQnk.mjs +0 -38
- package/dist/ProductsScreen-BHeRiKUM.cjs +0 -101
- package/dist/ProductsScreen-BHeRiKUM.cjs.map +0 -1
- package/dist/ProductsScreen-C_1ghW3w.mjs +0 -42
- package/dist/ProductsScreen-DJOPzE9v.mjs +0 -89
- package/dist/ProductsScreen-DJOPzE9v.mjs.map +0 -1
- package/dist/ShareablesScreen-BSRbPf6u.cjs +0 -414
- package/dist/ShareablesScreen-BSRbPf6u.cjs.map +0 -1
- package/dist/ShareablesScreen-COyBtpDy.mjs +0 -42
- package/dist/ShareablesScreen-kBJFUklJ.mjs +0 -396
- package/dist/ShareablesScreen-kBJFUklJ.mjs.map +0 -1
- package/dist/ShopScreen-B1UzSmK8.cjs.map +0 -1
- package/dist/ShopScreen-D1N3RWm9.mjs.map +0 -1
- package/dist/chunk-ByhMGyNw.mjs +0 -37
- package/dist/src-CMByt6YP.cjs.map +0 -1
- package/dist/src-DIcd2_ex.cjs.map +0 -1
- package/dist/src-DryOJTBW.mjs.map +0 -1
- package/dist/src-k03GJfKt.mjs.map +0 -1
- package/dist/use-portal-products-client-Bl-yd0Tl.cjs.map +0 -1
- package/dist/use-portal-products-client-tJi4q54S.mjs.map +0 -1
- /package/dist/{src-DAC9DwXZ.mjs → src-6SxtfYk9.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _t as subscriptions_update, at as orders_show, dt as subscriptions_list, ft as subscriptions_pause, gt as subscriptions_skip, ht as subscriptions_show, it as orders_list, mt as subscriptions_resume, n as useFluidContext, nt as account_show, pt as subscriptions_reactivate, rt as account_update, u as usePortalTenantClient, ut as subscriptions_cancel, yt as createFetchClient } from "./FluidProvider-
|
|
1
|
+
import { _t as subscriptions_update, at as orders_show, dt as subscriptions_list, ft as subscriptions_pause, gt as subscriptions_skip, ht as subscriptions_show, it as orders_list, mt as subscriptions_resume, n as useFluidContext, nt as account_show, pt as subscriptions_reactivate, rt as account_update, u as usePortalTenantClient, ut as subscriptions_cancel, yt as createFetchClient } from "./FluidProvider-BUdNsR8f.mjs";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
//#region ../../subscriptions/api-client/src/portal-tenant-adapter.ts
|
|
4
4
|
/**
|
|
@@ -447,4 +447,4 @@ function useSdkClient() {
|
|
|
447
447
|
//#endregion
|
|
448
448
|
export { useSubscriptionsApiClient as a, useSdkClient as i, useOrdersApi as n, usePayApi as r, useAccountApi as t };
|
|
449
449
|
|
|
450
|
-
//# sourceMappingURL=use-account-clients-
|
|
450
|
+
//# sourceMappingURL=use-account-clients-BjK5QVYl.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-account-clients-CZw8FqxD.mjs","names":["mapMeta","portalTenant.subscriptions_list","portalTenant.subscriptions_show","portalTenant.subscriptions_pause","portalTenant.subscriptions_resume","portalTenant.subscriptions_skip","portalTenant.subscriptions_cancel","portalTenant.subscriptions_reactivate","portalTenant.subscriptions_update","portalTenant.orders_show","portalTenant.orders_list","portalTenant.account_show","portalTenant.account_update","portalTenantPay.addresses_list","portalTenantPay.addresses_create","portalTenantPay.addresses_update","portalTenantPay.addresses_destroy","portalTenantPay.payment_methods_list","portalTenantPay.payment_methods_create","portalTenantPay.payment_methods_update","portalTenantPay.payment_methods_destroy","portalTenantPay.payment_methods_vault_show","portalTenantPay.points_ledgers_list"],"sources":["../../../subscriptions/api-client/src/portal-tenant-adapter.ts","../../../orders/api-client/src/portal-tenant-adapter.ts","../src/adapters/orders-api-adapter.ts","../src/adapters/account-api-adapter.ts","../../../api-clients/portal-tenant-pay/src/namespaces/portal_tenant_pay.ts","../src/adapters/pay-api-adapter.ts","../src/account/use-account-clients.ts"],"sourcesContent":["import type { SubscriptionsApi } from \"@fluid-app/subscriptions-core\";\nimport type { FetchClient } from \"./lib/fetch-client\";\nimport type { subscriptions } from \"./custom/subscriptions\";\nimport { portalTenant } from \"@fluid-app/portal-tenant-api-client\";\n\n/**\n * Maps the BFF meta envelope to the port's expected shape.\n */\nfunction mapMeta(raw: { request_id?: string | null; timestamp?: string }): {\n request_id: string;\n timestamp: string;\n} {\n return {\n request_id: raw.request_id ?? \"\",\n timestamp: raw.timestamp ?? \"\",\n };\n}\n\ntype BffSubscriptionResponse = Awaited<\n ReturnType<typeof portalTenant.subscriptions_show>\n>;\n\ntype BffListResponse = Awaited<\n ReturnType<typeof portalTenant.subscriptions_list>\n>;\n\n/**\n * Maps a BFF subscription detail response to the port's SubscriptionDetail.\n *\n * The BFF returns a flat Subscription schema while the port expects a richly\n * nested SubscriptionDetailSubscription. Both represent the same underlying\n * data — the consuming portal UI only accesses the subset of fields the BFF\n * provides. The explicit field mapping ensures the envelope structure is\n * correct, while the subscription data passes through at runtime.\n */\nfunction mapSubscriptionDetail(\n response: BffSubscriptionResponse,\n): subscriptions.SubscriptionDetail {\n return {\n subscription: (response.subscription ??\n {}) as unknown as subscriptions.SubscriptionDetailSubscription,\n meta: response.meta ? mapMeta(response.meta) : undefined,\n };\n}\n\nfunction mapSubscriptionList(\n response: BffListResponse,\n): subscriptions.SubscriptionsResponse {\n return {\n subscriptions: (response.subscriptions ??\n []) as unknown as subscriptions.SubscriptionListItem[],\n meta: mapMeta(response.meta ?? {}),\n };\n}\n\n/**\n * Creates a SubscriptionsApi-compatible adapter backed by the portal-tenant BFF.\n *\n * Uses async/await with explicit field mapping. The BFF returns simplified\n * subscription types compared to the full admin API; the adapter maps the\n * response envelope and provides runtime defaults for optional fields.\n */\nexport function createPortalSubscriptionsAdapter(\n client: FetchClient,\n): SubscriptionsApi {\n return {\n fetchCustomerSubscriptions: async (\n params: subscriptions.FetchSubscriptionsParams,\n ) => {\n const response = await portalTenant.subscriptions_list(client, {\n \"page[cursor]\": params.cursor,\n \"page[limit]\": params.limit ?? params.perPage,\n });\n return mapSubscriptionList(response);\n },\n\n fetchSubscription: async (subscriptionToken: string) => {\n const response = await portalTenant.subscriptions_show(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n pauseSubscription: async (\n subscriptionToken: string,\n _params: subscriptions.PauseSubscriptionParams,\n ) => {\n const response = await portalTenant.subscriptions_pause(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n resumeSubscription: async (\n subscriptionToken: string,\n _params: subscriptions.ResumeSubscriptionParams,\n ) => {\n const response = await portalTenant.subscriptions_resume(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n skipSubscription: async (\n subscriptionToken: string,\n _params: subscriptions.SkipSubscriptionParams,\n ) => {\n const response = await portalTenant.subscriptions_skip(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n cancelSubscription: async (\n subscriptionToken: string,\n _customerId?: number,\n ) => {\n const response = await portalTenant.subscriptions_cancel(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n reactivateSubscription: async (\n subscriptionToken: string,\n _params: subscriptions.ReactivateSubscriptionParams,\n ) => {\n const response = await portalTenant.subscriptions_reactivate(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n updateSubscriptionInfo: async (\n subscriptionToken: string,\n body: Pick<subscriptions.UpdateSubscriptionInfoBody, \"payment_method_id\">,\n ) => {\n const response = await portalTenant.subscriptions_update(\n client,\n subscriptionToken,\n { subscription: { payment_method_id: body.payment_method_id } },\n );\n return mapSubscriptionDetail(response);\n },\n };\n}\n","import type { FetchClient } from \"./lib/fetch-client\";\nimport type { OrdersApi } from \"@fluid-app/orders-core\";\nimport type { orders } from \"@fluid-app/orders-core\";\nimport { portalTenant } from \"@fluid-app/portal-tenant-api-client\";\n\n/**\n * Creates an OrdersApi adapter backed by the portal-tenant BFF.\n *\n * Maps the generated portal-tenant namespace functions to the abstract\n * OrdersApi port, closing over the FetchClient so consumers don't need\n * to pass it per-call.\n */\n\nfunction mapOrder(\n raw: NonNullable<\n Awaited<ReturnType<typeof portalTenant.orders_show>>[\"order\"]\n >,\n): orders.PortalTenantOrder {\n return {\n id: raw.id ?? 0,\n token: raw.token ?? \"\",\n status: (raw.status ?? \"pending\") as orders.PortalTenantOrderStatus,\n total: raw.total ?? \"0\",\n currency: raw.currency ?? \"\",\n line_items: (raw.line_items ?? []).map((li) => ({\n id: li.id ?? 0,\n product_id: li.product_id ?? 0,\n product_name: li.product_name ?? \"\",\n quantity: li.quantity ?? 0,\n price: li.price ?? \"0\",\n total: li.total ?? \"0\",\n })),\n customer_name: raw.customer_name ?? null,\n customer_email: raw.customer_email ?? null,\n created_at: raw.created_at ?? \"\",\n updated_at: raw.updated_at ?? \"\",\n } satisfies orders.PortalTenantOrder;\n}\n\nfunction mapMeta(\n raw: Awaited<ReturnType<typeof portalTenant.orders_list>>[\"meta\"] | undefined,\n): orders.PortalTenantMeta {\n return {\n request_id: raw?.request_id ?? \"\",\n timestamp: raw?.timestamp ?? \"\",\n pagination: {\n cursor: raw?.pagination?.cursor ?? null,\n limit: raw?.pagination?.limit ?? 25,\n next_cursor: raw?.pagination?.next_cursor ?? null,\n prev_cursor: raw?.pagination?.prev_cursor ?? null,\n },\n } satisfies orders.PortalTenantMeta;\n}\n\nexport function createPortalTenantOrdersAdapter(\n client: FetchClient,\n): Required<Pick<OrdersApi, \"fetchOrderById\" | \"fetchOrders\">> {\n return {\n fetchOrderById: async (id: number) => {\n const response = await portalTenant.orders_show(client, id);\n return {\n order: mapOrder(response.order ?? {}),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies orders.PortalTenantOrderResponse;\n },\n\n fetchOrders: async (params: orders.PortalTenantFetchOrdersParams) => {\n const response = await portalTenant.orders_list(client, {\n \"page[cursor]\": params.cursor,\n \"page[limit]\": params.limit,\n status: params.status,\n });\n return {\n orders: (response.orders ?? []).map(mapOrder),\n meta: mapMeta(response.meta),\n } satisfies orders.PortalTenantOrdersResponse;\n },\n };\n}\n","import type { OrdersApi } from \"@fluid-app/orders-core\";\nimport type { FetchClient } from \"@fluid-app/portal-tenant-api-client\";\nimport { createPortalTenantOrdersAdapter } from \"@fluid-app/orders-api-client\";\n\n/**\n * Creates an OrdersApi adapter for the portal-tenant BFF.\n *\n * Delegates to the existing clean adapter in orders/api-client which maps\n * BFF responses to PortalTenantOrder types. The legacy methods (fetchOrder,\n * fetchCustomerOrders) are not used by portal UI — portal-specific hooks\n * call fetchOrders/fetchOrderById directly.\n */\nexport function createPortalOrdersAdapter(client: FetchClient): OrdersApi {\n const bffAdapter = createPortalTenantOrdersAdapter(client);\n return {\n fetchOrder: () => {\n throw new Error(\"Use fetchOrderById for portal-tenant context\");\n },\n fetchCustomerOrders: () => {\n throw new Error(\"Use fetchOrders for portal-tenant context\");\n },\n fetchOrderById: bffAdapter.fetchOrderById,\n fetchOrders: bffAdapter.fetchOrders,\n };\n}\n","import type { AccountApi } from \"@fluid-app/portal-core/account-api\";\nimport type {\n AccountMemberType,\n AccountRep,\n AccountResponse,\n UpdateAccountBody,\n} from \"@fluid-app/portal-core/account-types\";\nimport type { FetchClient } from \"@fluid-app/portal-tenant-api-client\";\nimport { portalTenant } from \"@fluid-app/portal-tenant-api-client\";\n\nfunction mapAccount(\n raw: NonNullable<\n Awaited<ReturnType<typeof portalTenant.account_show>>[\"account\"]\n >,\n): AccountRep {\n return {\n id: raw.id ?? 0,\n member_type: (raw.member_type ?? \"rep\") satisfies AccountMemberType,\n first_name: raw.first_name ?? \"\",\n last_name: raw.last_name ?? \"\",\n email: raw.email ?? \"\",\n phone: raw.phone ?? null,\n bio: raw.bio ?? null,\n avatar_url: raw.avatar_url ?? null,\n slug: raw.slug ?? \"\",\n social_links: (raw.social_links ?? null) as Record<string, string> | null,\n } satisfies AccountRep;\n}\n\nexport function createAccountApiAdapter(client: FetchClient): AccountApi {\n return {\n fetchAccount: async () => {\n const response = await portalTenant.account_show(client);\n return {\n account: mapAccount(response.account ?? {}),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies AccountResponse;\n },\n\n updateAccount: async (body: UpdateAccountBody) => {\n const response = await portalTenant.account_update(client, body);\n return {\n account: mapAccount(response.account ?? {}),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies AccountResponse;\n },\n };\n}\n","/**\n * Generated API client functions for portal_tenant_pay\n *\n * DO NOT EDIT THIS FILE DIRECTLY\n * This file is auto-generated. To update:\n * 1. Update the OpenAPI spec file\n * 2. Run: pnpm generate\n */\n\nimport type { FetchClient } from \"../lib/fetch-client\";\nimport type { operations } from \"../generated/portal-tenant-pay\";\n\n// ============================================================================\n// addresses\n// ============================================================================\n\n/**\n * List addresses\n * Returns addresses associated with the member's customer record in this tenant.\n *\n * @param client - Fetch client instance\n * @param [params] - params\n */\nexport async function addresses_list(\n client: FetchClient,\n params?: operations[\"addresses_list\"][\"parameters\"][\"query\"],\n): Promise<\n operations[\"addresses_list\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.get(`/api/pay/addresses`, params);\n}\n\n/**\n * Create an address\n * Adds a new address to the member's customer record. If an identical address already exists it is returned instead of creating a duplicate.\n *\n * @param client - Fetch client instance\n * @param body - body\n */\nexport async function addresses_create(\n client: FetchClient,\n body: operations[\"addresses_create\"][\"requestBody\"][\"content\"][\"application/json\"],\n): Promise<\n operations[\"addresses_create\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.post(`/api/pay/addresses`, body);\n}\n\n/**\n * Update an address\n * Creates a new address with the merged attributes and discards the old one, preserving references from existing orders.\n *\n * @param client - Fetch client instance\n * @param id - id\n * @param body - body\n */\nexport async function addresses_update(\n client: FetchClient,\n id: string | number,\n body: operations[\"addresses_update\"][\"requestBody\"][\"content\"][\"application/json\"],\n): Promise<\n operations[\"addresses_update\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.patch(`/api/pay/addresses/${id}`, body);\n}\n\n/**\n * Delete an address\n * Removes an address from the member's customer record. The default address cannot be removed.\n *\n * @param client - Fetch client instance\n * @param id - id\n */\nexport async function addresses_destroy(\n client: FetchClient,\n id: string | number,\n): Promise<\n operations[\"addresses_destroy\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.delete(`/api/pay/addresses/${id}`);\n}\n\n// ============================================================================\n// payment-methods\n// ============================================================================\n\n/**\n * List payment methods\n * Returns displayable payment methods on the member's customer record, excluding Apple Pay sources.\n *\n * @param client - Fetch client instance\n * @param [params] - params\n */\nexport async function payment_methods_list(\n client: FetchClient,\n params?: operations[\"payment_methods_list\"][\"parameters\"][\"query\"],\n): Promise<\n operations[\"payment_methods_list\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.get(`/api/pay/payment_methods`, params);\n}\n\n/**\n * Create a payment method\n * Tokenizes and stores a new payment method via the vault provider. Requires a vault token obtained from the vault credentials endpoint.\n *\n * @param client - Fetch client instance\n * @param body - body\n */\nexport async function payment_methods_create(\n client: FetchClient,\n body: operations[\"payment_methods_create\"][\"requestBody\"][\"content\"][\"application/json\"],\n): Promise<\n operations[\"payment_methods_create\"][\"responses\"][201][\"content\"][\"application/json\"]\n> {\n return client.post(`/api/pay/payment_methods`, body);\n}\n\n/**\n * Update a payment method\n * Updates a payment method's attributes. Currently supports setting a payment method as the default.\n *\n * @param client - Fetch client instance\n * @param id - id\n * @param body - body\n */\nexport async function payment_methods_update(\n client: FetchClient,\n id: string | number,\n body: operations[\"payment_methods_update\"][\"requestBody\"][\"content\"][\"application/json\"],\n): Promise<\n operations[\"payment_methods_update\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.patch(`/api/pay/payment_methods/${id}`, body);\n}\n\n/**\n * Delete a payment method\n * Removes a payment method from the member's customer record. If the removed method was the default, the default is cleared.\n *\n * @param client - Fetch client instance\n * @param id - id\n */\nexport async function payment_methods_destroy(\n client: FetchClient,\n id: string | number,\n): Promise<\n operations[\"payment_methods_destroy\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.delete(`/api/pay/payment_methods/${id}`);\n}\n\n/**\n * Get vault credentials\n * Returns a short-lived vault token and environment identifier for initializing the client-side payment vault SDK.\n *\n * @param client - Fetch client instance\n \n */\nexport async function payment_methods_vault_show(\n client: FetchClient,\n): Promise<\n operations[\"payment_methods_vault_show\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.get(`/api/pay/payment_methods/vault`);\n}\n\n// ============================================================================\n// points-ledgers\n// ============================================================================\n\n/**\n * List points ledger entries\n * Returns loyalty points ledger entries for the member's customer record in this tenant, ordered by most recent first.\n *\n * @param client - Fetch client instance\n * @param [params] - params\n */\nexport async function points_ledgers_list(\n client: FetchClient,\n params?: operations[\"points_ledgers_list\"][\"parameters\"][\"query\"],\n): Promise<\n operations[\"points_ledgers_list\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.get(`/api/pay/points_ledgers`, params);\n}\n","import type { PayApi } from \"@fluid-app/portal-core/pay-api\";\nimport type {\n PayAddress,\n PayPaymentMethod,\n CreateAddressBody,\n CreatePaymentMethodBody,\n UpdatePaymentMethodBody,\n VaultResponse,\n PointsLedgersResponse,\n} from \"@fluid-app/portal-core/pay-types\";\nimport type { FetchClient } from \"@fluid-app/portal-tenant-api-client\";\nimport { portalTenantPay } from \"@fluid-app/portal-tenant-pay-api-client\";\n\n// ---------------------------------------------------------------------------\n// BFF response type helpers\n// ---------------------------------------------------------------------------\n\ntype BffAddress = NonNullable<\n Awaited<ReturnType<typeof portalTenantPay.addresses_list>>[\"addresses\"]\n>[number];\n\ntype BffPaymentMethod = NonNullable<\n Awaited<\n ReturnType<typeof portalTenantPay.payment_methods_list>\n >[\"payment_methods\"]\n>[number];\n\n// ---------------------------------------------------------------------------\n// BFF → port type mappers\n// ---------------------------------------------------------------------------\n\nfunction mapAddress(raw: BffAddress): PayAddress {\n return {\n id: raw.id ?? 0,\n street1: raw.street1 ?? \"\",\n street2: raw.street2 ?? null,\n city: raw.city ?? \"\",\n state: raw.state ?? \"\",\n zip: raw.zip ?? \"\",\n country: raw.country ?? \"\",\n default: raw.default ?? false,\n created_at: raw.created_at ?? null,\n updated_at: raw.updated_at ?? null,\n };\n}\n\nfunction mapPaymentMethod(raw: BffPaymentMethod): PayPaymentMethod {\n return {\n id: raw.id ?? 0,\n type: raw.type ?? \"card\",\n brand: raw.brand ?? null,\n last_four: raw.last_four ?? \"\",\n exp_month: raw.exp_month ?? null,\n exp_year: raw.exp_year ?? null,\n default: raw.default ?? false,\n created_at: raw.created_at ?? null,\n updated_at: raw.updated_at ?? null,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Adapter factory\n// ---------------------------------------------------------------------------\n\nexport function createPortalTenantPayAdapter(client: FetchClient): PayApi {\n return {\n fetchAddresses: async () => {\n const response = await portalTenantPay.addresses_list(client);\n return {\n addresses: (response.addresses ?? []).map(mapAddress),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n };\n },\n\n createAddress: async (body: CreateAddressBody) => {\n await portalTenantPay.addresses_create(client, body);\n },\n\n updateAddress: async (addressId: number, body: CreateAddressBody) => {\n await portalTenantPay.addresses_update(client, addressId, body);\n },\n\n deleteAddress: async (addressId: number) => {\n await portalTenantPay.addresses_destroy(client, addressId);\n },\n\n fetchPaymentMethods: async () => {\n const response = await portalTenantPay.payment_methods_list(client);\n return {\n payment_methods: (response.payment_methods ?? []).map(mapPaymentMethod),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n };\n },\n\n createPaymentMethod: async (body: CreatePaymentMethodBody) => {\n await portalTenantPay.payment_methods_create(client, body);\n },\n\n updatePaymentMethod: async (\n paymentMethodId: number,\n body: UpdatePaymentMethodBody,\n ) => {\n await portalTenantPay.payment_methods_update(\n client,\n paymentMethodId,\n body,\n );\n },\n\n deletePaymentMethod: async (paymentMethodId: number) => {\n await portalTenantPay.payment_methods_destroy(client, paymentMethodId);\n },\n\n fetchVaultCredentials: async () => {\n const response = await portalTenantPay.payment_methods_vault_show(client);\n return {\n vault: {\n token: response.vault?.token ?? null,\n environment: response.vault?.environment ?? \"production\",\n },\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies VaultResponse;\n },\n\n fetchPointsLedgers: async () => {\n const response = await portalTenantPay.points_ledgers_list(client);\n return {\n points_ledgers: (response.points_ledgers ?? []).map((entry) => ({\n id: entry.id ?? 0,\n amount: entry.amount ?? 0,\n total_balance: entry.total_balance ?? 0,\n metadata: (entry.metadata as Record<string, unknown>) ?? null,\n created_at: entry.created_at ?? \"\",\n })),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies PointsLedgersResponse;\n },\n };\n}\n","import { useMemo } from \"react\";\nimport type { OrdersApi } from \"@fluid-app/orders-core\";\nimport type { SubscriptionsApi } from \"@fluid-app/subscriptions-core\";\nimport type { AccountApi } from \"@fluid-app/portal-core/account-api\";\nimport type { PayApi } from \"@fluid-app/portal-core/pay-api\";\nimport { createPortalSubscriptionsAdapter } from \"@fluid-app/subscriptions-api-client\";\nimport {\n createFetchClient,\n type FetchClient as CoreFetchClient,\n} from \"@fluid-app/api-client-core\";\nimport { createPortalOrdersAdapter } from \"../adapters/orders-api-adapter\";\nimport { createAccountApiAdapter } from \"../adapters/account-api-adapter\";\nimport { createPortalTenantPayAdapter } from \"../adapters/pay-api-adapter\";\nimport { usePortalTenantClient } from \"../providers/PortalTenantClientProvider\";\nimport { useFluidContext } from \"../providers/FluidProvider\";\n\n/** API version prefix for versioned endpoints (e.g. points ledger) */\nexport const API_VERSION = \"/v202506\";\n\nexport function useOrdersApi(): OrdersApi {\n const client = usePortalTenantClient();\n\n return useMemo(() => createPortalOrdersAdapter(client), [client]);\n}\n\nexport function useSubscriptionsApiClient(): SubscriptionsApi {\n const client = usePortalTenantClient();\n\n return useMemo(() => createPortalSubscriptionsAdapter(client), [client]);\n}\n\nexport function useAccountApi(): AccountApi {\n const client = usePortalTenantClient();\n\n return useMemo(() => createAccountApiAdapter(client), [client]);\n}\n\nexport function usePayApi(): PayApi {\n const client = usePortalTenantClient();\n\n return useMemo(() => createPortalTenantPayAdapter(client), [client]);\n}\n\n/**\n * Ensures baseUrl ends with /api.\n * Uncovered endpoints (e.g. /countries, points ledgers) use paths without the\n * /api prefix, so the base URL must include it.\n */\nfunction withApiPrefix(baseUrl: string): string {\n const base = baseUrl.replace(/\\/+$/, \"\");\n return base.endsWith(\"/api\") ? base : `${base}/api`;\n}\n\n/**\n * Generic SDK fetch client for endpoints not covered by domain-specific clients\n * (e.g. /countries, /v202506/customers/:id/points_ledgers).\n * Creates a FetchClient with /api-prefixed baseUrl since these endpoints\n * use paths like /countries (not /api/countries).\n */\nexport function useSdkClient(): CoreFetchClient {\n const { config } = useFluidContext();\n\n return useMemo(\n () =>\n createFetchClient({\n baseUrl: withApiPrefix(config.baseUrl),\n onAuthError: config.onAuthError,\n credentials: \"include\",\n }),\n [config.baseUrl, config.onAuthError],\n );\n}\n"],"mappings":";;;;;;AAQA,SAASA,UAAQ,KAGf;AACA,QAAO;EACL,YAAY,IAAI,cAAc;EAC9B,WAAW,IAAI,aAAa;EAC7B;;;;;;;;;;;AAoBH,SAAS,sBACP,UACkC;AAClC,QAAO;EACL,cAAe,SAAS,gBACtB,EAAE;EACJ,MAAM,SAA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B;AAEtC,QAAO,cAAc,iCAAiC,OAAO,EAAE,CAAC,OAAO,CAAC;;AAG1E,SAAgB,gBAA4B;CAC1C,MAAM,SAAS,uBAAuB;AAEtC,QAAO,cAAc,wBAAwB,OAAO,EAAE,CAAC,OAAO,CAAC;;AAGjE,SAAgB,YAAoB;CAClC,MAAM,SAAS,uBAAuB;AAEtC,QAAO,cAAc,6BAA6B,OAAO,EAAE,CAAC,OAAO,CAAC;;;;;;;AAQtE,SAAS,cAAc,SAAyB;CAC9C,MAAM,OAAO,QAAQ,QAAQ,QAAQ,GAAG;AACxC,QAAO,KAAK,SAAS,OAAO,GAAG,OAAO,GAAG,KAAK;;;;;;;;AAShD,SAAgB,eAAgC;CAC9C,MAAM,EAAE,WAAW,iBAAiB;AAEpC,QAAO,cAEH,kBAAkB;EAChB,SAAS,cAAc,OAAO,QAAQ;EACtC,aAAa,OAAO;EACpB,aAAa;EACd,CAAC,EACJ,CAAC,OAAO,SAAS,OAAO,YAAY,CACrC"}
|
|
1
|
+
{"version":3,"file":"use-account-clients-BjK5QVYl.mjs","names":["mapMeta","portalTenant.subscriptions_list","portalTenant.subscriptions_show","portalTenant.subscriptions_pause","portalTenant.subscriptions_resume","portalTenant.subscriptions_skip","portalTenant.subscriptions_cancel","portalTenant.subscriptions_reactivate","portalTenant.subscriptions_update","portalTenant.orders_show","portalTenant.orders_list","portalTenant.account_show","portalTenant.account_update","portalTenantPay.addresses_list","portalTenantPay.addresses_create","portalTenantPay.addresses_update","portalTenantPay.addresses_destroy","portalTenantPay.payment_methods_list","portalTenantPay.payment_methods_create","portalTenantPay.payment_methods_update","portalTenantPay.payment_methods_destroy","portalTenantPay.payment_methods_vault_show","portalTenantPay.points_ledgers_list"],"sources":["../../../subscriptions/api-client/src/portal-tenant-adapter.ts","../../../orders/api-client/src/portal-tenant-adapter.ts","../src/adapters/orders-api-adapter.ts","../src/adapters/account-api-adapter.ts","../../../api-clients/portal-tenant-pay/src/namespaces/portal_tenant_pay.ts","../src/adapters/pay-api-adapter.ts","../src/account/use-account-clients.ts"],"sourcesContent":["import type { SubscriptionsApi } from \"@fluid-app/subscriptions-core\";\nimport type { FetchClient } from \"./lib/fetch-client\";\nimport type { subscriptions } from \"./custom/subscriptions\";\nimport { portalTenant } from \"@fluid-app/portal-tenant-api-client\";\n\n/**\n * Maps the BFF meta envelope to the port's expected shape.\n */\nfunction mapMeta(raw: { request_id?: string | null; timestamp?: string }): {\n request_id: string;\n timestamp: string;\n} {\n return {\n request_id: raw.request_id ?? \"\",\n timestamp: raw.timestamp ?? \"\",\n };\n}\n\ntype BffSubscriptionResponse = Awaited<\n ReturnType<typeof portalTenant.subscriptions_show>\n>;\n\ntype BffListResponse = Awaited<\n ReturnType<typeof portalTenant.subscriptions_list>\n>;\n\n/**\n * Maps a BFF subscription detail response to the port's SubscriptionDetail.\n *\n * The BFF returns a flat Subscription schema while the port expects a richly\n * nested SubscriptionDetailSubscription. Both represent the same underlying\n * data — the consuming portal UI only accesses the subset of fields the BFF\n * provides. The explicit field mapping ensures the envelope structure is\n * correct, while the subscription data passes through at runtime.\n */\nfunction mapSubscriptionDetail(\n response: BffSubscriptionResponse,\n): subscriptions.SubscriptionDetail {\n return {\n subscription: (response.subscription ??\n {}) as unknown as subscriptions.SubscriptionDetailSubscription,\n meta: response.meta ? mapMeta(response.meta) : undefined,\n };\n}\n\nfunction mapSubscriptionList(\n response: BffListResponse,\n): subscriptions.SubscriptionsResponse {\n return {\n subscriptions: (response.subscriptions ??\n []) as unknown as subscriptions.SubscriptionListItem[],\n meta: mapMeta(response.meta ?? {}),\n };\n}\n\n/**\n * Creates a SubscriptionsApi-compatible adapter backed by the portal-tenant BFF.\n *\n * Uses async/await with explicit field mapping. The BFF returns simplified\n * subscription types compared to the full admin API; the adapter maps the\n * response envelope and provides runtime defaults for optional fields.\n */\nexport function createPortalSubscriptionsAdapter(\n client: FetchClient,\n): SubscriptionsApi {\n return {\n fetchCustomerSubscriptions: async (\n params: subscriptions.FetchSubscriptionsParams,\n ) => {\n const response = await portalTenant.subscriptions_list(client, {\n \"page[cursor]\": params.cursor,\n \"page[limit]\": params.limit ?? params.perPage,\n });\n return mapSubscriptionList(response);\n },\n\n fetchSubscription: async (subscriptionToken: string) => {\n const response = await portalTenant.subscriptions_show(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n pauseSubscription: async (\n subscriptionToken: string,\n _params: subscriptions.PauseSubscriptionParams,\n ) => {\n const response = await portalTenant.subscriptions_pause(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n resumeSubscription: async (\n subscriptionToken: string,\n _params: subscriptions.ResumeSubscriptionParams,\n ) => {\n const response = await portalTenant.subscriptions_resume(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n skipSubscription: async (\n subscriptionToken: string,\n _params: subscriptions.SkipSubscriptionParams,\n ) => {\n const response = await portalTenant.subscriptions_skip(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n cancelSubscription: async (\n subscriptionToken: string,\n _customerId?: number,\n ) => {\n const response = await portalTenant.subscriptions_cancel(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n reactivateSubscription: async (\n subscriptionToken: string,\n _params: subscriptions.ReactivateSubscriptionParams,\n ) => {\n const response = await portalTenant.subscriptions_reactivate(\n client,\n subscriptionToken,\n );\n return mapSubscriptionDetail(response);\n },\n\n updateSubscriptionInfo: async (\n subscriptionToken: string,\n body: Pick<subscriptions.UpdateSubscriptionInfoBody, \"payment_method_id\">,\n ) => {\n const response = await portalTenant.subscriptions_update(\n client,\n subscriptionToken,\n { subscription: { payment_method_id: body.payment_method_id } },\n );\n return mapSubscriptionDetail(response);\n },\n };\n}\n","import type { FetchClient } from \"./lib/fetch-client\";\nimport type { OrdersApi } from \"@fluid-app/orders-core\";\nimport type { orders } from \"@fluid-app/orders-core\";\nimport { portalTenant } from \"@fluid-app/portal-tenant-api-client\";\n\n/**\n * Creates an OrdersApi adapter backed by the portal-tenant BFF.\n *\n * Maps the generated portal-tenant namespace functions to the abstract\n * OrdersApi port, closing over the FetchClient so consumers don't need\n * to pass it per-call.\n */\n\nfunction mapOrder(\n raw: NonNullable<\n Awaited<ReturnType<typeof portalTenant.orders_show>>[\"order\"]\n >,\n): orders.PortalTenantOrder {\n return {\n id: raw.id ?? 0,\n token: raw.token ?? \"\",\n status: (raw.status ?? \"pending\") as orders.PortalTenantOrderStatus,\n total: raw.total ?? \"0\",\n currency: raw.currency ?? \"\",\n line_items: (raw.line_items ?? []).map((li) => ({\n id: li.id ?? 0,\n product_id: li.product_id ?? 0,\n product_name: li.product_name ?? \"\",\n quantity: li.quantity ?? 0,\n price: li.price ?? \"0\",\n total: li.total ?? \"0\",\n })),\n customer_name: raw.customer_name ?? null,\n customer_email: raw.customer_email ?? null,\n created_at: raw.created_at ?? \"\",\n updated_at: raw.updated_at ?? \"\",\n } satisfies orders.PortalTenantOrder;\n}\n\nfunction mapMeta(\n raw: Awaited<ReturnType<typeof portalTenant.orders_list>>[\"meta\"] | undefined,\n): orders.PortalTenantMeta {\n return {\n request_id: raw?.request_id ?? \"\",\n timestamp: raw?.timestamp ?? \"\",\n pagination: {\n cursor: raw?.pagination?.cursor ?? null,\n limit: raw?.pagination?.limit ?? 25,\n next_cursor: raw?.pagination?.next_cursor ?? null,\n prev_cursor: raw?.pagination?.prev_cursor ?? null,\n },\n } satisfies orders.PortalTenantMeta;\n}\n\nexport function createPortalTenantOrdersAdapter(\n client: FetchClient,\n): Required<Pick<OrdersApi, \"fetchOrderById\" | \"fetchOrders\">> {\n return {\n fetchOrderById: async (id: number) => {\n const response = await portalTenant.orders_show(client, id);\n return {\n order: mapOrder(response.order ?? {}),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies orders.PortalTenantOrderResponse;\n },\n\n fetchOrders: async (params: orders.PortalTenantFetchOrdersParams) => {\n const response = await portalTenant.orders_list(client, {\n \"page[cursor]\": params.cursor,\n \"page[limit]\": params.limit,\n status: params.status,\n });\n return {\n orders: (response.orders ?? []).map(mapOrder),\n meta: mapMeta(response.meta),\n } satisfies orders.PortalTenantOrdersResponse;\n },\n };\n}\n","import type { OrdersApi } from \"@fluid-app/orders-core\";\nimport type { FetchClient } from \"@fluid-app/portal-tenant-api-client\";\nimport { createPortalTenantOrdersAdapter } from \"@fluid-app/orders-api-client\";\n\n/**\n * Creates an OrdersApi adapter for the portal-tenant BFF.\n *\n * Delegates to the existing clean adapter in orders/api-client which maps\n * BFF responses to PortalTenantOrder types. The legacy methods (fetchOrder,\n * fetchCustomerOrders) are not used by portal UI — portal-specific hooks\n * call fetchOrders/fetchOrderById directly.\n */\nexport function createPortalOrdersAdapter(client: FetchClient): OrdersApi {\n const bffAdapter = createPortalTenantOrdersAdapter(client);\n return {\n fetchOrder: () => {\n throw new Error(\"Use fetchOrderById for portal-tenant context\");\n },\n fetchCustomerOrders: () => {\n throw new Error(\"Use fetchOrders for portal-tenant context\");\n },\n fetchOrderById: bffAdapter.fetchOrderById,\n fetchOrders: bffAdapter.fetchOrders,\n };\n}\n","import type { AccountApi } from \"@fluid-app/portal-core/account-api\";\nimport type {\n AccountMemberType,\n AccountRep,\n AccountResponse,\n UpdateAccountBody,\n} from \"@fluid-app/portal-core/account-types\";\nimport type { FetchClient } from \"@fluid-app/portal-tenant-api-client\";\nimport { portalTenant } from \"@fluid-app/portal-tenant-api-client\";\n\nfunction mapAccount(\n raw: NonNullable<\n Awaited<ReturnType<typeof portalTenant.account_show>>[\"account\"]\n >,\n): AccountRep {\n return {\n id: raw.id ?? 0,\n member_type: (raw.member_type ?? \"rep\") satisfies AccountMemberType,\n first_name: raw.first_name ?? \"\",\n last_name: raw.last_name ?? \"\",\n email: raw.email ?? \"\",\n phone: raw.phone ?? null,\n bio: raw.bio ?? null,\n avatar_url: raw.avatar_url ?? null,\n slug: raw.slug ?? \"\",\n social_links: (raw.social_links ?? null) as Record<string, string> | null,\n } satisfies AccountRep;\n}\n\nexport function createAccountApiAdapter(client: FetchClient): AccountApi {\n return {\n fetchAccount: async () => {\n const response = await portalTenant.account_show(client);\n return {\n account: mapAccount(response.account ?? {}),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies AccountResponse;\n },\n\n updateAccount: async (body: UpdateAccountBody) => {\n const response = await portalTenant.account_update(client, body);\n return {\n account: mapAccount(response.account ?? {}),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies AccountResponse;\n },\n };\n}\n","/**\n * Generated API client functions for portal_tenant_pay\n *\n * DO NOT EDIT THIS FILE DIRECTLY\n * This file is auto-generated. To update:\n * 1. Update the OpenAPI spec file\n * 2. Run: pnpm generate\n */\n\nimport type { FetchClient } from \"../lib/fetch-client\";\nimport type { operations } from \"../generated/portal-tenant-pay\";\n\n// ============================================================================\n// addresses\n// ============================================================================\n\n/**\n * List addresses\n * Returns addresses associated with the member's customer record in this tenant.\n *\n * @param client - Fetch client instance\n * @param [params] - params\n */\nexport async function addresses_list(\n client: FetchClient,\n params?: operations[\"addresses_list\"][\"parameters\"][\"query\"],\n): Promise<\n operations[\"addresses_list\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.get(`/api/pay/addresses`, params);\n}\n\n/**\n * Create an address\n * Adds a new address to the member's customer record. If an identical address already exists it is returned instead of creating a duplicate.\n *\n * @param client - Fetch client instance\n * @param body - body\n */\nexport async function addresses_create(\n client: FetchClient,\n body: operations[\"addresses_create\"][\"requestBody\"][\"content\"][\"application/json\"],\n): Promise<\n operations[\"addresses_create\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.post(`/api/pay/addresses`, body);\n}\n\n/**\n * Update an address\n * Creates a new address with the merged attributes and discards the old one, preserving references from existing orders.\n *\n * @param client - Fetch client instance\n * @param id - id\n * @param body - body\n */\nexport async function addresses_update(\n client: FetchClient,\n id: string | number,\n body: operations[\"addresses_update\"][\"requestBody\"][\"content\"][\"application/json\"],\n): Promise<\n operations[\"addresses_update\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.patch(`/api/pay/addresses/${id}`, body);\n}\n\n/**\n * Delete an address\n * Removes an address from the member's customer record. The default address cannot be removed.\n *\n * @param client - Fetch client instance\n * @param id - id\n */\nexport async function addresses_destroy(\n client: FetchClient,\n id: string | number,\n): Promise<\n operations[\"addresses_destroy\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.delete(`/api/pay/addresses/${id}`);\n}\n\n// ============================================================================\n// payment-methods\n// ============================================================================\n\n/**\n * List payment methods\n * Returns displayable payment methods on the member's customer record, excluding Apple Pay sources.\n *\n * @param client - Fetch client instance\n * @param [params] - params\n */\nexport async function payment_methods_list(\n client: FetchClient,\n params?: operations[\"payment_methods_list\"][\"parameters\"][\"query\"],\n): Promise<\n operations[\"payment_methods_list\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.get(`/api/pay/payment_methods`, params);\n}\n\n/**\n * Create a payment method\n * Tokenizes and stores a new payment method via the vault provider. Requires a vault token obtained from the vault credentials endpoint.\n *\n * @param client - Fetch client instance\n * @param body - body\n */\nexport async function payment_methods_create(\n client: FetchClient,\n body: operations[\"payment_methods_create\"][\"requestBody\"][\"content\"][\"application/json\"],\n): Promise<\n operations[\"payment_methods_create\"][\"responses\"][201][\"content\"][\"application/json\"]\n> {\n return client.post(`/api/pay/payment_methods`, body);\n}\n\n/**\n * Update a payment method\n * Updates a payment method's attributes. Currently supports setting a payment method as the default.\n *\n * @param client - Fetch client instance\n * @param id - id\n * @param body - body\n */\nexport async function payment_methods_update(\n client: FetchClient,\n id: string | number,\n body: operations[\"payment_methods_update\"][\"requestBody\"][\"content\"][\"application/json\"],\n): Promise<\n operations[\"payment_methods_update\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.patch(`/api/pay/payment_methods/${id}`, body);\n}\n\n/**\n * Delete a payment method\n * Removes a payment method from the member's customer record. If the removed method was the default, the default is cleared.\n *\n * @param client - Fetch client instance\n * @param id - id\n */\nexport async function payment_methods_destroy(\n client: FetchClient,\n id: string | number,\n): Promise<\n operations[\"payment_methods_destroy\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.delete(`/api/pay/payment_methods/${id}`);\n}\n\n/**\n * Get vault credentials\n * Returns a short-lived vault token and environment identifier for initializing the client-side payment vault SDK.\n *\n * @param client - Fetch client instance\n \n */\nexport async function payment_methods_vault_show(\n client: FetchClient,\n): Promise<\n operations[\"payment_methods_vault_show\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.get(`/api/pay/payment_methods/vault`);\n}\n\n// ============================================================================\n// points-ledgers\n// ============================================================================\n\n/**\n * List points ledger entries\n * Returns loyalty points ledger entries for the member's customer record in this tenant, ordered by most recent first.\n *\n * @param client - Fetch client instance\n * @param [params] - params\n */\nexport async function points_ledgers_list(\n client: FetchClient,\n params?: operations[\"points_ledgers_list\"][\"parameters\"][\"query\"],\n): Promise<\n operations[\"points_ledgers_list\"][\"responses\"][200][\"content\"][\"application/json\"]\n> {\n return client.get(`/api/pay/points_ledgers`, params);\n}\n","import type { PayApi } from \"@fluid-app/portal-core/pay-api\";\nimport type {\n PayAddress,\n PayPaymentMethod,\n CreateAddressBody,\n CreatePaymentMethodBody,\n UpdatePaymentMethodBody,\n VaultResponse,\n PointsLedgersResponse,\n} from \"@fluid-app/portal-core/pay-types\";\nimport type { FetchClient } from \"@fluid-app/portal-tenant-api-client\";\nimport { portalTenantPay } from \"@fluid-app/portal-tenant-pay-api-client\";\n\n// ---------------------------------------------------------------------------\n// BFF response type helpers\n// ---------------------------------------------------------------------------\n\ntype BffAddress = NonNullable<\n Awaited<ReturnType<typeof portalTenantPay.addresses_list>>[\"addresses\"]\n>[number];\n\ntype BffPaymentMethod = NonNullable<\n Awaited<\n ReturnType<typeof portalTenantPay.payment_methods_list>\n >[\"payment_methods\"]\n>[number];\n\n// ---------------------------------------------------------------------------\n// BFF → port type mappers\n// ---------------------------------------------------------------------------\n\nfunction mapAddress(raw: BffAddress): PayAddress {\n return {\n id: raw.id ?? 0,\n street1: raw.street1 ?? \"\",\n street2: raw.street2 ?? null,\n city: raw.city ?? \"\",\n state: raw.state ?? \"\",\n zip: raw.zip ?? \"\",\n country: raw.country ?? \"\",\n default: raw.default ?? false,\n created_at: raw.created_at ?? null,\n updated_at: raw.updated_at ?? null,\n };\n}\n\nfunction mapPaymentMethod(raw: BffPaymentMethod): PayPaymentMethod {\n return {\n id: raw.id ?? 0,\n type: raw.type ?? \"card\",\n brand: raw.brand ?? null,\n last_four: raw.last_four ?? \"\",\n exp_month: raw.exp_month ?? null,\n exp_year: raw.exp_year ?? null,\n default: raw.default ?? false,\n created_at: raw.created_at ?? null,\n updated_at: raw.updated_at ?? null,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Adapter factory\n// ---------------------------------------------------------------------------\n\nexport function createPortalTenantPayAdapter(client: FetchClient): PayApi {\n return {\n fetchAddresses: async () => {\n const response = await portalTenantPay.addresses_list(client);\n return {\n addresses: (response.addresses ?? []).map(mapAddress),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n };\n },\n\n createAddress: async (body: CreateAddressBody) => {\n await portalTenantPay.addresses_create(client, body);\n },\n\n updateAddress: async (addressId: number, body: CreateAddressBody) => {\n await portalTenantPay.addresses_update(client, addressId, body);\n },\n\n deleteAddress: async (addressId: number) => {\n await portalTenantPay.addresses_destroy(client, addressId);\n },\n\n fetchPaymentMethods: async () => {\n const response = await portalTenantPay.payment_methods_list(client);\n return {\n payment_methods: (response.payment_methods ?? []).map(mapPaymentMethod),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n };\n },\n\n createPaymentMethod: async (body: CreatePaymentMethodBody) => {\n await portalTenantPay.payment_methods_create(client, body);\n },\n\n updatePaymentMethod: async (\n paymentMethodId: number,\n body: UpdatePaymentMethodBody,\n ) => {\n await portalTenantPay.payment_methods_update(\n client,\n paymentMethodId,\n body,\n );\n },\n\n deletePaymentMethod: async (paymentMethodId: number) => {\n await portalTenantPay.payment_methods_destroy(client, paymentMethodId);\n },\n\n fetchVaultCredentials: async () => {\n const response = await portalTenantPay.payment_methods_vault_show(client);\n return {\n vault: {\n token: response.vault?.token ?? null,\n environment: response.vault?.environment ?? \"production\",\n },\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies VaultResponse;\n },\n\n fetchPointsLedgers: async () => {\n const response = await portalTenantPay.points_ledgers_list(client);\n return {\n points_ledgers: (response.points_ledgers ?? []).map((entry) => ({\n id: entry.id ?? 0,\n amount: entry.amount ?? 0,\n total_balance: entry.total_balance ?? 0,\n metadata: (entry.metadata as Record<string, unknown>) ?? null,\n created_at: entry.created_at ?? \"\",\n })),\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies PointsLedgersResponse;\n },\n };\n}\n","import { useMemo } from \"react\";\nimport type { OrdersApi } from \"@fluid-app/orders-core\";\nimport type { SubscriptionsApi } from \"@fluid-app/subscriptions-core\";\nimport type { AccountApi } from \"@fluid-app/portal-core/account-api\";\nimport type { PayApi } from \"@fluid-app/portal-core/pay-api\";\nimport { createPortalSubscriptionsAdapter } from \"@fluid-app/subscriptions-api-client\";\nimport {\n createFetchClient,\n type FetchClient as CoreFetchClient,\n} from \"@fluid-app/api-client-core\";\nimport { createPortalOrdersAdapter } from \"../adapters/orders-api-adapter\";\nimport { createAccountApiAdapter } from \"../adapters/account-api-adapter\";\nimport { createPortalTenantPayAdapter } from \"../adapters/pay-api-adapter\";\nimport { usePortalTenantClient } from \"../providers/PortalTenantClientProvider\";\nimport { useFluidContext } from \"../providers/FluidProvider\";\n\n/** API version prefix for versioned endpoints (e.g. points ledger) */\nexport const API_VERSION = \"/v202506\";\n\nexport function useOrdersApi(): OrdersApi {\n const client = usePortalTenantClient();\n\n return useMemo(() => createPortalOrdersAdapter(client), [client]);\n}\n\nexport function useSubscriptionsApiClient(): SubscriptionsApi {\n const client = usePortalTenantClient();\n\n return useMemo(() => createPortalSubscriptionsAdapter(client), [client]);\n}\n\nexport function useAccountApi(): AccountApi {\n const client = usePortalTenantClient();\n\n return useMemo(() => createAccountApiAdapter(client), [client]);\n}\n\nexport function usePayApi(): PayApi {\n const client = usePortalTenantClient();\n\n return useMemo(() => createPortalTenantPayAdapter(client), [client]);\n}\n\n/**\n * Ensures baseUrl ends with /api.\n * Uncovered endpoints (e.g. /countries, points ledgers) use paths without the\n * /api prefix, so the base URL must include it.\n */\nfunction withApiPrefix(baseUrl: string): string {\n const base = baseUrl.replace(/\\/+$/, \"\");\n return base.endsWith(\"/api\") ? base : `${base}/api`;\n}\n\n/**\n * Generic SDK fetch client for endpoints not covered by domain-specific clients\n * (e.g. /countries, /v202506/customers/:id/points_ledgers).\n * Creates a FetchClient with /api-prefixed baseUrl since these endpoints\n * use paths like /countries (not /api/countries).\n */\nexport function useSdkClient(): CoreFetchClient {\n const { config } = useFluidContext();\n\n return useMemo(\n () =>\n createFetchClient({\n baseUrl: withApiPrefix(config.baseUrl),\n onAuthError: config.onAuthError,\n credentials: \"include\",\n }),\n [config.baseUrl, config.onAuthError],\n );\n}\n"],"mappings":";;;;;;AAQA,SAASA,UAAQ,KAGf;AACA,QAAO;EACL,YAAY,IAAI,cAAc;EAC9B,WAAW,IAAI,aAAa;EAC7B;;;;;;;;;;;AAoBH,SAAS,sBACP,UACkC;AAClC,QAAO;EACL,cAAe,SAAS,gBACtB,EAAE;EACJ,MAAM,SAAS,OAAOA,UAAQ,SAAS,KAAK,GAAG,KAAA;EAChD;;AAGH,SAAS,oBACP,UACqC;AACrC,QAAO;EACL,eAAgB,SAAS,iBACvB,EAAE;EACJ,MAAMA,UAAQ,SAAS,QAAQ,EAAE,CAAC;EAC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CAAC;;AAGjE,SAAgB,YAAoB;CAClC,MAAM,SAAS,uBAAuB;AAEtC,QAAO,cAAc,6BAA6B,OAAO,EAAE,CAAC,OAAO,CAAC;;;;;;;AAQtE,SAAS,cAAc,SAAyB;CAC9C,MAAM,OAAO,QAAQ,QAAQ,QAAQ,GAAG;AACxC,QAAO,KAAK,SAAS,OAAO,GAAG,OAAO,GAAG,KAAK;;;;;;;;AAShD,SAAgB,eAAgC;CAC9C,MAAM,EAAE,WAAW,iBAAiB;AAEpC,QAAO,cAEH,kBAAkB;EAChB,SAAS,cAAc,OAAO,QAAQ;EACtC,aAAa,OAAO;EACpB,aAAa;EACd,CAAC,EACJ,CAAC,OAAO,SAAS,OAAO,YAAY,CACrC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as useFluidAuthContext } from "./FluidProvider-
|
|
2
|
-
import { t as useFluidApi } from "./use-fluid-api-
|
|
1
|
+
import { l as useFluidAuthContext } from "./FluidProvider-BUdNsR8f.mjs";
|
|
2
|
+
import { t as useFluidApi } from "./use-fluid-api-UtVBk6E-.mjs";
|
|
3
3
|
import { useCallback, useRef } from "react";
|
|
4
4
|
import { useQuery } from "@tanstack/react-query";
|
|
5
5
|
//#region src/hooks/query-keys.ts
|
|
@@ -98,4 +98,4 @@ function useCurrentUser() {
|
|
|
98
98
|
//#endregion
|
|
99
99
|
export { useCompanyScopedQueryKey as i, useCurrentUser as n, createCompanyQueryKey as r, CURRENT_USER_QUERY_KEY as t };
|
|
100
100
|
|
|
101
|
-
//# sourceMappingURL=use-current-user-
|
|
101
|
+
//# sourceMappingURL=use-current-user-BP_GJuQe.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-current-user-
|
|
1
|
+
{"version":3,"file":"use-current-user-BP_GJuQe.mjs","names":[],"sources":["../src/hooks/query-keys.ts","../src/hooks/use-current-user.ts"],"sourcesContent":["/**\n * Company-scoped query key factory for TanStack Query.\n *\n * All portal SDK query keys are prefixed with [\"company\", companyId, ...]\n * so that switching companies naturally invalidates the entire cache scope.\n *\n * The exported `*_QUERY_KEY` constants (e.g. PROFILE_QUERY_KEY) remain as\n * backwards-compatible base keys. The runtime keys used by hooks include the\n * company prefix via {@link createCompanyQueryKey}.\n */\n\nimport { useCallback, useRef } from \"react\";\nimport { useFluidAuthContext } from \"../providers/FluidAuthProvider\";\n\n/**\n * Create a company-scoped query key by prepending [\"company\", companyId].\n *\n * @param companyId - The company ID from the JWT payload\n * @param baseKey - The base query key segments (e.g. [\"fluid\", \"profile\"])\n * @returns A tuple like [\"company\", 42, \"fluid\", \"profile\"]\n *\n * @example\n * ```ts\n * const key = createCompanyQueryKey(42, \"fluid\", \"profile\");\n * // => [\"company\", 42, \"fluid\", \"profile\"]\n * ```\n */\nexport function createCompanyQueryKey(\n companyId: number,\n ...baseKey: readonly string[]\n): readonly [\"company\", number, ...string[]] {\n return [\"company\", companyId, ...baseKey] as const;\n}\n\n/**\n * Hook that returns a `scopeKey` function bound to the current company ID\n * from the auth context. If the user is not authenticated or has no\n * company_id, the base key is returned unscoped (graceful degradation).\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { scopeKey } = useCompanyScopedQueryKey();\n * const queryKey = scopeKey(PROFILE_QUERY_KEY);\n * // => [\"company\", 42, \"fluid\", \"profile\"] (when authenticated)\n * // => [\"fluid\", \"profile\"] (fallback)\n * }\n * ```\n */\nexport function useCompanyScopedQueryKey(): {\n readonly companyId: number | undefined;\n readonly scopeKey: <T extends readonly string[]>(\n baseKey: T,\n ) => readonly (string | number)[];\n} {\n const auth = useFluidAuthContext();\n const companyId = auth.user?.company_id;\n\n // Warn (once per component instance) when an authenticated user has no\n // company_id. This is a security-relevant condition: unscoped keys allow\n // cross-company cache collisions. The warning fires in all environments\n // so that it's visible in production logs if a misconfigured JWT is issued.\n const hasWarnedRef = useRef(false);\n if (auth.isAuthenticated && companyId == null && !hasWarnedRef.current) {\n hasWarnedRef.current = true;\n console.warn(\n \"[portal-sdk] Authenticated user has no company_id in JWT. \" +\n \"Query keys will fall back to unscoped keys, which may cause \" +\n \"cross-company cache collisions. Ensure the JWT includes company_id.\",\n );\n }\n\n const scopeKey = useCallback(\n <T extends readonly string[]>(baseKey: T): readonly (string | number)[] => {\n if (companyId != null) {\n return createCompanyQueryKey(companyId, ...baseKey);\n }\n return baseKey;\n },\n [companyId],\n );\n\n return { companyId, scopeKey } as const;\n}\n","import { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useFluidApi } from \"./use-fluid-api\";\nimport { useCompanyScopedQueryKey } from \"./query-keys\";\nimport type { UserMe } from \"../types/rep\";\n\n/**\n * Base query key for current user data.\n * Kept for backwards compatibility — the runtime key used by the hook\n * includes a company prefix via {@link useCompanyScopedQueryKey}.\n */\nexport const CURRENT_USER_QUERY_KEY = [\"fluid\", \"currentUser\"] as const;\n\n/**\n * Hook to fetch the currently authenticated user's full profile.\n * Returns company, country, and other fields from GET /api/me.\n *\n * @example\n * ```tsx\n * function ShopPage() {\n * const { data: user, isLoading } = useCurrentUser();\n * const subdomain = user?.company?.subdomain;\n * const countryIso = user?.country?.iso ?? \"US\";\n * // ...\n * }\n * ```\n */\nexport function useCurrentUser(): UseQueryResult<UserMe> {\n const api = useFluidApi();\n const { scopeKey } = useCompanyScopedQueryKey();\n\n return useQuery({\n queryKey: scopeKey(CURRENT_USER_QUERY_KEY),\n queryFn: () => api.users.me(),\n staleTime: 5 * 60 * 1000,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgB,sBACd,WACA,GAAG,SACwC;AAC3C,QAAO;EAAC;EAAW;EAAW,GAAG;EAAQ;;;;;;;;;;;;;;;;;AAkB3C,SAAgB,2BAKd;CACA,MAAM,OAAO,qBAAqB;CAClC,MAAM,YAAY,KAAK,MAAM;CAM7B,MAAM,eAAe,OAAO,MAAM;AAClC,KAAI,KAAK,mBAAmB,aAAa,QAAQ,CAAC,aAAa,SAAS;AACtE,eAAa,UAAU;AACvB,UAAQ,KACN,4LAGD;;AAaH,QAAO;EAAE;EAAW,UAVH,aACe,YAA6C;AACzE,OAAI,aAAa,KACf,QAAO,sBAAsB,WAAW,GAAG,QAAQ;AAErD,UAAO;KAET,CAAC,UAAU,CACZ;EAE6B;;;;;;;;;ACxEhC,MAAa,yBAAyB,CAAC,SAAS,cAAc;;;;;;;;;;;;;;;AAgB9D,SAAgB,iBAAyC;CACvD,MAAM,MAAM,aAAa;CACzB,MAAM,EAAE,aAAa,0BAA0B;AAE/C,QAAO,SAAS;EACd,UAAU,SAAS,uBAAuB;EAC1C,eAAe,IAAI,MAAM,IAAI;EAC7B,WAAW,MAAS;EACrB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as useFluidContext } from "./FluidProvider-
|
|
1
|
+
import { n as useFluidContext } from "./FluidProvider-BUdNsR8f.mjs";
|
|
2
2
|
//#region src/hooks/use-fluid-api.ts
|
|
3
3
|
/**
|
|
4
4
|
* Hook to access the Fluid API client
|
|
@@ -24,4 +24,4 @@ function useFluidApi() {
|
|
|
24
24
|
//#endregion
|
|
25
25
|
export { useFluidApi as t };
|
|
26
26
|
|
|
27
|
-
//# sourceMappingURL=use-fluid-api-
|
|
27
|
+
//# sourceMappingURL=use-fluid-api-UtVBk6E-.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-fluid-api-
|
|
1
|
+
{"version":3,"file":"use-fluid-api-UtVBk6E-.mjs","names":[],"sources":["../src/hooks/use-fluid-api.ts"],"sourcesContent":["import { useFluidContext } from \"../providers/FluidProvider\";\nimport type { FluidClient } from \"../client/fluid-client\";\n\n/**\n * Hook to access the Fluid API client\n *\n * @example\n * ```tsx\n * function UserInfo() {\n * const api = useFluidApi();\n *\n * const { data: user } = useQuery({\n * queryKey: [\"me\"],\n * queryFn: () => api.users.me(),\n * });\n *\n * return <p>Hello, {user?.name}</p>;\n * }\n * ```\n */\nexport function useFluidApi(): FluidClient {\n const { client } = useFluidContext();\n return client;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,cAA2B;CACzC,MAAM,EAAE,WAAW,iBAAiB;AACpC,QAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as useFluidAuthContext } from "./FluidProvider-
|
|
1
|
+
import { l as useFluidAuthContext } from "./FluidProvider-BUdNsR8f.mjs";
|
|
2
2
|
//#region src/hooks/use-fluid-auth.ts
|
|
3
3
|
/**
|
|
4
4
|
* useFluidAuth Hook
|
|
@@ -42,4 +42,4 @@ function useFluidAuth() {
|
|
|
42
42
|
//#endregion
|
|
43
43
|
export { useFluidAuth as t };
|
|
44
44
|
|
|
45
|
-
//# sourceMappingURL=use-fluid-auth-
|
|
45
|
+
//# sourceMappingURL=use-fluid-auth-DrPeCmW-.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-fluid-auth-
|
|
1
|
+
{"version":3,"file":"use-fluid-auth-DrPeCmW-.mjs","names":[],"sources":["../src/hooks/use-fluid-auth.ts"],"sourcesContent":["/**\n * useFluidAuth Hook\n *\n * Provides access to authentication state and utilities.\n * This is the primary hook for interacting with auth in components.\n */\n\nimport { useFluidAuthContext } from \"../providers/FluidAuthProvider\";\nimport type { FluidAuthContextValue } from \"../auth/types\";\n\n/**\n * Hook to access authentication state and utilities.\n *\n * Must be used within a `FluidAuthProvider`.\n *\n * @returns Authentication context with user info, loading state, and utilities\n * @throws Error if used outside FluidAuthProvider\n *\n * @example\n * ```tsx\n * function UserProfile() {\n * const { isAuthenticated, isLoading, user, clearAuth } = useFluidAuth();\n *\n * if (isLoading) {\n * return <Spinner />;\n * }\n *\n * if (!isAuthenticated) {\n * return <p>Please log in</p>;\n * }\n *\n * return (\n * <div>\n * <p>Welcome, {user.full_name}!</p>\n * <button onClick={clearAuth}>Log out</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useFluidAuth(): FluidAuthContextValue {\n return useFluidAuthContext();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,eAAsC;AACpD,QAAO,qBAAqB"}
|
package/dist/{use-portal-products-client-Bl-yd0Tl.cjs → use-portal-products-client-CIrRGIxC.cjs}
RENAMED
|
@@ -16,10 +16,7 @@ let react = require("react");
|
|
|
16
16
|
function createPortalProductsApiAdapter(client) {
|
|
17
17
|
return {
|
|
18
18
|
listProducts: async (params) => {
|
|
19
|
-
const response = await require_FluidProvider.products_list(client, {
|
|
20
|
-
"page[cursor]": params?.cursor,
|
|
21
|
-
"page[limit]": params?.limit
|
|
22
|
-
});
|
|
19
|
+
const response = await require_FluidProvider.products_list(client, { "page[cursor]": params?.cursor });
|
|
23
20
|
return {
|
|
24
21
|
products: response.products ?? [],
|
|
25
22
|
meta: response.meta
|
|
@@ -35,8 +32,7 @@ function createPortalProductsApiAdapter(client) {
|
|
|
35
32
|
searchProducts: async (query, params) => {
|
|
36
33
|
const response = await require_FluidProvider.products_search(client, {
|
|
37
34
|
q: query,
|
|
38
|
-
"page[cursor]": params?.cursor
|
|
39
|
-
"page[limit]": params?.limit
|
|
35
|
+
"page[cursor]": params?.cursor
|
|
40
36
|
});
|
|
41
37
|
return {
|
|
42
38
|
products: response.products ?? [],
|
|
@@ -55,13 +51,8 @@ function createPortalProductsApiAdapter(client) {
|
|
|
55
51
|
//#endregion
|
|
56
52
|
//#region src/products/use-portal-products-client.ts
|
|
57
53
|
function usePortalProductsClient() {
|
|
58
|
-
const
|
|
59
|
-
return (0, react.useMemo)(() =>
|
|
60
|
-
return createPortalProductsApiAdapter(require_FluidProvider.createFetchClient({
|
|
61
|
-
baseUrl: config.baseUrl.replace(/\/+$/, ""),
|
|
62
|
-
onAuthError: config.onAuthError
|
|
63
|
-
}));
|
|
64
|
-
}, [config.baseUrl, config.onAuthError]);
|
|
54
|
+
const client = require_FluidProvider.usePortalTenantClient();
|
|
55
|
+
return (0, react.useMemo)(() => createPortalProductsApiAdapter(client), [client]);
|
|
65
56
|
}
|
|
66
57
|
//#endregion
|
|
67
58
|
Object.defineProperty(exports, "usePortalProductsClient", {
|
|
@@ -71,4 +62,4 @@ Object.defineProperty(exports, "usePortalProductsClient", {
|
|
|
71
62
|
}
|
|
72
63
|
});
|
|
73
64
|
|
|
74
|
-
//# sourceMappingURL=use-portal-products-client-
|
|
65
|
+
//# sourceMappingURL=use-portal-products-client-CIrRGIxC.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-portal-products-client-CIrRGIxC.cjs","names":["usePortalTenantClient"],"sources":["../../../products/api-client/src/portal-tenant-adapter.ts","../src/products/use-portal-products-client.ts"],"sourcesContent":["import type {\n PortalProductsApi,\n portalProducts,\n} from \"@fluid-app/products-core\";\nimport type { FetchClient } from \"./lib/fetch-client\";\nimport { portalTenant } from \"@fluid-app/portal-tenant-api-client\";\n\n/**\n * Creates a PortalProductsApi-compatible adapter from a portal-tenant FetchClient.\n *\n * This bridges the auto-generated portal-tenant API client to the abstract\n * PortalProductsApi interface defined in @fluid-app/products-core, closing\n * over the FetchClient so consumers don't need to pass it per-call.\n *\n * Each method maps the BFF response to the port type at runtime rather than\n * using type assertions, so TypeScript catches schema drift between the\n * generated client and the hand-authored port types at compile time.\n */\nexport function createPortalProductsApiAdapter(\n client: FetchClient,\n): PortalProductsApi {\n return {\n listProducts: async (params) => {\n const response = await portalTenant.products_list(client, {\n \"page[cursor]\": params?.cursor,\n });\n return {\n products: response.products ?? [],\n meta: response.meta,\n } satisfies portalProducts.PortalProductsResponse;\n },\n\n getProduct: async (id) => {\n const response = await portalTenant.products_show(client, id);\n return {\n product: response.product ?? {},\n meta: response.meta,\n } satisfies portalProducts.PortalProductResponse;\n },\n\n searchProducts: async (query, params) => {\n const response = await portalTenant.products_search(client, {\n q: query,\n \"page[cursor]\": params?.cursor,\n });\n return {\n products: response.products ?? [],\n meta: response.meta,\n } satisfies portalProducts.PortalProductsResponse;\n },\n\n getProductMedia: async (productId) => {\n const response = await portalTenant.products_media_list(\n client,\n productId,\n );\n return {\n media: response.media ?? [],\n meta: response.meta,\n } satisfies portalProducts.PortalProductMediaResponse;\n },\n };\n}\n","import { useMemo } from \"react\";\nimport type { PortalProductsApi } from \"@fluid-app/products-core\";\nimport { createPortalProductsApiAdapter } from \"@fluid-app/products-api-client\";\nimport { usePortalTenantClient } from \"../providers/PortalTenantClientProvider\";\n\nexport function usePortalProductsClient(): PortalProductsApi {\n const client = usePortalTenantClient();\n\n return useMemo(() => createPortalProductsApiAdapter(client), [client]);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,SAAgB,+BACd,QACmB;AACnB,QAAO;EACL,cAAc,OAAO,WAAW;GAC9B,MAAM,WAAW,MAAA,sBAAA,cAAiC,QAAQ,EACxD,gBAAgB,QAAQ,QACzB,CAAC;AACF,UAAO;IACL,UAAU,SAAS,YAAY,EAAE;IACjC,MAAM,SAAS;IAChB;;EAGH,YAAY,OAAO,OAAO;GACxB,MAAM,WAAW,MAAA,sBAAA,cAAiC,QAAQ,GAAG;AAC7D,UAAO;IACL,SAAS,SAAS,WAAW,EAAE;IAC/B,MAAM,SAAS;IAChB;;EAGH,gBAAgB,OAAO,OAAO,WAAW;GACvC,MAAM,WAAW,MAAA,sBAAA,gBAAmC,QAAQ;IAC1D,GAAG;IACH,gBAAgB,QAAQ;IACzB,CAAC;AACF,UAAO;IACL,UAAU,SAAS,YAAY,EAAE;IACjC,MAAM,SAAS;IAChB;;EAGH,iBAAiB,OAAO,cAAc;GACpC,MAAM,WAAW,MAAA,sBAAA,oBACf,QACA,UACD;AACD,UAAO;IACL,OAAO,SAAS,SAAS,EAAE;IAC3B,MAAM,SAAS;IAChB;;EAEJ;;;;ACxDH,SAAgB,0BAA6C;CAC3D,MAAM,SAASA,sBAAAA,uBAAuB;AAEtC,SAAA,GAAA,MAAA,eAAqB,+BAA+B,OAAO,EAAE,CAAC,OAAO,CAAC"}
|
package/dist/{use-portal-products-client-tJi4q54S.mjs → use-portal-products-client-dV5jIXpp.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ct as products_search, lt as products_show,
|
|
1
|
+
import { ct as products_search, lt as products_show, ot as products_list, st as products_media_list, u as usePortalTenantClient } from "./FluidProvider-BUdNsR8f.mjs";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
//#region ../../products/api-client/src/portal-tenant-adapter.ts
|
|
4
4
|
/**
|
|
@@ -15,10 +15,7 @@ import { useMemo } from "react";
|
|
|
15
15
|
function createPortalProductsApiAdapter(client) {
|
|
16
16
|
return {
|
|
17
17
|
listProducts: async (params) => {
|
|
18
|
-
const response = await products_list(client, {
|
|
19
|
-
"page[cursor]": params?.cursor,
|
|
20
|
-
"page[limit]": params?.limit
|
|
21
|
-
});
|
|
18
|
+
const response = await products_list(client, { "page[cursor]": params?.cursor });
|
|
22
19
|
return {
|
|
23
20
|
products: response.products ?? [],
|
|
24
21
|
meta: response.meta
|
|
@@ -34,8 +31,7 @@ function createPortalProductsApiAdapter(client) {
|
|
|
34
31
|
searchProducts: async (query, params) => {
|
|
35
32
|
const response = await products_search(client, {
|
|
36
33
|
q: query,
|
|
37
|
-
"page[cursor]": params?.cursor
|
|
38
|
-
"page[limit]": params?.limit
|
|
34
|
+
"page[cursor]": params?.cursor
|
|
39
35
|
});
|
|
40
36
|
return {
|
|
41
37
|
products: response.products ?? [],
|
|
@@ -54,15 +50,10 @@ function createPortalProductsApiAdapter(client) {
|
|
|
54
50
|
//#endregion
|
|
55
51
|
//#region src/products/use-portal-products-client.ts
|
|
56
52
|
function usePortalProductsClient() {
|
|
57
|
-
const
|
|
58
|
-
return useMemo(() =>
|
|
59
|
-
return createPortalProductsApiAdapter(createFetchClient({
|
|
60
|
-
baseUrl: config.baseUrl.replace(/\/+$/, ""),
|
|
61
|
-
onAuthError: config.onAuthError
|
|
62
|
-
}));
|
|
63
|
-
}, [config.baseUrl, config.onAuthError]);
|
|
53
|
+
const client = usePortalTenantClient();
|
|
54
|
+
return useMemo(() => createPortalProductsApiAdapter(client), [client]);
|
|
64
55
|
}
|
|
65
56
|
//#endregion
|
|
66
57
|
export { usePortalProductsClient as t };
|
|
67
58
|
|
|
68
|
-
//# sourceMappingURL=use-portal-products-client-
|
|
59
|
+
//# sourceMappingURL=use-portal-products-client-dV5jIXpp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-portal-products-client-dV5jIXpp.mjs","names":["portalTenant.products_list","portalTenant.products_show","portalTenant.products_search","portalTenant.products_media_list"],"sources":["../../../products/api-client/src/portal-tenant-adapter.ts","../src/products/use-portal-products-client.ts"],"sourcesContent":["import type {\n PortalProductsApi,\n portalProducts,\n} from \"@fluid-app/products-core\";\nimport type { FetchClient } from \"./lib/fetch-client\";\nimport { portalTenant } from \"@fluid-app/portal-tenant-api-client\";\n\n/**\n * Creates a PortalProductsApi-compatible adapter from a portal-tenant FetchClient.\n *\n * This bridges the auto-generated portal-tenant API client to the abstract\n * PortalProductsApi interface defined in @fluid-app/products-core, closing\n * over the FetchClient so consumers don't need to pass it per-call.\n *\n * Each method maps the BFF response to the port type at runtime rather than\n * using type assertions, so TypeScript catches schema drift between the\n * generated client and the hand-authored port types at compile time.\n */\nexport function createPortalProductsApiAdapter(\n client: FetchClient,\n): PortalProductsApi {\n return {\n listProducts: async (params) => {\n const response = await portalTenant.products_list(client, {\n \"page[cursor]\": params?.cursor,\n });\n return {\n products: response.products ?? [],\n meta: response.meta,\n } satisfies portalProducts.PortalProductsResponse;\n },\n\n getProduct: async (id) => {\n const response = await portalTenant.products_show(client, id);\n return {\n product: response.product ?? {},\n meta: response.meta,\n } satisfies portalProducts.PortalProductResponse;\n },\n\n searchProducts: async (query, params) => {\n const response = await portalTenant.products_search(client, {\n q: query,\n \"page[cursor]\": params?.cursor,\n });\n return {\n products: response.products ?? [],\n meta: response.meta,\n } satisfies portalProducts.PortalProductsResponse;\n },\n\n getProductMedia: async (productId) => {\n const response = await portalTenant.products_media_list(\n client,\n productId,\n );\n return {\n media: response.media ?? [],\n meta: response.meta,\n } satisfies portalProducts.PortalProductMediaResponse;\n },\n };\n}\n","import { useMemo } from \"react\";\nimport type { PortalProductsApi } from \"@fluid-app/products-core\";\nimport { createPortalProductsApiAdapter } from \"@fluid-app/products-api-client\";\nimport { usePortalTenantClient } from \"../providers/PortalTenantClientProvider\";\n\nexport function usePortalProductsClient(): PortalProductsApi {\n const client = usePortalTenantClient();\n\n return useMemo(() => createPortalProductsApiAdapter(client), [client]);\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,SAAgB,+BACd,QACmB;AACnB,QAAO;EACL,cAAc,OAAO,WAAW;GAC9B,MAAM,WAAW,MAAMA,cAA2B,QAAQ,EACxD,gBAAgB,QAAQ,QACzB,CAAC;AACF,UAAO;IACL,UAAU,SAAS,YAAY,EAAE;IACjC,MAAM,SAAS;IAChB;;EAGH,YAAY,OAAO,OAAO;GACxB,MAAM,WAAW,MAAMC,cAA2B,QAAQ,GAAG;AAC7D,UAAO;IACL,SAAS,SAAS,WAAW,EAAE;IAC/B,MAAM,SAAS;IAChB;;EAGH,gBAAgB,OAAO,OAAO,WAAW;GACvC,MAAM,WAAW,MAAMC,gBAA6B,QAAQ;IAC1D,GAAG;IACH,gBAAgB,QAAQ;IACzB,CAAC;AACF,UAAO;IACL,UAAU,SAAS,YAAY,EAAE;IACjC,MAAM,SAAS;IAChB;;EAGH,iBAAiB,OAAO,cAAc;GACpC,MAAM,WAAW,MAAMC,oBACrB,QACA,UACD;AACD,UAAO;IACL,OAAO,SAAS,SAAS,EAAE;IAC3B,MAAM,SAAS;IAChB;;EAEJ;;;;ACxDH,SAAgB,0BAA6C;CAC3D,MAAM,SAAS,uBAAuB;AAEtC,QAAO,cAAc,+BAA+B,OAAO,EAAE,CAAC,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-app/portal-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.133",
|
|
4
4
|
"description": "SDK for building custom Fluid portals",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -72,50 +72,50 @@
|
|
|
72
72
|
"typescript": "^5",
|
|
73
73
|
"zod": "4.3.5",
|
|
74
74
|
"@fluid-app/api-client-core": "0.1.0",
|
|
75
|
-
"@fluid-app/cart-ui": "0.1.13",
|
|
76
75
|
"@fluid-app/auth": "0.1.0",
|
|
77
76
|
"@fluid-app/company-switcher-core": "0.1.0",
|
|
78
77
|
"@fluid-app/company-switcher-ui": "0.1.0",
|
|
78
|
+
"@fluid-app/cart-ui": "0.1.13",
|
|
79
|
+
"@fluid-app/contacts-core": "0.1.0",
|
|
79
80
|
"@fluid-app/contacts-api-client": "0.1.0",
|
|
80
|
-
"@fluid-app/fluidos-api-client": "0.1.0",
|
|
81
|
-
"@fluid-app/fluid-pay-api-client": "0.1.0",
|
|
82
81
|
"@fluid-app/contacts-ui": "0.1.0",
|
|
83
|
-
"@fluid-app/fluid-pay-core": "0.1.0",
|
|
84
|
-
"@fluid-app/contacts-core": "0.1.0",
|
|
85
82
|
"@fluid-app/file-picker-api-client": "0.1.0",
|
|
86
|
-
"@fluid-app/
|
|
83
|
+
"@fluid-app/fluid-pay-core": "0.1.0",
|
|
84
|
+
"@fluid-app/fluidos-api-client": "0.1.0",
|
|
85
|
+
"@fluid-app/fluid-pay-api-client": "0.1.0",
|
|
87
86
|
"@fluid-app/messaging-api-client": "0.1.0",
|
|
88
87
|
"@fluid-app/messaging-ui": "0.1.0",
|
|
89
|
-
"@fluid-app/
|
|
88
|
+
"@fluid-app/messaging-core": "0.1.0",
|
|
90
89
|
"@fluid-app/mysite-ui": "0.1.0",
|
|
91
90
|
"@fluid-app/orders-api-client": "0.1.0",
|
|
91
|
+
"@fluid-app/orders-core": "0.1.0",
|
|
92
92
|
"@fluid-app/orders-ui": "0.1.0",
|
|
93
|
-
"@fluid-app/permissions": "0.1.0",
|
|
94
|
-
"@fluid-app/portal-core": "0.1.23",
|
|
95
93
|
"@fluid-app/portal-app-download-ui": "0.1.0",
|
|
96
|
-
"@fluid-app/portal-
|
|
97
|
-
"@fluid-app/
|
|
94
|
+
"@fluid-app/portal-core": "0.1.23",
|
|
95
|
+
"@fluid-app/permissions": "0.1.0",
|
|
98
96
|
"@fluid-app/portal-preview": "0.1.0",
|
|
97
|
+
"@fluid-app/portal-pro-upgrade-ui": "0.1.0",
|
|
98
|
+
"@fluid-app/portal-react": "0.1.0",
|
|
99
99
|
"@fluid-app/portal-tenant-api-client": "0.1.0",
|
|
100
100
|
"@fluid-app/portal-tenant-contacts-api-client": "0.1.0",
|
|
101
|
+
"@fluid-app/portal-tenant-mysite-api-client": "0.1.0",
|
|
101
102
|
"@fluid-app/portal-widgets": "0.1.22",
|
|
102
103
|
"@fluid-app/portal-tenant-pay-api-client": "0.1.0",
|
|
103
|
-
"@fluid-app/products-core": "0.1.0",
|
|
104
104
|
"@fluid-app/products-api-client": "0.1.0",
|
|
105
|
-
"@fluid-app/portal-tenant-mysite-api-client": "0.1.0",
|
|
106
105
|
"@fluid-app/profile-core": "0.1.0",
|
|
106
|
+
"@fluid-app/products-core": "0.1.0",
|
|
107
107
|
"@fluid-app/profile-ui": "0.1.0",
|
|
108
108
|
"@fluid-app/query-persister": "0.1.0",
|
|
109
109
|
"@fluid-app/shareables-api-client": "0.1.0",
|
|
110
|
-
"@fluid-app/shareables-ui": "0.1.0",
|
|
111
110
|
"@fluid-app/shareables-core": "0.1.0",
|
|
111
|
+
"@fluid-app/shareables-ui": "0.1.0",
|
|
112
112
|
"@fluid-app/shop-ui": "0.1.0",
|
|
113
|
+
"@fluid-app/subscriptions-api-client": "0.1.0",
|
|
113
114
|
"@fluid-app/subscriptions-core": "0.1.0",
|
|
114
115
|
"@fluid-app/store-api-client": "0.1.0",
|
|
115
|
-
"@fluid-app/subscriptions-api-client": "0.1.0",
|
|
116
116
|
"@fluid-app/subscriptions-ui": "0.1.0",
|
|
117
|
-
"@fluid-app/
|
|
118
|
-
"@fluid-app/
|
|
117
|
+
"@fluid-app/typescript-config": "0.0.0",
|
|
118
|
+
"@fluid-app/ui-primitives": "0.1.13"
|
|
119
119
|
},
|
|
120
120
|
"peerDependencies": {
|
|
121
121
|
"@hookform/resolvers": "^5.2.2",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import "./FluidProvider-B-f_JVal.mjs";
|
|
2
|
-
import "./PointsWidget-DgLGU995.mjs";
|
|
3
|
-
import "./error-state-BGEvTYIh.mjs";
|
|
4
|
-
import "./ScreenRenderer-DM-G72GL.mjs";
|
|
5
|
-
import "./WidgetInteractionContext-DAN31Alw.mjs";
|
|
6
|
-
import "./EmbedWidget-BQYixJLj.mjs";
|
|
7
|
-
import "./LayoutWidget-BFO_PHWw.mjs";
|
|
8
|
-
import "./registries-CM_NlECC.mjs";
|
|
9
|
-
import "./fields-BarozcnJ.mjs";
|
|
10
|
-
import "./TextWidget-CzUlNmCl.mjs";
|
|
11
|
-
import "./AlertWidget-WQ_XPDRo.mjs";
|
|
12
|
-
import "./BulletListWidget-BYcaQnVH.mjs";
|
|
13
|
-
import "./CalendarWidget-Qb-utCFD.mjs";
|
|
14
|
-
import "./CardWidget-zVxobZDH.mjs";
|
|
15
|
-
import "./purify.es-CfNPLbup.mjs";
|
|
16
|
-
import "./src-Duo2Iuw-.mjs";
|
|
17
|
-
import { n as messagingScreenPropertySchema, t as MessagingScreen } from "./MessagingScreen-COWASb0E.mjs";
|
|
18
|
-
import "./scroll-arrows-C4VRsVrO.mjs";
|
|
19
|
-
import "./MediaRenderer-Cfvg51w8.mjs";
|
|
20
|
-
import "./CarouselWidget-dpRCljEx.mjs";
|
|
21
|
-
import "./CatchUpWidget-CSIXsR82.mjs";
|
|
22
|
-
import "./ChartWidget-88hpX7ft.mjs";
|
|
23
|
-
import "./ContainerWidget-DNS7ynby.mjs";
|
|
24
|
-
import "./ImageWidget-DE9Fp_oH.mjs";
|
|
25
|
-
import "./LinkWidget-JSoDi-ag.mjs";
|
|
26
|
-
import "./ListWidget-CBLZ8CjD.mjs";
|
|
27
|
-
import "./MySiteWidget-BqtLSExC.mjs";
|
|
28
|
-
import "./NestedWidget-DIwW-wM7.mjs";
|
|
29
|
-
import "./QuickShareWidget-CajKauDa.mjs";
|
|
30
|
-
import "./RecentActivityWidget-BZYB21eR.mjs";
|
|
31
|
-
import "./SeparatorWidget-Lsd6juu7.mjs";
|
|
32
|
-
import "./SpacerWidget-B3zkEePP.mjs";
|
|
33
|
-
import "./TableWidget-Xz0d4UH5.mjs";
|
|
34
|
-
import "./ToDoWidget-qyFLHU_o.mjs";
|
|
35
|
-
import "./VideoWidget-CpUPsOI7.mjs";
|
|
36
|
-
import "./dist-CMGXkSgZ.mjs";
|
|
37
|
-
import "./es-BcjHf1ZX.mjs";
|
|
38
|
-
export { MessagingScreen, messagingScreenPropertySchema };
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
const require_use_current_user = require("./use-current-user-DISrPz9d.cjs");
|
|
3
|
-
const require_AppNavigationContext = require("./AppNavigationContext-Agp0UkCQ.cjs");
|
|
4
|
-
const require_use_account_clients = require("./use-account-clients-CH92XyHh.cjs");
|
|
5
|
-
const require_src = require("./src-DIcd2_ex.cjs");
|
|
6
|
-
const require_use_portal_products_client = require("./use-portal-products-client-Bl-yd0Tl.cjs");
|
|
7
|
-
const require_src$1 = require("./src-CMByt6YP.cjs");
|
|
8
|
-
let react = require("react");
|
|
9
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
-
//#region src/screens/ProductsScreen.tsx
|
|
11
|
-
function ProductsScreen({ background, textColor, accentColor, padding, borderRadius, ...divProps }) {
|
|
12
|
-
const domainClient = require_use_account_clients.useSdkClient();
|
|
13
|
-
const portalProductsApi = require_use_portal_products_client.usePortalProductsClient();
|
|
14
|
-
const { data: userData } = require_use_current_user.useCurrentUser();
|
|
15
|
-
const { currentSlug, navigate } = require_AppNavigationContext.useAppNavigation();
|
|
16
|
-
const fetchProducts = (0, react.useCallback)(async (search, cursor, limit) => {
|
|
17
|
-
if (search) return portalProductsApi.searchProducts(search, {
|
|
18
|
-
cursor,
|
|
19
|
-
limit
|
|
20
|
-
});
|
|
21
|
-
return portalProductsApi.listProducts({
|
|
22
|
-
cursor,
|
|
23
|
-
limit
|
|
24
|
-
});
|
|
25
|
-
}, [portalProductsApi]);
|
|
26
|
-
const fetchProduct = (0, react.useCallback)(async (id) => portalProductsApi.getProduct(id), [portalProductsApi]);
|
|
27
|
-
const productId = (0, react.useMemo)(() => {
|
|
28
|
-
return currentSlug.match(/^products\/(.+)/)?.[1] ?? null;
|
|
29
|
-
}, [currentSlug]);
|
|
30
|
-
const handleSelectProduct = (0, react.useCallback)((id) => {
|
|
31
|
-
navigate(`products/${id}`);
|
|
32
|
-
}, [navigate]);
|
|
33
|
-
const handleBack = (0, react.useCallback)(() => {
|
|
34
|
-
navigate("products");
|
|
35
|
-
}, [navigate]);
|
|
36
|
-
const coreConfig = (0, react.useMemo)(() => ({
|
|
37
|
-
client: domainClient,
|
|
38
|
-
user: userData ? { id: userData.id } : null,
|
|
39
|
-
repContext: true
|
|
40
|
-
}), [domainClient, userData]);
|
|
41
|
-
const shareablesApi = (0, react.useMemo)(() => require_src$1.createShareablesApiAdapter(domainClient, { repContext: true }), [domainClient]);
|
|
42
|
-
const uiConfig = (0, react.useMemo)(() => ({
|
|
43
|
-
user: userData ? {
|
|
44
|
-
id: userData.id,
|
|
45
|
-
company: userData.company ? { logo_url: userData.company.logo_url } : null
|
|
46
|
-
} : void 0,
|
|
47
|
-
basePath: "",
|
|
48
|
-
navigate: (path) => {
|
|
49
|
-
navigate(path);
|
|
50
|
-
},
|
|
51
|
-
showToast: (opts) => {
|
|
52
|
-
console.log(`[Products] ${opts.type}: ${opts.title}`);
|
|
53
|
-
}
|
|
54
|
-
}), [userData, navigate]);
|
|
55
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
56
|
-
...divProps,
|
|
57
|
-
className: `h-full ${divProps.className ?? ""}`,
|
|
58
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.ShareablesCoreProvider, {
|
|
59
|
-
config: coreConfig,
|
|
60
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.ShareablesApiProvider, {
|
|
61
|
-
api: shareablesApi,
|
|
62
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.ShareablesUIProvider, {
|
|
63
|
-
config: uiConfig,
|
|
64
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.ProductsApp, {
|
|
65
|
-
countryCode: userData?.country?.iso,
|
|
66
|
-
companyLogoUrl: userData?.company?.logo_url,
|
|
67
|
-
fetchProducts,
|
|
68
|
-
fetchProduct,
|
|
69
|
-
productId,
|
|
70
|
-
onSelectProduct: handleSelectProduct,
|
|
71
|
-
onBack: handleBack
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
})
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
const productsScreenPropertySchema = {
|
|
79
|
-
widgetType: "ProductsScreen",
|
|
80
|
-
displayName: "Products Screen",
|
|
81
|
-
tabsConfig: [{
|
|
82
|
-
id: "styling",
|
|
83
|
-
label: "Styling"
|
|
84
|
-
}],
|
|
85
|
-
fields: []
|
|
86
|
-
};
|
|
87
|
-
//#endregion
|
|
88
|
-
Object.defineProperty(exports, "ProductsScreen", {
|
|
89
|
-
enumerable: true,
|
|
90
|
-
get: function() {
|
|
91
|
-
return ProductsScreen;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
Object.defineProperty(exports, "productsScreenPropertySchema", {
|
|
95
|
-
enumerable: true,
|
|
96
|
-
get: function() {
|
|
97
|
-
return productsScreenPropertySchema;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
//# sourceMappingURL=ProductsScreen-BHeRiKUM.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProductsScreen-BHeRiKUM.cjs","names":["useSdkClient","usePortalProductsClient","useCurrentUser","useAppNavigation","createShareablesApiAdapter","ShareablesCoreProvider","ShareablesApiProvider","ShareablesUIProvider","ProductsApp"],"sources":["../src/screens/ProductsScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport {\n ShareablesCoreProvider,\n ShareablesApiProvider,\n type ShareablesApi,\n} from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ProductsApp } from \"@fluid-app/shareables-ui\";\nimport { createShareablesApiAdapter } from \"@fluid-app/shareables-api-client\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\nimport { usePortalProductsClient } from \"../products/use-portal-products-client\";\n\ntype ProductsScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\nexport function ProductsScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ProductsScreenProps): React.JSX.Element {\n const domainClient = useSdkClient();\n const portalProductsApi = usePortalProductsClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\n\n const fetchProducts = useCallback(\n async (search: string, cursor?: string, limit?: number) => {\n if (search) {\n return portalProductsApi.searchProducts(search, { cursor, limit });\n }\n return portalProductsApi.listProducts({ cursor, limit });\n },\n [portalProductsApi],\n );\n\n const fetchProduct = useCallback(\n async (id: string | number) => portalProductsApi.getProduct(id),\n [portalProductsApi],\n );\n\n // Extract product ID from slug: \"products/123\" → \"123\"\n const productId = useMemo(() => {\n const match = currentSlug.match(/^products\\/(.+)/);\n return match?.[1] ?? null;\n }, [currentSlug]);\n\n const handleSelectProduct = useCallback(\n (id: string) => {\n navigate(`products/${id}`);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n navigate(\"products\");\n }, [navigate]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n repContext: true,\n }),\n [domainClient, userData],\n );\n\n const shareablesApi = useMemo<ShareablesApi>(\n () => createShareablesApiAdapter(domainClient, { repContext: true }),\n [domainClient],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n basePath: \"\",\n navigate: (path: string) => {\n navigate(path);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n }) => {\n console.log(`[Products] ${opts.type}: ${opts.title}`);\n },\n }),\n [userData, navigate],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesApiProvider api={shareablesApi}>\n <ShareablesUIProvider config={uiConfig}>\n <ProductsApp\n countryCode={userData?.country?.iso}\n companyLogoUrl={userData?.company?.logo_url}\n fetchProducts={fetchProducts}\n fetchProduct={fetchProduct}\n productId={productId}\n onSelectProduct={handleSelectProduct}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesApiProvider>\n </ShareablesCoreProvider>\n </div>\n );\n}\n\nexport const productsScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ProductsScreen\",\n displayName: \"Products Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;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