@fluid-app/portal-sdk 0.1.112 → 0.1.113
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-Uc9N7K_K.cjs → AppDownloadScreen-BRM2422D.cjs} +2 -2
- package/dist/{AppDownloadScreen-DzFc_CDn.cjs → AppDownloadScreen-CwAEQCXb.cjs} +2 -2
- package/dist/{AppDownloadScreen-DzFc_CDn.cjs.map → AppDownloadScreen-CwAEQCXb.cjs.map} +1 -1
- package/dist/{AppDownloadScreen-BvcyEKCk.mjs → AppDownloadScreen-SmPf0S74.mjs} +2 -2
- package/dist/{AppDownloadScreen-BvcyEKCk.mjs.map → AppDownloadScreen-SmPf0S74.mjs.map} +1 -1
- package/dist/{ContactsScreen-BNqIi0XS.mjs → ContactsScreen-BTOnIpof.mjs} +2 -2
- package/dist/{ContactsScreen-BNqIi0XS.mjs.map → ContactsScreen-BTOnIpof.mjs.map} +1 -1
- package/dist/{ContactsScreen-C6cCTl51.cjs → ContactsScreen-BaDlTbEn.cjs} +2 -2
- package/dist/{ContactsScreen-C6cCTl51.cjs.map → ContactsScreen-BaDlTbEn.cjs.map} +1 -1
- package/dist/{ContactsScreen-D2DYk3A-.cjs → ContactsScreen-qvJ0gr2D.cjs} +2 -2
- package/dist/{FluidProvider-dTwaHRzI.mjs → FluidProvider-CMGu8wbx.mjs} +33 -79
- package/dist/FluidProvider-CMGu8wbx.mjs.map +1 -0
- package/dist/{FluidProvider-NnE6s3O0.cjs → FluidProvider-DEHDER6T.cjs} +38 -78
- package/dist/FluidProvider-DEHDER6T.cjs.map +1 -0
- package/dist/{MessagingScreen-C_tCav2Y.cjs → MessagingScreen-B2c7pNrj.cjs} +2 -2
- package/dist/{MessagingScreen-DH0YxaOG.cjs → MessagingScreen-CgWPOknA.cjs} +3 -3
- package/dist/{MessagingScreen-DH0YxaOG.cjs.map → MessagingScreen-CgWPOknA.cjs.map} +1 -1
- package/dist/{MessagingScreen-BA6fMOmD.mjs → MessagingScreen-DJB1wth6.mjs} +2 -3
- package/dist/{MessagingScreen-Dv8HVEt-.mjs → MessagingScreen-S0UYG7jh.mjs} +3 -3
- package/dist/{MessagingScreen-Dv8HVEt-.mjs.map → MessagingScreen-S0UYG7jh.mjs.map} +1 -1
- package/dist/{MySiteScreen-t89PLodk.mjs → MySiteScreen-Bmb7wlMo.mjs} +2 -2
- package/dist/{MySiteScreen-t89PLodk.mjs.map → MySiteScreen-Bmb7wlMo.mjs.map} +1 -1
- package/dist/{MySiteScreen-Bda8FzQ9.cjs → MySiteScreen-BqYWp5oM.cjs} +2 -2
- package/dist/{MySiteScreen-DydtAGvt.cjs → MySiteScreen-DRJtUSEv.cjs} +2 -2
- package/dist/{MySiteScreen-DydtAGvt.cjs.map → MySiteScreen-DRJtUSEv.cjs.map} +1 -1
- package/dist/{OrdersScreen-BhJkW3TG.cjs → OrdersScreen-DjWeLpzq.cjs} +3 -3
- package/dist/{OrdersScreen-BhJkW3TG.cjs.map → OrdersScreen-DjWeLpzq.cjs.map} +1 -1
- package/dist/{OrdersScreen-DP1WdqVT.mjs → OrdersScreen-LvY3Gpit.mjs} +3 -3
- package/dist/{OrdersScreen-DP1WdqVT.mjs.map → OrdersScreen-LvY3Gpit.mjs.map} +1 -1
- package/dist/{OrdersScreen-DvaV61fj.cjs → OrdersScreen-nPfPQg5l.cjs} +2 -2
- package/dist/{ProductsScreen-sEcByLGy.mjs → ProductsScreen-84YTdLr4.mjs} +3 -3
- package/dist/{ProductsScreen-sEcByLGy.mjs.map → ProductsScreen-84YTdLr4.mjs.map} +1 -1
- package/dist/{ProductsScreen-ssonMzdl.cjs → ProductsScreen-BF6qZxGW.cjs} +3 -3
- package/dist/{ProductsScreen-ssonMzdl.cjs.map → ProductsScreen-BF6qZxGW.cjs.map} +1 -1
- package/dist/{ProductsScreen-DYECF3gJ.mjs → ProductsScreen-Bxb-GTkK.mjs} +2 -5
- package/dist/{ProductsScreen-CI9G5UJh.cjs → ProductsScreen-DI5oszM3.cjs} +2 -2
- package/dist/{ProfileScreen-Bc4znBmb.cjs → ProfileScreen-BxfNuK3_.cjs} +2 -2
- package/dist/{ProfileScreen-BPvudlCM.cjs → ProfileScreen-C81VzV0g.cjs} +4 -4
- package/dist/{ProfileScreen-BPvudlCM.cjs.map → ProfileScreen-C81VzV0g.cjs.map} +1 -1
- package/dist/{ProfileScreen-BWiBC4y3.mjs → ProfileScreen-fBv7Z8WI.mjs} +4 -4
- package/dist/{ProfileScreen-BWiBC4y3.mjs.map → ProfileScreen-fBv7Z8WI.mjs.map} +1 -1
- package/dist/{ShareablesScreen-CIrWSh5q.mjs → ShareablesScreen-BA7_bvpL.mjs} +5 -5
- package/dist/{ShareablesScreen-CIrWSh5q.mjs.map → ShareablesScreen-BA7_bvpL.mjs.map} +1 -1
- package/dist/{ShareablesScreen-BvBfPJ69.cjs → ShareablesScreen-BZ56t5nh.cjs} +2 -2
- package/dist/{ShareablesScreen-TEWnxGs0.mjs → ShareablesScreen-DEq59fgF.mjs} +2 -6
- package/dist/{ShareablesScreen-D3JVKFVA.cjs → ShareablesScreen-yLxHmfcg.cjs} +5 -5
- package/dist/{ShareablesScreen-D3JVKFVA.cjs.map → ShareablesScreen-yLxHmfcg.cjs.map} +1 -1
- package/dist/{ShopScreen-BTTKNmtT.cjs → ShopScreen-B6xBjA_s.cjs} +4 -4
- package/dist/{ShopScreen-BTTKNmtT.cjs.map → ShopScreen-B6xBjA_s.cjs.map} +1 -1
- package/dist/{ShopScreen-CDscN4-a.mjs → ShopScreen-CBMoK7mb.mjs} +4 -4
- package/dist/{ShopScreen-CDscN4-a.mjs.map → ShopScreen-CBMoK7mb.mjs.map} +1 -1
- package/dist/{ShopScreen-TWpb8sxs.cjs → ShopScreen-CyzjPqHN.cjs} +2 -2
- package/dist/{SubscriptionsScreen-B0drtNfN.cjs → SubscriptionsScreen-BlVX2TKS.cjs} +3 -3
- package/dist/{SubscriptionsScreen-B0drtNfN.cjs.map → SubscriptionsScreen-BlVX2TKS.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-WtnN9Ka0.cjs → SubscriptionsScreen-CWyix7Xl.cjs} +2 -2
- package/dist/{SubscriptionsScreen-D-BXah4H.mjs → SubscriptionsScreen-CXk8PnZW.mjs} +3 -3
- package/dist/{SubscriptionsScreen-D-BXah4H.mjs.map → SubscriptionsScreen-CXk8PnZW.mjs.map} +1 -1
- package/dist/index.cjs +35 -34
- package/dist/index.d.cts +183 -241
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +183 -241
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +35 -35
- package/dist/{use-account-clients-vDDhNW8x.mjs → use-account-clients-BinrTgf5.mjs} +2 -2
- package/dist/use-account-clients-BinrTgf5.mjs.map +1 -0
- package/dist/{use-account-clients-CDTUFb6O.cjs → use-account-clients-DF4kfbkl.cjs} +2 -2
- package/dist/use-account-clients-DF4kfbkl.cjs.map +1 -0
- package/dist/{use-current-user-C7O5SJ_L.cjs → use-current-user-22OsVRVp.cjs} +3 -3
- package/dist/{use-current-user-C7O5SJ_L.cjs.map → use-current-user-22OsVRVp.cjs.map} +1 -1
- package/dist/{use-current-user-Czzb9Zc4.mjs → use-current-user-CpTGZnKd.mjs} +3 -3
- package/dist/{use-current-user-Czzb9Zc4.mjs.map → use-current-user-CpTGZnKd.mjs.map} +1 -1
- package/dist/{use-customer-account-DHZ8wLs9.mjs → use-customer-account-BF2aDDqh.mjs} +3 -3
- package/dist/{use-customer-account-DHZ8wLs9.mjs.map → use-customer-account-BF2aDDqh.mjs.map} +1 -1
- package/dist/{use-customer-account-zgiEdZ89.cjs → use-customer-account-CAIi3P-_.cjs} +3 -3
- package/dist/{use-customer-account-zgiEdZ89.cjs.map → use-customer-account-CAIi3P-_.cjs.map} +1 -1
- package/dist/{use-fluid-api-Wjw57-uD.cjs → use-fluid-api-B3ezbAHw.cjs} +7 -7
- package/dist/use-fluid-api-B3ezbAHw.cjs.map +1 -0
- package/dist/use-fluid-api-DxSS-pTC.mjs +27 -0
- package/dist/use-fluid-api-DxSS-pTC.mjs.map +1 -0
- package/dist/{use-fluid-auth-Dy5K7BQ9.mjs → use-fluid-auth--1vh0Jal.mjs} +2 -2
- package/dist/{use-fluid-auth-Dy5K7BQ9.mjs.map → use-fluid-auth--1vh0Jal.mjs.map} +1 -1
- package/dist/{use-fluid-auth-BPwsWZNu.cjs → use-fluid-auth-DGFYiYO4.cjs} +2 -2
- package/dist/{use-fluid-auth-BPwsWZNu.cjs.map → use-fluid-auth-DGFYiYO4.cjs.map} +1 -1
- package/package.json +17 -17
- package/dist/FluidProvider-NnE6s3O0.cjs.map +0 -1
- package/dist/FluidProvider-dTwaHRzI.mjs.map +0 -1
- package/dist/use-account-clients-CDTUFb6O.cjs.map +0 -1
- package/dist/use-account-clients-vDDhNW8x.mjs.map +0 -1
- package/dist/use-fluid-api-D0kldm0L.mjs +0 -27
- package/dist/use-fluid-api-D0kldm0L.mjs.map +0 -1
- package/dist/use-fluid-api-Wjw57-uD.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-current-user-
|
|
1
|
+
{"version":3,"file":"use-current-user-22OsVRVp.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 { l as useFluidAuthContext } from "./FluidProvider-
|
|
2
|
-
import { t as useFluidApi } from "./use-fluid-api-
|
|
1
|
+
import { l as useFluidAuthContext } from "./FluidProvider-CMGu8wbx.mjs";
|
|
2
|
+
import { t as useFluidApi } from "./use-fluid-api-DxSS-pTC.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-CpTGZnKd.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-current-user-
|
|
1
|
+
{"version":3,"file":"use-current-user-CpTGZnKd.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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as useFluidAuth } from "./use-fluid-auth
|
|
1
|
+
import { ot as useFluidPayApi } from "./FluidProvider-CMGu8wbx.mjs";
|
|
2
|
+
import { t as useFluidAuth } from "./use-fluid-auth--1vh0Jal.mjs";
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
4
|
//#region src/account/use-customer-account.ts
|
|
5
5
|
function useCustomerAccount({ enabled = true } = {}) {
|
|
@@ -19,4 +19,4 @@ function useCustomerAccount({ enabled = true } = {}) {
|
|
|
19
19
|
//#endregion
|
|
20
20
|
export { useCustomerAccount as t };
|
|
21
21
|
|
|
22
|
-
//# sourceMappingURL=use-customer-account-
|
|
22
|
+
//# sourceMappingURL=use-customer-account-BF2aDDqh.mjs.map
|
package/dist/{use-customer-account-DHZ8wLs9.mjs.map → use-customer-account-BF2aDDqh.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-customer-account-
|
|
1
|
+
{"version":3,"file":"use-customer-account-BF2aDDqh.mjs","names":[],"sources":["../src/account/use-customer-account.ts"],"sourcesContent":["import { useQuery } from \"@tanstack/react-query\";\nimport { useFluidPayApi } from \"@fluid-app/fluid-pay-core\";\nimport { useFluidAuth } from \"../hooks/use-fluid-auth\";\n\nexport function useCustomerAccount({\n enabled = true,\n}: { enabled?: boolean } = {}) {\n const { isAuthenticated, user } = useFluidAuth();\n const api = useFluidPayApi();\n\n const query = useQuery({\n queryKey: [\"fluidPayAccount\", user?.id],\n // Session-based auth: fluid-pay APIs still accept a JWT parameter but\n // credentials are sent via HTTP-only cookies. Pass empty string until\n // fluid-pay-core is migrated to session auth.\n queryFn: () => api.customers.fetchAccount(\"\"),\n enabled: isAuthenticated && enabled,\n });\n\n return {\n customerId: query.data?.customer?.id,\n isLoadingCustomer: query.isLoading,\n isCustomerError: query.isError,\n };\n}\n"],"mappings":";;;;AAIA,SAAgB,mBAAmB,EACjC,UAAU,SACe,EAAE,EAAE;CAC7B,MAAM,EAAE,iBAAiB,SAAS,cAAc;CAChD,MAAM,MAAM,gBAAgB;CAE5B,MAAM,QAAQ,SAAS;EACrB,UAAU,CAAC,mBAAmB,MAAM,GAAG;EAIvC,eAAe,IAAI,UAAU,aAAa,GAAG;EAC7C,SAAS,mBAAmB;EAC7B,CAAC;AAEF,QAAO;EACL,YAAY,MAAM,MAAM,UAAU;EAClC,mBAAmB,MAAM;EACzB,iBAAiB,MAAM;EACxB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
const require_FluidProvider = require("./FluidProvider-
|
|
3
|
-
const require_use_fluid_auth = require("./use-fluid-auth-
|
|
2
|
+
const require_FluidProvider = require("./FluidProvider-DEHDER6T.cjs");
|
|
3
|
+
const require_use_fluid_auth = require("./use-fluid-auth-DGFYiYO4.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 } = {}) {
|
|
@@ -25,4 +25,4 @@ Object.defineProperty(exports, "useCustomerAccount", {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
//# sourceMappingURL=use-customer-account-
|
|
28
|
+
//# sourceMappingURL=use-customer-account-CAIi3P-_.cjs.map
|
package/dist/{use-customer-account-zgiEdZ89.cjs.map → use-customer-account-CAIi3P-_.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-customer-account-
|
|
1
|
+
{"version":3,"file":"use-customer-account-CAIi3P-_.cjs","names":["useFluidAuth","useFluidPayApi"],"sources":["../src/account/use-customer-account.ts"],"sourcesContent":["import { useQuery } from \"@tanstack/react-query\";\nimport { useFluidPayApi } from \"@fluid-app/fluid-pay-core\";\nimport { useFluidAuth } from \"../hooks/use-fluid-auth\";\n\nexport function useCustomerAccount({\n enabled = true,\n}: { enabled?: boolean } = {}) {\n const { isAuthenticated, user } = useFluidAuth();\n const api = useFluidPayApi();\n\n const query = useQuery({\n queryKey: [\"fluidPayAccount\", user?.id],\n // Session-based auth: fluid-pay APIs still accept a JWT parameter but\n // credentials are sent via HTTP-only cookies. Pass empty string until\n // fluid-pay-core is migrated to session auth.\n queryFn: () => api.customers.fetchAccount(\"\"),\n enabled: isAuthenticated && enabled,\n });\n\n return {\n customerId: query.data?.customer?.id,\n isLoadingCustomer: query.isLoading,\n isCustomerError: query.isError,\n };\n}\n"],"mappings":";;;;;AAIA,SAAgB,mBAAmB,EACjC,UAAU,SACe,EAAE,EAAE;CAC7B,MAAM,EAAE,iBAAiB,SAASA,uBAAAA,cAAc;CAChD,MAAM,MAAMC,sBAAAA,gBAAgB;CAE5B,MAAM,SAAA,GAAA,sBAAA,UAAiB;EACrB,UAAU,CAAC,mBAAmB,MAAM,GAAG;EAIvC,eAAe,IAAI,UAAU,aAAa,GAAG;EAC7C,SAAS,mBAAmB;EAC7B,CAAC;AAEF,QAAO;EACL,YAAY,MAAM,MAAM,UAAU;EAClC,mBAAmB,MAAM;EACzB,iBAAiB,MAAM;EACxB"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const require_FluidProvider = require("./FluidProvider-
|
|
1
|
+
const require_FluidProvider = require("./FluidProvider-DEHDER6T.cjs");
|
|
2
2
|
//#region src/hooks/use-fluid-api.ts
|
|
3
3
|
/**
|
|
4
4
|
* Hook to access the Fluid API client
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* ```tsx
|
|
8
|
-
* function
|
|
8
|
+
* function UserInfo() {
|
|
9
9
|
* const api = useFluidApi();
|
|
10
10
|
*
|
|
11
|
-
* const { data:
|
|
12
|
-
* queryKey: ["
|
|
13
|
-
* queryFn: () => api.
|
|
11
|
+
* const { data: user } = useQuery({
|
|
12
|
+
* queryKey: ["me"],
|
|
13
|
+
* queryFn: () => api.users.me(),
|
|
14
14
|
* });
|
|
15
15
|
*
|
|
16
|
-
* return <
|
|
16
|
+
* return <p>Hello, {user?.name}</p>;
|
|
17
17
|
* }
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
@@ -29,4 +29,4 @@ Object.defineProperty(exports, "useFluidApi", {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
//# sourceMappingURL=use-fluid-api-
|
|
32
|
+
//# sourceMappingURL=use-fluid-api-B3ezbAHw.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-fluid-api-B3ezbAHw.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 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,WAAWA,sBAAAA,iBAAiB;AACpC,QAAO"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { n as useFluidContext } from "./FluidProvider-CMGu8wbx.mjs";
|
|
2
|
+
//#region src/hooks/use-fluid-api.ts
|
|
3
|
+
/**
|
|
4
|
+
* Hook to access the Fluid API client
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* function UserInfo() {
|
|
9
|
+
* const api = useFluidApi();
|
|
10
|
+
*
|
|
11
|
+
* const { data: user } = useQuery({
|
|
12
|
+
* queryKey: ["me"],
|
|
13
|
+
* queryFn: () => api.users.me(),
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* return <p>Hello, {user?.name}</p>;
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
function useFluidApi() {
|
|
21
|
+
const { client } = useFluidContext();
|
|
22
|
+
return client;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { useFluidApi as t };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-fluid-api-DxSS-pTC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-fluid-api-DxSS-pTC.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-CMGu8wbx.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--1vh0Jal.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-fluid-auth
|
|
1
|
+
{"version":3,"file":"use-fluid-auth--1vh0Jal.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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_FluidProvider = require("./FluidProvider-
|
|
1
|
+
const require_FluidProvider = require("./FluidProvider-DEHDER6T.cjs");
|
|
2
2
|
//#region src/hooks/use-fluid-auth.ts
|
|
3
3
|
/**
|
|
4
4
|
* useFluidAuth Hook
|
|
@@ -47,4 +47,4 @@ Object.defineProperty(exports, "useFluidAuth", {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
//# sourceMappingURL=use-fluid-auth-
|
|
50
|
+
//# sourceMappingURL=use-fluid-auth-DGFYiYO4.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-fluid-auth-
|
|
1
|
+
{"version":3,"file":"use-fluid-auth-DGFYiYO4.cjs","names":["useFluidAuthContext"],"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,QAAOA,sBAAAA,qBAAqB"}
|
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.113",
|
|
4
4
|
"description": "SDK for building custom Fluid portals",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -65,47 +65,47 @@
|
|
|
65
65
|
"tsdown": "^0.21.0",
|
|
66
66
|
"typescript": "^5",
|
|
67
67
|
"zod": "4.3.5",
|
|
68
|
-
"@fluid-app/auth": "0.1.0",
|
|
69
|
-
"@fluid-app/company-switcher-core": "0.1.0",
|
|
70
|
-
"@fluid-app/cart-ui": "0.1.13",
|
|
71
|
-
"@fluid-app/company-switcher-ui": "0.1.0",
|
|
72
68
|
"@fluid-app/api-client-core": "0.1.0",
|
|
69
|
+
"@fluid-app/cart-ui": "0.1.13",
|
|
70
|
+
"@fluid-app/auth": "0.1.0",
|
|
73
71
|
"@fluid-app/contacts-core": "0.1.0",
|
|
72
|
+
"@fluid-app/company-switcher-ui": "0.1.0",
|
|
74
73
|
"@fluid-app/contacts-ui": "0.1.0",
|
|
75
74
|
"@fluid-app/file-picker-api-client": "0.1.0",
|
|
75
|
+
"@fluid-app/company-switcher-core": "0.1.0",
|
|
76
76
|
"@fluid-app/fluid-pay-api-client": "0.1.0",
|
|
77
|
-
"@fluid-app/
|
|
77
|
+
"@fluid-app/fluidos-api-client": "0.1.0",
|
|
78
78
|
"@fluid-app/messaging-core": "0.1.0",
|
|
79
79
|
"@fluid-app/messaging-api-client": "0.1.0",
|
|
80
|
-
"@fluid-app/fluidos-api-client": "0.1.0",
|
|
81
80
|
"@fluid-app/messaging-ui": "0.1.0",
|
|
82
|
-
"@fluid-app/
|
|
81
|
+
"@fluid-app/fluid-pay-core": "0.1.0",
|
|
83
82
|
"@fluid-app/orders-api-client": "0.1.0",
|
|
83
|
+
"@fluid-app/mysite-ui": "0.1.0",
|
|
84
84
|
"@fluid-app/orders-core": "0.1.0",
|
|
85
85
|
"@fluid-app/orders-ui": "0.1.0",
|
|
86
|
-
"@fluid-app/portal-core": "0.1.23",
|
|
87
86
|
"@fluid-app/portal-app-download-ui": "0.1.0",
|
|
87
|
+
"@fluid-app/portal-core": "0.1.23",
|
|
88
88
|
"@fluid-app/permissions": "0.1.0",
|
|
89
89
|
"@fluid-app/portal-preview": "0.1.0",
|
|
90
90
|
"@fluid-app/portal-pro-upgrade-ui": "0.1.0",
|
|
91
|
-
"@fluid-app/portal-react": "0.1.0",
|
|
92
91
|
"@fluid-app/portal-tenant-api-client": "0.1.0",
|
|
93
92
|
"@fluid-app/portal-widgets": "0.1.22",
|
|
94
|
-
"@fluid-app/
|
|
93
|
+
"@fluid-app/portal-react": "0.1.0",
|
|
95
94
|
"@fluid-app/products-core": "0.1.0",
|
|
96
|
-
"@fluid-app/profile-core": "0.1.0",
|
|
97
95
|
"@fluid-app/profile-ui": "0.1.0",
|
|
96
|
+
"@fluid-app/profile-core": "0.1.0",
|
|
98
97
|
"@fluid-app/query-persister": "0.1.0",
|
|
99
|
-
"@fluid-app/
|
|
98
|
+
"@fluid-app/products-api-client": "0.1.0",
|
|
100
99
|
"@fluid-app/shareables-core": "0.1.0",
|
|
100
|
+
"@fluid-app/shareables-api-client": "0.1.0",
|
|
101
101
|
"@fluid-app/shareables-ui": "0.1.0",
|
|
102
|
-
"@fluid-app/shop-ui": "0.1.0",
|
|
103
|
-
"@fluid-app/subscriptions-core": "0.1.0",
|
|
104
102
|
"@fluid-app/subscriptions-api-client": "0.1.0",
|
|
105
|
-
"@fluid-app/
|
|
103
|
+
"@fluid-app/subscriptions-core": "0.1.0",
|
|
104
|
+
"@fluid-app/shop-ui": "0.1.0",
|
|
106
105
|
"@fluid-app/subscriptions-ui": "0.1.0",
|
|
107
|
-
"@fluid-app/
|
|
106
|
+
"@fluid-app/typescript-config": "0.0.0",
|
|
108
107
|
"@fluid-app/ui-primitives": "0.1.13",
|
|
108
|
+
"@fluid-app/user-contacts-api-client": "0.1.0",
|
|
109
109
|
"@fluid-app/user-notes-api-client": "0.1.0",
|
|
110
110
|
"@fluid-app/user-tasks-api-client": "0.1.0"
|
|
111
111
|
},
|