@fluid-app/portal-sdk 0.1.71 → 0.1.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AppDownloadScreen-BXWBVnQM.cjs → AppDownloadScreen-7TQv3Yqk.cjs} +2 -2
- package/dist/{AppDownloadScreen-BXWBVnQM.cjs.map → AppDownloadScreen-7TQv3Yqk.cjs.map} +1 -1
- package/dist/{AppDownloadScreen-BXS02LRb.mjs → AppDownloadScreen-BDkQYUYF.mjs} +2 -2
- package/dist/{AppDownloadScreen-BXS02LRb.mjs.map → AppDownloadScreen-BDkQYUYF.mjs.map} +1 -1
- package/dist/{AppDownloadScreen-BVrUR6lm.mjs → AppDownloadScreen-BRN8j8oq.mjs} +7 -7
- package/dist/{AppDownloadScreen-BtwySuUY.cjs → AppDownloadScreen-Bibphw78.cjs} +7 -7
- package/dist/{CarouselWidget-DgskhtDP.cjs → CarouselWidget-BFYntrZQ.cjs} +2 -2
- package/dist/{CarouselWidget-DgskhtDP.cjs.map → CarouselWidget-BFYntrZQ.cjs.map} +1 -1
- package/dist/{CarouselWidget-BGdjG-xz.mjs → CarouselWidget-Bt1qOfyr.mjs} +2 -2
- package/dist/{CarouselWidget-BGdjG-xz.mjs.map → CarouselWidget-Bt1qOfyr.mjs.map} +1 -1
- package/dist/{CarouselWidget-CC6ZQZ8e.cjs → CarouselWidget-xDuWJsf-.cjs} +2 -2
- package/dist/{ChartWidget-BdNpOMhz.cjs → ChartWidget-BS4O1EOU.cjs} +2 -2
- package/dist/{ChartWidget-DSaru9Bb.mjs → ChartWidget-Cl5tEkUp.mjs} +2 -2
- package/dist/{ChartWidget-DSaru9Bb.mjs.map → ChartWidget-Cl5tEkUp.mjs.map} +1 -1
- package/dist/{ChartWidget-CS600CjN.cjs → ChartWidget-Dj_Rjkb8.cjs} +2 -2
- package/dist/{ChartWidget-CS600CjN.cjs.map → ChartWidget-Dj_Rjkb8.cjs.map} +1 -1
- package/dist/{ContactsScreen-C_c2yy5J.cjs → ContactsScreen-BpWSKKkQ.cjs} +8 -8
- package/dist/{ContactsScreen-B3k1fVQx.cjs → ContactsScreen-BvykfPOl.cjs} +4 -4
- package/dist/{ContactsScreen-B3k1fVQx.cjs.map → ContactsScreen-BvykfPOl.cjs.map} +1 -1
- package/dist/{ContactsScreen-CH6u8cRi.mjs → ContactsScreen-DXmgTj5G.mjs} +4 -4
- package/dist/{ContactsScreen-CH6u8cRi.mjs.map → ContactsScreen-DXmgTj5G.mjs.map} +1 -1
- package/dist/{ContactsScreen-ruymx9Pi.mjs → ContactsScreen-Ds1Tde6r.mjs} +8 -8
- package/dist/{FluidProvider-uuu90TSG.mjs → FluidProvider-BMxf7_8j.mjs} +9 -9
- package/dist/{FluidProvider-uuu90TSG.mjs.map → FluidProvider-BMxf7_8j.mjs.map} +1 -1
- package/dist/{FluidProvider-SnHdl4ww.cjs → FluidProvider-Dqj1m2GK.cjs} +9 -9
- package/dist/{FluidProvider-SnHdl4ww.cjs.map → FluidProvider-Dqj1m2GK.cjs.map} +1 -1
- package/dist/{LinkWidget-Bvw5OZwU.cjs → LinkWidget-9g8PsB_X.cjs} +2 -2
- package/dist/{LinkWidget-Bvw5OZwU.cjs.map → LinkWidget-9g8PsB_X.cjs.map} +1 -1
- package/dist/{LinkWidget-hhWO8yWC.cjs → LinkWidget-A_eWNLdm.cjs} +2 -2
- package/dist/{LinkWidget-dwIVKZD0.mjs → LinkWidget-BSCD6Gnm.mjs} +2 -2
- package/dist/{LinkWidget-dwIVKZD0.mjs.map → LinkWidget-BSCD6Gnm.mjs.map} +1 -1
- package/dist/{MessagingScreen-CGS474IP.mjs → MessagingScreen-85gpbRSW.mjs} +8 -8
- package/dist/{MessagingScreen-C7xDqpLm.cjs → MessagingScreen-BsR-IDc3.cjs} +7 -7
- package/dist/{MessagingScreen-tFbOXFq4.mjs → MessagingScreen-DKOjEkb6.mjs} +5 -5
- package/dist/{MessagingScreen-tFbOXFq4.mjs.map → MessagingScreen-DKOjEkb6.mjs.map} +1 -1
- package/dist/{MessagingScreen-27HyrQ1V.cjs → MessagingScreen-xPClL7GU.cjs} +4 -4
- package/dist/{MessagingScreen-27HyrQ1V.cjs.map → MessagingScreen-xPClL7GU.cjs.map} +1 -1
- package/dist/{MySiteScreen-DR_xY95c.mjs → MySiteScreen-CCJYG1Dy.mjs} +3 -3
- package/dist/{MySiteScreen-DR_xY95c.mjs.map → MySiteScreen-CCJYG1Dy.mjs.map} +1 -1
- package/dist/{MySiteScreen-bUfo9RDR.mjs → MySiteScreen-DALAbAWu.mjs} +7 -7
- package/dist/{MySiteScreen-B_UnnWDX.cjs → MySiteScreen-DobLvICT.cjs} +7 -7
- package/dist/{MySiteScreen-C-cS0_qZ.cjs → MySiteScreen-m22db4Tc.cjs} +3 -3
- package/dist/{MySiteScreen-C-cS0_qZ.cjs.map → MySiteScreen-m22db4Tc.cjs.map} +1 -1
- package/dist/{OrdersScreen-OexJlI4Y.cjs → OrdersScreen-C0gj-cxi.cjs} +5 -5
- package/dist/{OrdersScreen-OexJlI4Y.cjs.map → OrdersScreen-C0gj-cxi.cjs.map} +1 -1
- package/dist/{OrdersScreen-CQzgIEa4.mjs → OrdersScreen-Ci6pbdBP.mjs} +5 -5
- package/dist/{OrdersScreen-CQzgIEa4.mjs.map → OrdersScreen-Ci6pbdBP.mjs.map} +1 -1
- package/dist/{OrdersScreen-CO9vm0Wj.mjs → OrdersScreen-CsQ8UEik.mjs} +8 -8
- package/dist/{OrdersScreen-JCVS__ag.cjs → OrdersScreen-h34Ai_ng.cjs} +8 -8
- package/dist/{ProductsScreen-BcM3LqsG.cjs → ProductsScreen-B2aWFjRn.cjs} +8 -8
- package/dist/{ProductsScreen-BgVl8GAm.cjs → ProductsScreen-CdpOBRnN.cjs} +4 -4
- package/dist/{ProductsScreen-BgVl8GAm.cjs.map → ProductsScreen-CdpOBRnN.cjs.map} +1 -1
- package/dist/{ProductsScreen-GOW8lxiN.mjs → ProductsScreen-DsR5ONUJ.mjs} +9 -9
- package/dist/{ProductsScreen-B0BsPJth.mjs → ProductsScreen-K7snFJkp.mjs} +4 -4
- package/dist/{ProductsScreen-B0BsPJth.mjs.map → ProductsScreen-K7snFJkp.mjs.map} +1 -1
- package/dist/{ProfileScreen-Tcqc5WfU.mjs → ProfileScreen-BFJYYi0q.mjs} +7 -7
- package/dist/{ProfileScreen-e-uj2ulO.cjs → ProfileScreen-B_3gfD_i.cjs} +7 -7
- package/dist/{ProfileScreen-DFM_r4T5.cjs → ProfileScreen-B_LAuEoi.cjs} +4 -4
- package/dist/{ProfileScreen-DFM_r4T5.cjs.map → ProfileScreen-B_LAuEoi.cjs.map} +1 -1
- package/dist/{ProfileScreen-pvpnY0cG.mjs → ProfileScreen-Cp4Mrgux.mjs} +4 -4
- package/dist/{ProfileScreen-pvpnY0cG.mjs.map → ProfileScreen-Cp4Mrgux.mjs.map} +1 -1
- package/dist/{ShareablesScreen-C7M_kGX9.cjs → ShareablesScreen-Bs1GSq4_.cjs} +4 -4
- package/dist/{ShareablesScreen-C7M_kGX9.cjs.map → ShareablesScreen-Bs1GSq4_.cjs.map} +1 -1
- package/dist/{ShareablesScreen-KFwyduqD.mjs → ShareablesScreen-CbJcwq6z.mjs} +9 -9
- package/dist/{ShareablesScreen-8rSANBth.cjs → ShareablesScreen-Dc62JyfM.cjs} +8 -8
- package/dist/{ShareablesScreen-SS9rcLym.mjs → ShareablesScreen-HrBPki3d.mjs} +4 -4
- package/dist/{ShareablesScreen-SS9rcLym.mjs.map → ShareablesScreen-HrBPki3d.mjs.map} +1 -1
- package/dist/{ShopScreen-XGC180Ts.mjs → ShopScreen-BHI08VYS.mjs} +5 -5
- package/dist/{ShopScreen-XGC180Ts.mjs.map → ShopScreen-BHI08VYS.mjs.map} +1 -1
- package/dist/{ShopScreen-CMkEtT1s.mjs → ShopScreen-D6v-JlCL.mjs} +7 -7
- package/dist/{ShopScreen-Bo9Bbpg8.cjs → ShopScreen-DenJE12S.cjs} +7 -7
- package/dist/{ShopScreen-D-1WO4sB.cjs → ShopScreen-uG4ymlNd.cjs} +5 -5
- package/dist/{ShopScreen-D-1WO4sB.cjs.map → ShopScreen-uG4ymlNd.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-Vn6EN634.cjs → SubscriptionsScreen-C5y5f-Y_.cjs} +5 -5
- package/dist/{SubscriptionsScreen-Vn6EN634.cjs.map → SubscriptionsScreen-C5y5f-Y_.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-50w7SgWX.mjs → SubscriptionsScreen-CYS7lSKa.mjs} +5 -5
- package/dist/{SubscriptionsScreen-50w7SgWX.mjs.map → SubscriptionsScreen-CYS7lSKa.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-BVLHc7-p.mjs → SubscriptionsScreen-D6DbzsKB.mjs} +8 -8
- package/dist/{SubscriptionsScreen-DKI17q_K.cjs → SubscriptionsScreen-x-hG5H0M.cjs} +8 -8
- package/dist/{TableWidget-CcPSLT0B.cjs → TableWidget-3f5y9RqX.cjs} +2 -2
- package/dist/{TableWidget-DjYabx1e.mjs → TableWidget-CWSQnNLl.mjs} +2 -2
- package/dist/{TableWidget-DjYabx1e.mjs.map → TableWidget-CWSQnNLl.mjs.map} +1 -1
- package/dist/{TableWidget-Cri6r5Yr.cjs → TableWidget-rYwoKBuC.cjs} +2 -2
- package/dist/{TableWidget-Cri6r5Yr.cjs.map → TableWidget-rYwoKBuC.cjs.map} +1 -1
- package/dist/{UpgradeScreen-BbP-0Pcg.cjs → UpgradeScreen-BwYEAmkp.cjs} +2 -2
- package/dist/{UpgradeScreen-BbP-0Pcg.cjs.map → UpgradeScreen-BwYEAmkp.cjs.map} +1 -1
- package/dist/{UpgradeScreen-D7LfdVSJ.mjs → UpgradeScreen-DwhybKwu.mjs} +2 -2
- package/dist/{UpgradeScreen-D7LfdVSJ.mjs.map → UpgradeScreen-DwhybKwu.mjs.map} +1 -1
- package/dist/{UpgradeScreen-DJKNVL-O.cjs → UpgradeScreen-Dzeu1jqQ.cjs} +2 -2
- package/dist/{es-CrIkZTQ3.mjs → es-BzmMF_gE.mjs} +2 -2
- package/dist/{es-CrIkZTQ3.mjs.map → es-BzmMF_gE.mjs.map} +1 -1
- package/dist/index.cjs +44 -44
- package/dist/index.mjs +45 -45
- package/dist/{order-detail-DkMYJvzl.mjs → order-detail-C8Qta7xt.mjs} +2 -2
- package/dist/{order-detail-DkMYJvzl.mjs.map → order-detail-C8Qta7xt.mjs.map} +1 -1
- package/dist/{order-detail-JVq0-ps1.cjs → order-detail-S0QZ8p5Z.cjs} +2 -2
- package/dist/{order-detail-JVq0-ps1.cjs.map → order-detail-S0QZ8p5Z.cjs.map} +1 -1
- package/dist/{src-Bh-9OV8i.mjs → src-BPlLx20V.mjs} +18 -18
- package/dist/src-BPlLx20V.mjs.map +1 -0
- package/dist/{src-D1poJLOQ.cjs → src-D6ED_OgR.cjs} +2 -2
- package/dist/{src-D1poJLOQ.cjs.map → src-D6ED_OgR.cjs.map} +1 -1
- package/dist/{src-CzK-t4_m.mjs → src-DQnYIQKC.mjs} +3 -3
- package/dist/{src-CzK-t4_m.mjs.map → src-DQnYIQKC.mjs.map} +1 -1
- package/dist/{src-DqIS-4ns.cjs → src-DdJSkS2k.cjs} +18 -18
- package/dist/src-DdJSkS2k.cjs.map +1 -0
- package/dist/{use-account-clients-Bem920_7.cjs → use-account-clients-DrWcf8IN.cjs} +2 -2
- package/dist/{use-account-clients-Bem920_7.cjs.map → use-account-clients-DrWcf8IN.cjs.map} +1 -1
- package/dist/{use-account-clients-FUcF1B-z.mjs → use-account-clients-iJVMmnbv.mjs} +2 -2
- package/dist/{use-account-clients-FUcF1B-z.mjs.map → use-account-clients-iJVMmnbv.mjs.map} +1 -1
- package/dist/{use-current-user-Bld9wMVT.cjs → use-current-user-B-pNBKKk.cjs} +3 -3
- package/dist/{use-current-user-Bld9wMVT.cjs.map → use-current-user-B-pNBKKk.cjs.map} +1 -1
- package/dist/{use-current-user-DnBpWIw6.mjs → use-current-user-C52Qw6if.mjs} +3 -3
- package/dist/{use-current-user-DnBpWIw6.mjs.map → use-current-user-C52Qw6if.mjs.map} +1 -1
- package/dist/{use-customer-account-Rm2QXJiZ.cjs → use-customer-account-BWhY4Tam.cjs} +3 -3
- package/dist/{use-customer-account-Rm2QXJiZ.cjs.map → use-customer-account-BWhY4Tam.cjs.map} +1 -1
- package/dist/{use-customer-account-Dix8Ja5O.mjs → use-customer-account-C9_Xb6x-.mjs} +3 -3
- package/dist/{use-customer-account-Dix8Ja5O.mjs.map → use-customer-account-C9_Xb6x-.mjs.map} +1 -1
- package/dist/{use-fluid-api-CedscoxF.mjs → use-fluid-api-Cvx_ADUR.mjs} +2 -2
- package/dist/{use-fluid-api-CedscoxF.mjs.map → use-fluid-api-Cvx_ADUR.mjs.map} +1 -1
- package/dist/{use-fluid-api-DyI6LDsV.cjs → use-fluid-api-Ip5de2vH.cjs} +2 -2
- package/dist/{use-fluid-api-DyI6LDsV.cjs.map → use-fluid-api-Ip5de2vH.cjs.map} +1 -1
- package/package.json +15 -15
- package/dist/src-Bh-9OV8i.mjs.map +0 -1
- package/dist/src-DqIS-4ns.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-DAgNkxik.cjs");
|
|
2
|
-
const require_FluidProvider = require("./FluidProvider-
|
|
2
|
+
const require_FluidProvider = require("./FluidProvider-Dqj1m2GK.cjs");
|
|
3
3
|
let react = require("react");
|
|
4
4
|
//#region src/hooks/use-fluid-auth.ts
|
|
5
5
|
/**
|
|
@@ -151,4 +151,4 @@ Object.defineProperty(exports, "useSubscriptionsClient", {
|
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
153
|
|
|
154
|
-
//# sourceMappingURL=use-account-clients-
|
|
154
|
+
//# sourceMappingURL=use-account-clients-DrWcf8IN.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-account-clients-
|
|
1
|
+
{"version":3,"file":"use-account-clients-DrWcf8IN.cjs","names":["useFluidAuthContext","useFluidContext","createOrdersFetchClient","createSubscriptionsFetchClient","createFluidPayFetchClient","createCoreFetchClient"],"sources":["../src/hooks/use-fluid-auth.ts","../src/account/use-account-clients.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","import { useMemo } from \"react\";\nimport {\n createFetchClient as createOrdersFetchClient,\n type FetchClient as OrdersFetchClient,\n} from \"@fluid-app/orders-api-client\";\nimport {\n createFetchClient as createSubscriptionsFetchClient,\n type FetchClient as SubscriptionsFetchClient,\n} from \"@fluid-app/subscriptions-api-client\";\nimport {\n createFetchClient as createFluidPayFetchClient,\n type FetchClient as FluidPayFetchClient,\n} from \"@fluid-app/fluid-pay-api-client\";\nimport {\n createFetchClient as createCoreFetchClient,\n type FetchClient as CoreFetchClient,\n} from \"@fluid-app/api-client-core\";\nimport { useFluidContext } from \"../providers/FluidProvider\";\nimport { useFluidAuth } from \"../hooks/use-fluid-auth\";\n\n/** API version prefix for versioned endpoints (e.g. points ledger) */\nexport const API_VERSION = \"/v202506\";\n\n/**\n * Ensures baseUrl ends with /api.\n * Domain-specific API clients (orders, subscriptions, fluid-pay) use endpoint\n * paths without /api (e.g. /fluid_pay/me, /subscriptions), matching fluid-admin's\n * NEXT_PUBLIC_API_URL convention. The portal SDK's config.baseUrl is the domain\n * root (e.g. https://api.fluid.app), so we append /api here.\n */\nfunction withApiPrefix(baseUrl: string): string {\n const base = baseUrl.replace(/\\/+$/, \"\");\n return base.endsWith(\"/api\") ? base : `${base}/api`;\n}\n\nexport function useOrdersClient(): OrdersFetchClient {\n const { config } = useFluidContext();\n const { token } = useFluidAuth();\n\n return useMemo(\n () =>\n createOrdersFetchClient({\n baseUrl: withApiPrefix(config.baseUrl),\n getAuthToken: () => token,\n onAuthError: config.onAuthError,\n }),\n [config.baseUrl, config.onAuthError, token],\n );\n}\n\nexport function useSubscriptionsClient(): SubscriptionsFetchClient {\n const { config } = useFluidContext();\n const { token } = useFluidAuth();\n\n return useMemo(\n () =>\n createSubscriptionsFetchClient({\n baseUrl: withApiPrefix(config.baseUrl),\n getAuthToken: () => token,\n onAuthError: config.onAuthError,\n }),\n [config.baseUrl, config.onAuthError, token],\n );\n}\n\nexport function useFluidPayClient(): FluidPayFetchClient {\n const { config } = useFluidContext();\n const { token } = useFluidAuth();\n\n return useMemo(\n () =>\n createFluidPayFetchClient({\n baseUrl: withApiPrefix(config.baseUrl),\n getAuthToken: () => token,\n onAuthError: config.onAuthError,\n }),\n [config.baseUrl, config.onAuthError, token],\n );\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 * Uses the same auth/baseUrl/error handling as the domain clients.\n */\nexport function useSdkClient(): CoreFetchClient {\n const { config } = useFluidContext();\n const { token } = useFluidAuth();\n\n return useMemo(\n () =>\n createCoreFetchClient({\n baseUrl: withApiPrefix(config.baseUrl),\n getAuthToken: () => token,\n onAuthError: config.onAuthError,\n }),\n [config.baseUrl, config.onAuthError, token],\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,eAAsC;AACpD,QAAOA,sBAAAA,qBAAqB;;;;;ACpB9B,MAAa,cAAc;;;;;;;;AAS3B,SAAS,cAAc,SAAyB;CAC9C,MAAM,OAAO,QAAQ,QAAQ,QAAQ,GAAG;AACxC,QAAO,KAAK,SAAS,OAAO,GAAG,OAAO,GAAG,KAAK;;AAGhD,SAAgB,kBAAqC;CACnD,MAAM,EAAE,WAAWC,sBAAAA,iBAAiB;CACpC,MAAM,EAAE,UAAU,cAAc;AAEhC,SAAA,GAAA,MAAA,eAEIC,sBAAAA,kBAAwB;EACtB,SAAS,cAAc,OAAO,QAAQ;EACtC,oBAAoB;EACpB,aAAa,OAAO;EACrB,CAAC,EACJ;EAAC,OAAO;EAAS,OAAO;EAAa;EAAM,CAC5C;;AAGH,SAAgB,yBAAmD;CACjE,MAAM,EAAE,WAAWD,sBAAAA,iBAAiB;CACpC,MAAM,EAAE,UAAU,cAAc;AAEhC,SAAA,GAAA,MAAA,eAEIE,sBAAAA,kBAA+B;EAC7B,SAAS,cAAc,OAAO,QAAQ;EACtC,oBAAoB;EACpB,aAAa,OAAO;EACrB,CAAC,EACJ;EAAC,OAAO;EAAS,OAAO;EAAa;EAAM,CAC5C;;AAGH,SAAgB,oBAAyC;CACvD,MAAM,EAAE,WAAWF,sBAAAA,iBAAiB;CACpC,MAAM,EAAE,UAAU,cAAc;AAEhC,SAAA,GAAA,MAAA,eAEIG,sBAAAA,kBAA0B;EACxB,SAAS,cAAc,OAAO,QAAQ;EACtC,oBAAoB;EACpB,aAAa,OAAO;EACrB,CAAC,EACJ;EAAC,OAAO;EAAS,OAAO;EAAa;EAAM,CAC5C;;;;;;;AAQH,SAAgB,eAAgC;CAC9C,MAAM,EAAE,WAAWH,sBAAAA,iBAAiB;CACpC,MAAM,EAAE,UAAU,cAAc;AAEhC,SAAA,GAAA,MAAA,eAEII,sBAAAA,kBAAsB;EACpB,SAAS,cAAc,OAAO,QAAQ;EACtC,oBAAoB;EACpB,aAAa,OAAO;EACrB,CAAC,EACJ;EAAC,OAAO;EAAS,OAAO;EAAa;EAAM,CAC5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as useFluidContext, o as useFluidAuthContext, q as createFetchClient } from "./FluidProvider-
|
|
1
|
+
import { n as useFluidContext, o as useFluidAuthContext, q as createFetchClient } from "./FluidProvider-BMxf7_8j.mjs";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
//#region src/hooks/use-fluid-auth.ts
|
|
4
4
|
/**
|
|
@@ -115,4 +115,4 @@ function useSdkClient() {
|
|
|
115
115
|
//#endregion
|
|
116
116
|
export { useSubscriptionsClient as a, useSdkClient as i, useFluidPayClient as n, useFluidAuth as o, useOrdersClient as r, API_VERSION as t };
|
|
117
117
|
|
|
118
|
-
//# sourceMappingURL=use-account-clients-
|
|
118
|
+
//# sourceMappingURL=use-account-clients-iJVMmnbv.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-account-clients-
|
|
1
|
+
{"version":3,"file":"use-account-clients-iJVMmnbv.mjs","names":["createOrdersFetchClient","createSubscriptionsFetchClient","createFluidPayFetchClient","createCoreFetchClient"],"sources":["../src/hooks/use-fluid-auth.ts","../src/account/use-account-clients.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","import { useMemo } from \"react\";\nimport {\n createFetchClient as createOrdersFetchClient,\n type FetchClient as OrdersFetchClient,\n} from \"@fluid-app/orders-api-client\";\nimport {\n createFetchClient as createSubscriptionsFetchClient,\n type FetchClient as SubscriptionsFetchClient,\n} from \"@fluid-app/subscriptions-api-client\";\nimport {\n createFetchClient as createFluidPayFetchClient,\n type FetchClient as FluidPayFetchClient,\n} from \"@fluid-app/fluid-pay-api-client\";\nimport {\n createFetchClient as createCoreFetchClient,\n type FetchClient as CoreFetchClient,\n} from \"@fluid-app/api-client-core\";\nimport { useFluidContext } from \"../providers/FluidProvider\";\nimport { useFluidAuth } from \"../hooks/use-fluid-auth\";\n\n/** API version prefix for versioned endpoints (e.g. points ledger) */\nexport const API_VERSION = \"/v202506\";\n\n/**\n * Ensures baseUrl ends with /api.\n * Domain-specific API clients (orders, subscriptions, fluid-pay) use endpoint\n * paths without /api (e.g. /fluid_pay/me, /subscriptions), matching fluid-admin's\n * NEXT_PUBLIC_API_URL convention. The portal SDK's config.baseUrl is the domain\n * root (e.g. https://api.fluid.app), so we append /api here.\n */\nfunction withApiPrefix(baseUrl: string): string {\n const base = baseUrl.replace(/\\/+$/, \"\");\n return base.endsWith(\"/api\") ? base : `${base}/api`;\n}\n\nexport function useOrdersClient(): OrdersFetchClient {\n const { config } = useFluidContext();\n const { token } = useFluidAuth();\n\n return useMemo(\n () =>\n createOrdersFetchClient({\n baseUrl: withApiPrefix(config.baseUrl),\n getAuthToken: () => token,\n onAuthError: config.onAuthError,\n }),\n [config.baseUrl, config.onAuthError, token],\n );\n}\n\nexport function useSubscriptionsClient(): SubscriptionsFetchClient {\n const { config } = useFluidContext();\n const { token } = useFluidAuth();\n\n return useMemo(\n () =>\n createSubscriptionsFetchClient({\n baseUrl: withApiPrefix(config.baseUrl),\n getAuthToken: () => token,\n onAuthError: config.onAuthError,\n }),\n [config.baseUrl, config.onAuthError, token],\n );\n}\n\nexport function useFluidPayClient(): FluidPayFetchClient {\n const { config } = useFluidContext();\n const { token } = useFluidAuth();\n\n return useMemo(\n () =>\n createFluidPayFetchClient({\n baseUrl: withApiPrefix(config.baseUrl),\n getAuthToken: () => token,\n onAuthError: config.onAuthError,\n }),\n [config.baseUrl, config.onAuthError, token],\n );\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 * Uses the same auth/baseUrl/error handling as the domain clients.\n */\nexport function useSdkClient(): CoreFetchClient {\n const { config } = useFluidContext();\n const { token } = useFluidAuth();\n\n return useMemo(\n () =>\n createCoreFetchClient({\n baseUrl: withApiPrefix(config.baseUrl),\n getAuthToken: () => token,\n onAuthError: config.onAuthError,\n }),\n [config.baseUrl, config.onAuthError, token],\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,eAAsC;AACpD,QAAO,qBAAqB;;;;;ACpB9B,MAAa,cAAc;;;;;;;;AAS3B,SAAS,cAAc,SAAyB;CAC9C,MAAM,OAAO,QAAQ,QAAQ,QAAQ,GAAG;AACxC,QAAO,KAAK,SAAS,OAAO,GAAG,OAAO,GAAG,KAAK;;AAGhD,SAAgB,kBAAqC;CACnD,MAAM,EAAE,WAAW,iBAAiB;CACpC,MAAM,EAAE,UAAU,cAAc;AAEhC,QAAO,cAEHA,kBAAwB;EACtB,SAAS,cAAc,OAAO,QAAQ;EACtC,oBAAoB;EACpB,aAAa,OAAO;EACrB,CAAC,EACJ;EAAC,OAAO;EAAS,OAAO;EAAa;EAAM,CAC5C;;AAGH,SAAgB,yBAAmD;CACjE,MAAM,EAAE,WAAW,iBAAiB;CACpC,MAAM,EAAE,UAAU,cAAc;AAEhC,QAAO,cAEHC,kBAA+B;EAC7B,SAAS,cAAc,OAAO,QAAQ;EACtC,oBAAoB;EACpB,aAAa,OAAO;EACrB,CAAC,EACJ;EAAC,OAAO;EAAS,OAAO;EAAa;EAAM,CAC5C;;AAGH,SAAgB,oBAAyC;CACvD,MAAM,EAAE,WAAW,iBAAiB;CACpC,MAAM,EAAE,UAAU,cAAc;AAEhC,QAAO,cAEHC,kBAA0B;EACxB,SAAS,cAAc,OAAO,QAAQ;EACtC,oBAAoB;EACpB,aAAa,OAAO;EACrB,CAAC,EACJ;EAAC,OAAO;EAAS,OAAO;EAAa;EAAM,CAC5C;;;;;;;AAQH,SAAgB,eAAgC;CAC9C,MAAM,EAAE,WAAW,iBAAiB;CACpC,MAAM,EAAE,UAAU,cAAc;AAEhC,QAAO,cAEHC,kBAAsB;EACpB,SAAS,cAAc,OAAO,QAAQ;EACtC,oBAAoB;EACpB,aAAa,OAAO;EACrB,CAAC,EACJ;EAAC,OAAO;EAAS,OAAO;EAAa;EAAM,CAC5C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./chunk-DAgNkxik.cjs");
|
|
2
|
-
const require_FluidProvider = require("./FluidProvider-
|
|
3
|
-
const require_use_fluid_api = require("./use-fluid-api-
|
|
2
|
+
const require_FluidProvider = require("./FluidProvider-Dqj1m2GK.cjs");
|
|
3
|
+
const require_use_fluid_api = require("./use-fluid-api-Ip5de2vH.cjs");
|
|
4
4
|
let react = require("react");
|
|
5
5
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
6
6
|
//#region src/hooks/query-keys.ts
|
|
@@ -122,4 +122,4 @@ Object.defineProperty(exports, "useCurrentUser", {
|
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
//# sourceMappingURL=use-current-user-
|
|
125
|
+
//# sourceMappingURL=use-current-user-B-pNBKKk.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-current-user-
|
|
1
|
+
{"version":3,"file":"use-current-user-B-pNBKKk.cjs","names":["useFluidAuthContext","useFluidApi"],"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,OAAOA,sBAAAA,qBAAqB;CAClC,MAAM,YAAY,KAAK,MAAM;CAM7B,MAAM,gBAAA,GAAA,MAAA,QAAsB,MAAM;AAClC,KAAI,KAAK,mBAAmB,aAAa,QAAQ,CAAC,aAAa,SAAS;AACtE,eAAa,UAAU;AACvB,UAAQ,KACN,4LAGD;;AAaH,QAAO;EAAE;EAAW,WAAA,GAAA,MAAA,cATY,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,MAAMC,sBAAAA,aAAa;CACzB,MAAM,EAAE,aAAa,0BAA0B;AAE/C,SAAA,GAAA,sBAAA,UAAgB;EACd,UAAU,SAAS,uBAAuB;EAC1C,eAAe,IAAI,MAAM,IAAI;EAC7B,WAAW,MAAS;EACrB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as useFluidAuthContext } from "./FluidProvider-
|
|
2
|
-
import { t as useFluidApi } from "./use-fluid-api-
|
|
1
|
+
import { o as useFluidAuthContext } from "./FluidProvider-BMxf7_8j.mjs";
|
|
2
|
+
import { t as useFluidApi } from "./use-fluid-api-Cvx_ADUR.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-C52Qw6if.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-current-user-
|
|
1
|
+
{"version":3,"file":"use-current-user-C52Qw6if.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,6 +1,6 @@
|
|
|
1
1
|
require("./chunk-DAgNkxik.cjs");
|
|
2
|
-
const require_FluidProvider = require("./FluidProvider-
|
|
3
|
-
const require_use_account_clients = require("./use-account-clients-
|
|
2
|
+
const require_FluidProvider = require("./FluidProvider-Dqj1m2GK.cjs");
|
|
3
|
+
const require_use_account_clients = require("./use-account-clients-DrWcf8IN.cjs");
|
|
4
4
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
5
5
|
//#region src/account/use-customer-account.ts
|
|
6
6
|
function useCustomerAccount({ enabled = true } = {}) {
|
|
@@ -26,4 +26,4 @@ Object.defineProperty(exports, "useCustomerAccount", {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=use-customer-account-
|
|
29
|
+
//# sourceMappingURL=use-customer-account-BWhY4Tam.cjs.map
|
package/dist/{use-customer-account-Rm2QXJiZ.cjs.map → use-customer-account-BWhY4Tam.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-customer-account-
|
|
1
|
+
{"version":3,"file":"use-customer-account-BWhY4Tam.cjs","names":["useFluidAuth","useFluidPayClient"],"sources":["../src/account/use-customer-account.ts"],"sourcesContent":["import { useQuery } from \"@tanstack/react-query\";\nimport { customersApi } from \"@fluid-app/fluid-pay-api-client\";\nimport { useFluidAuth } from \"../hooks/use-fluid-auth\";\nimport { useFluidPayClient } from \"./use-account-clients\";\n\nexport function useCustomerAccount({\n enabled = true,\n}: { enabled?: boolean } = {}) {\n const { token, user } = useFluidAuth();\n const fluidPayClient = useFluidPayClient();\n const jwt = token ?? \"\";\n\n const query = useQuery({\n queryKey: [\"fluidPayAccount\", user?.id],\n queryFn: () => customersApi.fetchCustomerAccount(fluidPayClient, jwt),\n enabled: !!jwt && enabled,\n });\n\n return {\n customerId: query.data?.customer?.id,\n isLoadingCustomer: query.isLoading,\n isCustomerError: query.isError,\n };\n}\n"],"mappings":";;;;;AAKA,SAAgB,mBAAmB,EACjC,UAAU,SACe,EAAE,EAAE;CAC7B,MAAM,EAAE,OAAO,SAASA,4BAAAA,cAAc;CACtC,MAAM,iBAAiBC,4BAAAA,mBAAmB;CAC1C,MAAM,MAAM,SAAS;CAErB,MAAM,SAAA,GAAA,sBAAA,UAAiB;EACrB,UAAU,CAAC,mBAAmB,MAAM,GAAG;EACvC,eAAA,sBAAA,qBAAiD,gBAAgB,IAAI;EACrE,SAAS,CAAC,CAAC,OAAO;EACnB,CAAC;AAEF,QAAO;EACL,YAAY,MAAM,MAAM,UAAU;EAClC,mBAAmB,MAAM;EACzB,iBAAiB,MAAM;EACxB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as fetchCustomerAccount } from "./FluidProvider-
|
|
2
|
-
import { n as useFluidPayClient, o as useFluidAuth } from "./use-account-clients-
|
|
1
|
+
import { W as fetchCustomerAccount } from "./FluidProvider-BMxf7_8j.mjs";
|
|
2
|
+
import { n as useFluidPayClient, o as useFluidAuth } from "./use-account-clients-iJVMmnbv.mjs";
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
//#region src/account/use-customer-account.ts
|
|
5
5
|
function useCustomerAccount({ enabled = true } = {}) {
|
|
@@ -20,4 +20,4 @@ function useCustomerAccount({ enabled = true } = {}) {
|
|
|
20
20
|
//#endregion
|
|
21
21
|
export { useCustomerAccount as t };
|
|
22
22
|
|
|
23
|
-
//# sourceMappingURL=use-customer-account-
|
|
23
|
+
//# sourceMappingURL=use-customer-account-C9_Xb6x-.mjs.map
|
package/dist/{use-customer-account-Dix8Ja5O.mjs.map → use-customer-account-C9_Xb6x-.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-customer-account-
|
|
1
|
+
{"version":3,"file":"use-customer-account-C9_Xb6x-.mjs","names":["customersApi.fetchCustomerAccount"],"sources":["../src/account/use-customer-account.ts"],"sourcesContent":["import { useQuery } from \"@tanstack/react-query\";\nimport { customersApi } from \"@fluid-app/fluid-pay-api-client\";\nimport { useFluidAuth } from \"../hooks/use-fluid-auth\";\nimport { useFluidPayClient } from \"./use-account-clients\";\n\nexport function useCustomerAccount({\n enabled = true,\n}: { enabled?: boolean } = {}) {\n const { token, user } = useFluidAuth();\n const fluidPayClient = useFluidPayClient();\n const jwt = token ?? \"\";\n\n const query = useQuery({\n queryKey: [\"fluidPayAccount\", user?.id],\n queryFn: () => customersApi.fetchCustomerAccount(fluidPayClient, jwt),\n enabled: !!jwt && enabled,\n });\n\n return {\n customerId: query.data?.customer?.id,\n isLoadingCustomer: query.isLoading,\n isCustomerError: query.isError,\n };\n}\n"],"mappings":";;;;AAKA,SAAgB,mBAAmB,EACjC,UAAU,SACe,EAAE,EAAE;CAC7B,MAAM,EAAE,OAAO,SAAS,cAAc;CACtC,MAAM,iBAAiB,mBAAmB;CAC1C,MAAM,MAAM,SAAS;CAErB,MAAM,QAAQ,SAAS;EACrB,UAAU,CAAC,mBAAmB,MAAM,GAAG;EACvC,eAAeA,qBAAkC,gBAAgB,IAAI;EACrE,SAAS,CAAC,CAAC,OAAO;EACnB,CAAC;AAEF,QAAO;EACL,YAAY,MAAM,MAAM,UAAU;EAClC,mBAAmB,MAAM;EACzB,iBAAiB,MAAM;EACxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as useFluidContext } from "./FluidProvider-
|
|
1
|
+
import { n as useFluidContext } from "./FluidProvider-BMxf7_8j.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-Cvx_ADUR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-fluid-api-
|
|
1
|
+
{"version":3,"file":"use-fluid-api-Cvx_ADUR.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 ProductList() {\n * const api = useFluidApi();\n *\n * const { data: products } = useQuery({\n * queryKey: [\"products\"],\n * queryFn: () => api.products.list(),\n * });\n *\n * return <ul>{products?.map(p => <li key={p.id}>{p.name}</li>)}</ul>;\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
|
-
const require_FluidProvider = require("./FluidProvider-
|
|
1
|
+
const require_FluidProvider = require("./FluidProvider-Dqj1m2GK.cjs");
|
|
2
2
|
//#region src/hooks/use-fluid-api.ts
|
|
3
3
|
/**
|
|
4
4
|
* Hook to access the Fluid API client
|
|
@@ -29,4 +29,4 @@ Object.defineProperty(exports, "useFluidApi", {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
//# sourceMappingURL=use-fluid-api-
|
|
32
|
+
//# sourceMappingURL=use-fluid-api-Ip5de2vH.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-fluid-api-
|
|
1
|
+
{"version":3,"file":"use-fluid-api-Ip5de2vH.cjs","names":["useFluidContext"],"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 ProductList() {\n * const api = useFluidApi();\n *\n * const { data: products } = useQuery({\n * queryKey: [\"products\"],\n * queryFn: () => api.products.list(),\n * });\n *\n * return <ul>{products?.map(p => <li key={p.id}>{p.name}</li>)}</ul>;\n * }\n * ```\n */\nexport function useFluidApi(): FluidClient {\n const { client } = useFluidContext();\n return client;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,cAA2B;CACzC,MAAM,EAAE,WAAWA,sBAAAA,iBAAiB;AACpC,QAAO"}
|
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.72",
|
|
4
4
|
"description": "SDK for building custom Fluid portals",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -65,41 +65,41 @@
|
|
|
65
65
|
"tsdown": "^0.21.0",
|
|
66
66
|
"typescript": "^5",
|
|
67
67
|
"zod": "4.3.5",
|
|
68
|
-
"@fluid-app/auth": "0.1.0",
|
|
69
68
|
"@fluid-app/api-client-core": "0.1.0",
|
|
69
|
+
"@fluid-app/cart-ui": "0.1.11",
|
|
70
|
+
"@fluid-app/auth": "0.1.0",
|
|
70
71
|
"@fluid-app/company-switcher-core": "0.1.0",
|
|
71
|
-
"@fluid-app/cart-ui": "0.1.10",
|
|
72
72
|
"@fluid-app/company-switcher-ui": "0.1.0",
|
|
73
|
-
"@fluid-app/
|
|
73
|
+
"@fluid-app/contacts-ui": "0.1.0",
|
|
74
74
|
"@fluid-app/fluid-pay-api-client": "0.1.0",
|
|
75
|
-
"@fluid-app/
|
|
75
|
+
"@fluid-app/file-picker-api-client": "0.1.0",
|
|
76
76
|
"@fluid-app/fluidos-api-client": "0.1.0",
|
|
77
77
|
"@fluid-app/messaging-api-client": "0.1.0",
|
|
78
|
-
"@fluid-app/contacts-ui": "0.1.0",
|
|
79
78
|
"@fluid-app/messaging-ui": "0.1.0",
|
|
80
|
-
"@fluid-app/
|
|
79
|
+
"@fluid-app/messaging-core": "0.1.0",
|
|
80
|
+
"@fluid-app/orders-api-client": "0.1.0",
|
|
81
81
|
"@fluid-app/orders-core": "0.1.0",
|
|
82
|
+
"@fluid-app/mysite-ui": "0.1.0",
|
|
83
|
+
"@fluid-app/portal-preview": "0.1.0",
|
|
82
84
|
"@fluid-app/orders-ui": "0.1.0",
|
|
85
|
+
"@fluid-app/portal-pro-upgrade-ui": "0.1.0",
|
|
83
86
|
"@fluid-app/permissions": "0.1.0",
|
|
84
|
-
"@fluid-app/
|
|
85
|
-
"@fluid-app/portal-preview": "0.1.0",
|
|
87
|
+
"@fluid-app/portal-react": "0.1.0",
|
|
86
88
|
"@fluid-app/portal-app-download-ui": "0.1.0",
|
|
87
|
-
"@fluid-app/portal-pro-upgrade-ui": "0.1.0",
|
|
88
89
|
"@fluid-app/portal-widgets": "0.1.22",
|
|
89
90
|
"@fluid-app/products-api-client": "0.1.0",
|
|
90
|
-
"@fluid-app/profile-core": "0.1.0",
|
|
91
|
-
"@fluid-app/portal-react": "0.1.0",
|
|
92
91
|
"@fluid-app/products-core": "0.1.0",
|
|
92
|
+
"@fluid-app/profile-core": "0.1.0",
|
|
93
93
|
"@fluid-app/shareables-api-client": "0.1.0",
|
|
94
94
|
"@fluid-app/profile-ui": "0.1.0",
|
|
95
95
|
"@fluid-app/shareables-core": "0.1.0",
|
|
96
|
-
"@fluid-app/query-persister": "0.1.0",
|
|
97
96
|
"@fluid-app/shareables-ui": "0.1.0",
|
|
98
|
-
"@fluid-app/
|
|
97
|
+
"@fluid-app/query-persister": "0.1.0",
|
|
99
98
|
"@fluid-app/subscriptions-api-client": "0.1.0",
|
|
99
|
+
"@fluid-app/shop-ui": "0.1.0",
|
|
100
|
+
"@fluid-app/subscriptions-core": "0.1.0",
|
|
100
101
|
"@fluid-app/subscriptions-ui": "0.1.0",
|
|
101
102
|
"@fluid-app/typescript-config": "0.0.0",
|
|
102
|
-
"@fluid-app/subscriptions-core": "0.1.0",
|
|
103
103
|
"@fluid-app/ui-primitives": "0.1.13",
|
|
104
104
|
"@fluid-app/user-contacts-api-client": "0.1.0",
|
|
105
105
|
"@fluid-app/user-notes-api-client": "0.1.0",
|