@fluid-app/portal-sdk 0.1.34 → 0.1.36
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/{AppNavigationContext-v_y8OYHo.mjs → AppNavigationContext-CcRZ_LqM.mjs} +1 -1
- package/dist/{AppNavigationContext-v_y8OYHo.mjs.map → AppNavigationContext-CcRZ_LqM.mjs.map} +1 -1
- package/dist/{AppNavigationContext-0Ij6tU2H.cjs → AppNavigationContext-Dt02ymnf.cjs} +1 -1
- package/dist/{AppNavigationContext-0Ij6tU2H.cjs.map → AppNavigationContext-Dt02ymnf.cjs.map} +1 -1
- package/dist/{ContactsScreen-DXstI3Jj.mjs → ContactsScreen-Cqj2ylQd.mjs} +4 -4
- package/dist/{ContactsScreen-DXstI3Jj.mjs.map → ContactsScreen-Cqj2ylQd.mjs.map} +1 -1
- package/dist/{ContactsScreen-Ck_ngCS3.cjs → ContactsScreen-DTbdVDl2.cjs} +4 -4
- package/dist/{ContactsScreen-Ck_ngCS3.cjs.map → ContactsScreen-DTbdVDl2.cjs.map} +1 -1
- package/dist/{ContactsScreen-BmggZSZU.cjs → ContactsScreen-DwuusoZ9.cjs} +3 -3
- package/dist/{CustomersScreen-CeIiZKrq.cjs → CustomersScreen-B5k86dq0.cjs} +1 -1
- package/dist/{CustomersScreen-CeIiZKrq.cjs.map → CustomersScreen-B5k86dq0.cjs.map} +1 -1
- package/dist/{CustomersScreen-DEFY3mRL.mjs → CustomersScreen-DiXO5M5q.mjs} +1 -1
- package/dist/{CustomersScreen-DEFY3mRL.mjs.map → CustomersScreen-DiXO5M5q.mjs.map} +1 -1
- package/dist/{FluidProvider-BXxRdatZ.cjs → FluidProvider-D2VHDQOl.cjs} +23 -1
- package/dist/{FluidProvider-BXxRdatZ.cjs.map → FluidProvider-D2VHDQOl.cjs.map} +1 -1
- package/dist/{FluidProvider-CWC6LA9W.mjs → FluidProvider-S05cIFwO.mjs} +23 -1
- package/dist/FluidProvider-S05cIFwO.mjs.map +1 -0
- package/dist/{MessagingScreen-CUkIqREX.mjs → MessagingScreen-B5FFX0rk.mjs} +5 -5
- package/dist/{MessagingScreen-CUkIqREX.mjs.map → MessagingScreen-B5FFX0rk.mjs.map} +1 -1
- package/dist/{MessagingScreen-CbBgOUSs.cjs → MessagingScreen-BVoTHaZo.cjs} +5 -5
- package/dist/{MessagingScreen-CbBgOUSs.cjs.map → MessagingScreen-BVoTHaZo.cjs.map} +1 -1
- package/dist/{MessagingScreen-BZWaW9H_.cjs → MessagingScreen-CbtZhxMa.cjs} +3 -3
- package/dist/{MessagingScreen-Kij03Kn-.mjs → MessagingScreen-oclISkI22.mjs} +3 -3
- package/dist/{OrdersScreen-BEIE6mCd.cjs → OrdersScreen-BHNpjPwv.cjs} +5 -5
- package/dist/{OrdersScreen-BEIE6mCd.cjs.map → OrdersScreen-BHNpjPwv.cjs.map} +1 -1
- package/dist/{OrdersScreen-CBxsKlnU.mjs → OrdersScreen-Bec6SqNo.mjs} +5 -5
- package/dist/{OrdersScreen-CBxsKlnU.mjs.map → OrdersScreen-Bec6SqNo.mjs.map} +1 -1
- package/dist/{OrdersScreen-DrvVSd4b.cjs → OrdersScreen-C3BIRY6j.cjs} +3 -3
- package/dist/{ProductsScreen-DVxAFERc.mjs → ProductsScreen-BfPljupU.mjs} +8 -8
- package/dist/ProductsScreen-BfPljupU.mjs.map +1 -0
- package/dist/{ProductsScreen-Dzq3KP63.cjs → ProductsScreen-CCrZS-7j.cjs} +4 -4
- package/dist/{ProductsScreen-D_crd0ir.cjs → ProductsScreen-D3ySzLOk.cjs} +8 -8
- package/dist/ProductsScreen-D3ySzLOk.cjs.map +1 -0
- package/dist/{ProductsScreen-CoHFvcO_.mjs → ProductsScreen-DSmPPJfw.mjs} +4 -4
- package/dist/{ProfileScreen-Cn4iihgD.mjs → ProfileScreen-BFzPOFB1.mjs} +5 -4
- package/dist/{ProfileScreen-Cn4iihgD.mjs.map → ProfileScreen-BFzPOFB1.mjs.map} +1 -1
- package/dist/{ProfileScreen-B1_m1WId.cjs → ProfileScreen-CqUT2-XX.cjs} +2 -2
- package/dist/{ProfileScreen-BACkWuAC.cjs → ProfileScreen-T9Exf2DR.cjs} +7 -6
- package/dist/{ProfileScreen-BACkWuAC.cjs.map → ProfileScreen-T9Exf2DR.cjs.map} +1 -1
- package/dist/{ShareablesScreen-BEFG54-I.mjs → ShareablesScreen-Ce-wWJPW.mjs} +9 -9
- package/dist/ShareablesScreen-Ce-wWJPW.mjs.map +1 -0
- package/dist/{ShareablesScreen-D588qo6a.mjs → ShareablesScreen-CjjnN7JR.mjs} +4 -4
- package/dist/{ShareablesScreen-6fpWI08O.cjs → ShareablesScreen-CoAe2YQx.cjs} +4 -4
- package/dist/{ShareablesScreen-BhrhYh4W.cjs → ShareablesScreen-TqfgVJm_.cjs} +9 -9
- package/dist/ShareablesScreen-TqfgVJm_.cjs.map +1 -0
- package/dist/{ShopScreen-B3EgfJsG.cjs → ShopScreen-7G98Kb3F.cjs} +2 -2
- package/dist/{ShopScreen-B7mMrj2I.cjs → ShopScreen-Cyq4ebDX.cjs} +8 -6
- package/dist/ShopScreen-Cyq4ebDX.cjs.map +1 -0
- package/dist/{ShopScreen-Drg27OZM.mjs → ShopScreen-DP4SvMCy.mjs} +8 -6
- package/dist/{ShopScreen-Drg27OZM.mjs.map → ShopScreen-DP4SvMCy.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-DMFug2Kk.cjs → SubscriptionsScreen-CXQM1Z7M.cjs} +5 -5
- package/dist/{SubscriptionsScreen-DMFug2Kk.cjs.map → SubscriptionsScreen-CXQM1Z7M.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-DsHjhOII.cjs → SubscriptionsScreen-D2Z7L3Z6.cjs} +3 -3
- package/dist/{SubscriptionsScreen-DtcFH3sB.mjs → SubscriptionsScreen-iFx-VQrU.mjs} +5 -5
- package/dist/{SubscriptionsScreen-DtcFH3sB.mjs.map → SubscriptionsScreen-iFx-VQrU.mjs.map} +1 -1
- package/dist/customers-BHw3-Lg-.mjs +19 -0
- package/dist/customers-BHw3-Lg-.mjs.map +1 -0
- package/dist/customers-DIn-CxMl.cjs +30 -0
- package/dist/customers-DIn-CxMl.cjs.map +1 -0
- package/dist/{es-DZKcJZKh.mjs → es-BPF1dsEO.mjs} +1 -1
- package/dist/{es-DZKcJZKh.mjs.map → es-BPF1dsEO.mjs.map} +1 -1
- package/dist/{es-B1uNuoqD.cjs → es-DfGWLS4J.cjs} +1 -1
- package/dist/{es-B1uNuoqD.cjs.map → es-DfGWLS4J.cjs.map} +1 -1
- package/dist/index.cjs +35 -35
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +35 -35
- package/dist/index.mjs.map +1 -1
- package/dist/{products-CBjo08FD.mjs → products--saBmlZw.mjs} +2 -2
- package/dist/{products-CBjo08FD.mjs.map → products--saBmlZw.mjs.map} +1 -1
- package/dist/{products-Q7fqnjYK.cjs → products-B-qICtJG.cjs} +2 -2
- package/dist/{products-Q7fqnjYK.cjs.map → products-B-qICtJG.cjs.map} +1 -1
- package/dist/{src-BHiCoWU5.cjs → src-B7JarYAL.cjs} +1 -1
- package/dist/{src-BHiCoWU5.cjs.map → src-B7JarYAL.cjs.map} +1 -1
- package/dist/{src-C1qfvUE4.cjs → src-BKkLa2oq.cjs} +5 -5
- package/dist/{src-C1qfvUE4.cjs.map → src-BKkLa2oq.cjs.map} +1 -1
- package/dist/{src-J8sXTG9i.mjs → src-C2NjWMLg.mjs} +1 -1
- package/dist/{src-J8sXTG9i.mjs.map → src-C2NjWMLg.mjs.map} +1 -1
- package/dist/{src-D7GSa3rY.mjs → src-CECPMmmx.mjs} +5 -5
- package/dist/{src-D7GSa3rY.mjs.map → src-CECPMmmx.mjs.map} +1 -1
- package/dist/{use-account-clients-ak24jQa5.mjs → use-account-clients-7RWjXPNu.mjs} +3 -19
- package/dist/use-account-clients-7RWjXPNu.mjs.map +1 -0
- package/dist/{use-account-clients-D7BxTeLW.cjs → use-account-clients-YWHavlX7.cjs} +2 -30
- package/dist/use-account-clients-YWHavlX7.cjs.map +1 -0
- package/dist/{use-customer-account-KDDX2Irm.cjs → use-customer-account-BO2vTl2o.cjs} +4 -3
- package/dist/{use-customer-account-KDDX2Irm.cjs.map → use-customer-account-BO2vTl2o.cjs.map} +1 -1
- package/dist/{use-customer-account-BnnxuHea.mjs → use-customer-account-hnWIJ0oS.mjs} +3 -2
- package/dist/{use-customer-account-BnnxuHea.mjs.map → use-customer-account-hnWIJ0oS.mjs.map} +1 -1
- package/dist/{use-fluid-api-CQIVrQCO.mjs → use-fluid-api-D8iCEtbP.mjs} +2 -2
- package/dist/{use-fluid-api-CQIVrQCO.mjs.map → use-fluid-api-D8iCEtbP.mjs.map} +1 -1
- package/dist/{use-fluid-api-B27mJ8gv.cjs → use-fluid-api-haPhtgOR.cjs} +2 -2
- package/dist/{use-fluid-api-B27mJ8gv.cjs.map → use-fluid-api-haPhtgOR.cjs.map} +1 -1
- package/package.json +14 -14
- package/dist/FluidProvider-CWC6LA9W.mjs.map +0 -1
- package/dist/ProductsScreen-DVxAFERc.mjs.map +0 -1
- package/dist/ProductsScreen-D_crd0ir.cjs.map +0 -1
- package/dist/ShareablesScreen-BEFG54-I.mjs.map +0 -1
- package/dist/ShareablesScreen-BhrhYh4W.cjs.map +0 -1
- package/dist/ShopScreen-B7mMrj2I.cjs.map +0 -1
- package/dist/use-account-clients-D7BxTeLW.cjs.map +0 -1
- package/dist/use-account-clients-ak24jQa5.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _t as createFetchClient, n as useFluidContext, u as useFluidAuthContext } from "./FluidProvider-
|
|
1
|
+
import { _t as createFetchClient, n as useFluidContext, u as useFluidAuthContext } from "./FluidProvider-S05cIFwO.mjs";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
//#region src/hooks/use-fluid-auth.ts
|
|
4
4
|
/**
|
|
@@ -41,22 +41,6 @@ function useFluidAuth() {
|
|
|
41
41
|
return useFluidAuthContext();
|
|
42
42
|
}
|
|
43
43
|
//#endregion
|
|
44
|
-
//#region ../../fluid-pay/api-client/src/namespaces/customers.ts
|
|
45
|
-
/**
|
|
46
|
-
* Fetch the current customer's account info.
|
|
47
|
-
* Endpoint: GET /fluid_pay/me?jwt={jwt}
|
|
48
|
-
*/
|
|
49
|
-
async function fetchCustomerAccount(client, jwt) {
|
|
50
|
-
return client.get(`/fluid_pay/me`, { jwt });
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Update customer profile (name, phone, language).
|
|
54
|
-
* Endpoint: PATCH /fluid_pay/update_me?jwt={jwt}
|
|
55
|
-
*/
|
|
56
|
-
async function updateCustomer(client, jwt, body) {
|
|
57
|
-
return client.patch(`/fluid_pay/update_me?jwt=${jwt}`, { fluid_pay_account: body });
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
44
|
//#region src/account/use-account-clients.ts
|
|
61
45
|
/** API version prefix for versioned endpoints (e.g. points ledger) */
|
|
62
46
|
const API_VERSION = "/v202506";
|
|
@@ -129,6 +113,6 @@ function useSdkClient() {
|
|
|
129
113
|
]);
|
|
130
114
|
}
|
|
131
115
|
//#endregion
|
|
132
|
-
export { useSubscriptionsClient as a,
|
|
116
|
+
export { useSubscriptionsClient as a, useSdkClient as i, useFluidPayClient as n, useFluidAuth as o, useOrdersClient as r, API_VERSION as t };
|
|
133
117
|
|
|
134
|
-
//# sourceMappingURL=use-account-clients-
|
|
118
|
+
//# sourceMappingURL=use-account-clients-7RWjXPNu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-account-clients-7RWjXPNu.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,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
const require_FluidProvider = require("./FluidProvider-
|
|
2
|
+
const require_FluidProvider = require("./FluidProvider-D2VHDQOl.cjs");
|
|
3
3
|
let react = require("react");
|
|
4
4
|
//#region src/hooks/use-fluid-auth.ts
|
|
5
5
|
/**
|
|
@@ -42,22 +42,6 @@ function useFluidAuth() {
|
|
|
42
42
|
return require_FluidProvider.useFluidAuthContext();
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
|
-
//#region ../../fluid-pay/api-client/src/namespaces/customers.ts
|
|
46
|
-
/**
|
|
47
|
-
* Fetch the current customer's account info.
|
|
48
|
-
* Endpoint: GET /fluid_pay/me?jwt={jwt}
|
|
49
|
-
*/
|
|
50
|
-
async function fetchCustomerAccount(client, jwt) {
|
|
51
|
-
return client.get(`/fluid_pay/me`, { jwt });
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Update customer profile (name, phone, language).
|
|
55
|
-
* Endpoint: PATCH /fluid_pay/update_me?jwt={jwt}
|
|
56
|
-
*/
|
|
57
|
-
async function updateCustomer(client, jwt, body) {
|
|
58
|
-
return client.patch(`/fluid_pay/update_me?jwt=${jwt}`, { fluid_pay_account: body });
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
45
|
//#region src/account/use-account-clients.ts
|
|
62
46
|
/** API version prefix for versioned endpoints (e.g. points ledger) */
|
|
63
47
|
const API_VERSION = "/v202506";
|
|
@@ -136,18 +120,6 @@ Object.defineProperty(exports, "API_VERSION", {
|
|
|
136
120
|
return API_VERSION;
|
|
137
121
|
}
|
|
138
122
|
});
|
|
139
|
-
Object.defineProperty(exports, "fetchCustomerAccount", {
|
|
140
|
-
enumerable: true,
|
|
141
|
-
get: function() {
|
|
142
|
-
return fetchCustomerAccount;
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
Object.defineProperty(exports, "updateCustomer", {
|
|
146
|
-
enumerable: true,
|
|
147
|
-
get: function() {
|
|
148
|
-
return updateCustomer;
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
123
|
Object.defineProperty(exports, "useFluidAuth", {
|
|
152
124
|
enumerable: true,
|
|
153
125
|
get: function() {
|
|
@@ -179,4 +151,4 @@ Object.defineProperty(exports, "useSubscriptionsClient", {
|
|
|
179
151
|
}
|
|
180
152
|
});
|
|
181
153
|
|
|
182
|
-
//# sourceMappingURL=use-account-clients-
|
|
154
|
+
//# sourceMappingURL=use-account-clients-YWHavlX7.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-account-clients-YWHavlX7.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,5 +1,6 @@
|
|
|
1
1
|
require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
const require_use_account_clients = require("./use-account-clients-
|
|
2
|
+
const require_use_account_clients = require("./use-account-clients-YWHavlX7.cjs");
|
|
3
|
+
const require_customers = require("./customers-DIn-CxMl.cjs");
|
|
3
4
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
4
5
|
//#region src/account/use-customer-account.ts
|
|
5
6
|
function useCustomerAccount({ enabled = true } = {}) {
|
|
@@ -8,7 +9,7 @@ function useCustomerAccount({ enabled = true } = {}) {
|
|
|
8
9
|
const jwt = token ?? "";
|
|
9
10
|
const query = (0, _tanstack_react_query.useQuery)({
|
|
10
11
|
queryKey: ["fluidPayAccount", user?.id],
|
|
11
|
-
queryFn: () =>
|
|
12
|
+
queryFn: () => require_customers.fetchCustomerAccount(fluidPayClient, jwt),
|
|
12
13
|
enabled: !!jwt && enabled
|
|
13
14
|
});
|
|
14
15
|
return {
|
|
@@ -25,4 +26,4 @@ Object.defineProperty(exports, "useCustomerAccount", {
|
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
28
|
|
|
28
|
-
//# sourceMappingURL=use-customer-account-
|
|
29
|
+
//# sourceMappingURL=use-customer-account-BO2vTl2o.cjs.map
|
package/dist/{use-customer-account-KDDX2Irm.cjs.map → use-customer-account-BO2vTl2o.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-customer-account-
|
|
1
|
+
{"version":3,"file":"use-customer-account-BO2vTl2o.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,kBAAA,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,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as useFluidPayClient, o as useFluidAuth } from "./use-account-clients-7RWjXPNu.mjs";
|
|
2
|
+
import { t as fetchCustomerAccount } from "./customers-BHw3-Lg-.mjs";
|
|
2
3
|
import { useQuery } from "@tanstack/react-query";
|
|
3
4
|
//#region src/account/use-customer-account.ts
|
|
4
5
|
function useCustomerAccount({ enabled = true } = {}) {
|
|
@@ -19,4 +20,4 @@ function useCustomerAccount({ enabled = true } = {}) {
|
|
|
19
20
|
//#endregion
|
|
20
21
|
export { useCustomerAccount as t };
|
|
21
22
|
|
|
22
|
-
//# sourceMappingURL=use-customer-account-
|
|
23
|
+
//# sourceMappingURL=use-customer-account-hnWIJ0oS.mjs.map
|
package/dist/{use-customer-account-BnnxuHea.mjs.map → use-customer-account-hnWIJ0oS.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-customer-account-
|
|
1
|
+
{"version":3,"file":"use-customer-account-hnWIJ0oS.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-S05cIFwO.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-D8iCEtbP.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-fluid-api-
|
|
1
|
+
{"version":3,"file":"use-fluid-api-D8iCEtbP.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-D2VHDQOl.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-haPhtgOR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-fluid-api-
|
|
1
|
+
{"version":3,"file":"use-fluid-api-haPhtgOR.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.36",
|
|
4
4
|
"description": "SDK for building custom Fluid portals",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -54,34 +54,34 @@
|
|
|
54
54
|
"typescript": "^5",
|
|
55
55
|
"zod": "4.3.5",
|
|
56
56
|
"@fluid-app/api-client-core": "0.1.0",
|
|
57
|
-
"@fluid-app/auth": "0.1.0",
|
|
58
|
-
"@fluid-app/contacts-ui": "0.1.0",
|
|
59
|
-
"@fluid-app/fluid-pay-api-client": "0.1.0",
|
|
60
57
|
"@fluid-app/file-picker-api-client": "0.1.0",
|
|
58
|
+
"@fluid-app/fluid-pay-api-client": "0.1.0",
|
|
59
|
+
"@fluid-app/contacts-ui": "0.1.0",
|
|
60
|
+
"@fluid-app/auth": "0.1.0",
|
|
61
61
|
"@fluid-app/fluidos-api-client": "0.1.0",
|
|
62
62
|
"@fluid-app/messaging-core": "0.1.0",
|
|
63
|
-
"@fluid-app/messaging-
|
|
63
|
+
"@fluid-app/messaging-ui": "0.1.0",
|
|
64
64
|
"@fluid-app/orders-api-client": "0.1.0",
|
|
65
|
-
"@fluid-app/orders-ui": "0.1.0",
|
|
66
65
|
"@fluid-app/orders-core": "0.1.0",
|
|
67
|
-
"@fluid-app/messaging-
|
|
68
|
-
"@fluid-app/
|
|
66
|
+
"@fluid-app/messaging-api-client": "0.1.0",
|
|
67
|
+
"@fluid-app/orders-ui": "0.1.0",
|
|
69
68
|
"@fluid-app/portal-core": "0.1.23",
|
|
70
|
-
"@fluid-app/
|
|
69
|
+
"@fluid-app/portal-widgets": "0.1.22",
|
|
71
70
|
"@fluid-app/products-core": "0.1.0",
|
|
71
|
+
"@fluid-app/products-api-client": "0.1.0",
|
|
72
72
|
"@fluid-app/profile-core": "0.1.0",
|
|
73
|
-
"@fluid-app/profile-ui": "0.1.0",
|
|
74
73
|
"@fluid-app/query-persister": "0.1.0",
|
|
75
|
-
"@fluid-app/
|
|
74
|
+
"@fluid-app/profile-ui": "0.1.0",
|
|
76
75
|
"@fluid-app/shareables-api-client": "0.1.0",
|
|
76
|
+
"@fluid-app/shareables-core": "0.1.0",
|
|
77
77
|
"@fluid-app/shareables-ui": "0.1.0",
|
|
78
78
|
"@fluid-app/shop-ui": "0.1.0",
|
|
79
|
-
"@fluid-app/subscriptions-ui": "0.1.0",
|
|
80
79
|
"@fluid-app/subscriptions-api-client": "0.1.0",
|
|
81
|
-
"@fluid-app/
|
|
80
|
+
"@fluid-app/subscriptions-ui": "0.1.0",
|
|
82
81
|
"@fluid-app/subscriptions-core": "0.1.0",
|
|
83
|
-
"@fluid-app/
|
|
82
|
+
"@fluid-app/typescript-config": "0.0.0",
|
|
84
83
|
"@fluid-app/user-contacts-api-client": "0.1.0",
|
|
84
|
+
"@fluid-app/user-tasks-api-client": "0.1.0",
|
|
85
85
|
"@fluid-app/user-notes-api-client": "0.1.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|