@fluid-app/portal-sdk 0.1.111 → 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-IzNlAXvD.mjs → MessagingScreen-DJB1wth6.mjs} +2 -2
- 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-CFLI7j5s.mjs → ProductsScreen-Bxb-GTkK.mjs} +2 -2
- 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-CtQckby8.mjs → ShareablesScreen-DEq59fgF.mjs} +2 -2
- 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 +13 -13
- 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,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
require("./FluidProvider-
|
|
2
|
+
require("./FluidProvider-DEHDER6T.cjs");
|
|
3
3
|
require("./PointsWidget-DG0QQHqL.cjs");
|
|
4
4
|
require("./error-state-Bpq2CYvz.cjs");
|
|
5
5
|
require("./ScreenRenderer-DFcTR685.cjs");
|
|
@@ -35,7 +35,7 @@ require("./ToDoWidget-DZUvDwnJ.cjs");
|
|
|
35
35
|
require("./VideoWidget-BmVIIfvM.cjs");
|
|
36
36
|
require("./ScreenHeaderContext-DpVOhFzT.cjs");
|
|
37
37
|
require("./dist-BbS_7TvS.cjs");
|
|
38
|
-
const require_ContactsScreen = require("./ContactsScreen-
|
|
38
|
+
const require_ContactsScreen = require("./ContactsScreen-BaDlTbEn.cjs");
|
|
39
39
|
require("./order-detail-Bq7_UZ75.cjs");
|
|
40
40
|
require("./src-Bp-dRR29.cjs");
|
|
41
41
|
require("./dist-DkYXiQQ1.cjs");
|
|
@@ -2382,51 +2382,6 @@ function createFluidClient(config) {
|
|
|
2382
2382
|
}
|
|
2383
2383
|
}
|
|
2384
2384
|
/**
|
|
2385
|
-
* Request wrapper for paginated list endpoints.
|
|
2386
|
-
* Parses the API envelope and returns both `data` and cursor pagination metadata.
|
|
2387
|
-
* Falls back gracefully when the response is not an envelope.
|
|
2388
|
-
*/
|
|
2389
|
-
async function requestPaginated(endpoint, options = {}) {
|
|
2390
|
-
const { method = defaultRequestOptions.method, headers: customHeaders, params, body, signal } = options;
|
|
2391
|
-
const url = buildUrl(endpoint, method === HTTP_METHODS.GET ? params : void 0);
|
|
2392
|
-
const headers = buildHeaders(customHeaders);
|
|
2393
|
-
let response;
|
|
2394
|
-
try {
|
|
2395
|
-
const fetchOptions = {
|
|
2396
|
-
method,
|
|
2397
|
-
headers,
|
|
2398
|
-
credentials: "include"
|
|
2399
|
-
};
|
|
2400
|
-
if (signal !== void 0) fetchOptions.signal = signal;
|
|
2401
|
-
if (body && method !== HTTP_METHODS.GET) fetchOptions.body = JSON.stringify(body);
|
|
2402
|
-
response = await fetch(url, fetchOptions);
|
|
2403
|
-
} catch (networkError) {
|
|
2404
|
-
throw new ApiError(`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`, 0, null);
|
|
2405
|
-
}
|
|
2406
|
-
if (response.status === 401) {
|
|
2407
|
-
effectiveOnAuthError();
|
|
2408
|
-
throw new ApiError("Authentication required", 401, null);
|
|
2409
|
-
}
|
|
2410
|
-
if (!response.ok) try {
|
|
2411
|
-
if (response.headers.get("content-type")?.includes("application/json")) {
|
|
2412
|
-
const errorData = await response.json();
|
|
2413
|
-
throw new ApiError(extractErrorMessage(errorData, `${method} request failed`), response.status, "errors" in errorData ? errorData.errors : errorData);
|
|
2414
|
-
} else throw new ApiError(`${method} request failed with status ${response.status}`, response.status, null);
|
|
2415
|
-
} catch (error) {
|
|
2416
|
-
if (isApiError(error)) throw error;
|
|
2417
|
-
throw new ApiError(`${method} request failed with status ${response.status}`, response.status, null);
|
|
2418
|
-
}
|
|
2419
|
-
const raw = await response.json();
|
|
2420
|
-
if (isApiEnvelope(raw)) return {
|
|
2421
|
-
data: raw.data,
|
|
2422
|
-
pagination: raw.meta.pagination
|
|
2423
|
-
};
|
|
2424
|
-
return {
|
|
2425
|
-
data: raw,
|
|
2426
|
-
pagination: void 0
|
|
2427
|
-
};
|
|
2428
|
-
}
|
|
2429
|
-
/**
|
|
2430
2385
|
* Helper to safely convert typed params to Record<string, unknown>.
|
|
2431
2386
|
* Type assertion required: TypeScript's structural typing allows any object
|
|
2432
2387
|
* to be treated as Record<string, unknown> when we only need to iterate
|
|
@@ -2475,25 +2430,6 @@ function createFluidClient(config) {
|
|
|
2475
2430
|
put,
|
|
2476
2431
|
patch,
|
|
2477
2432
|
delete: del,
|
|
2478
|
-
products: {
|
|
2479
|
-
list: (params) => requestPaginated("/api/company/v1/products", {
|
|
2480
|
-
method: HTTP_METHODS.GET,
|
|
2481
|
-
params: toParams(params)
|
|
2482
|
-
}),
|
|
2483
|
-
get: (id) => get(`/api/company/v1/products/${id}`),
|
|
2484
|
-
search: (query, params) => requestPaginated("/api/company/v1/products", {
|
|
2485
|
-
method: HTTP_METHODS.GET,
|
|
2486
|
-
params: {
|
|
2487
|
-
search_query: query,
|
|
2488
|
-
...toParams(params)
|
|
2489
|
-
}
|
|
2490
|
-
})
|
|
2491
|
-
},
|
|
2492
|
-
orders: {
|
|
2493
|
-
list: (params) => get("/api/orders", params),
|
|
2494
|
-
get: (id) => get(`/api/orders/${id}`),
|
|
2495
|
-
create: (data) => post("/api/orders", data)
|
|
2496
|
-
},
|
|
2497
2433
|
users: {
|
|
2498
2434
|
me: () => get("/api/me"),
|
|
2499
2435
|
switchCompany: (companyId) => put(`/api/authentication/company/${companyId}/switch`)
|
|
@@ -2502,9 +2438,6 @@ function createFluidClient(config) {
|
|
|
2502
2438
|
current: () => get("/api/reps/me"),
|
|
2503
2439
|
updateProfile: (data) => patch("/api/reps/me", data)
|
|
2504
2440
|
},
|
|
2505
|
-
profile: { get: async () => {
|
|
2506
|
-
return transformManifestToRepAppData(toRawManifest(await getFluidOSManifest(fetchClient, { platform: "browser" }))).profile;
|
|
2507
|
-
} },
|
|
2508
2441
|
app: {
|
|
2509
2442
|
getRaw: async () => {
|
|
2510
2443
|
return toRawManifest(await getFluidOSManifest(fetchClient, { platform: "browser" }));
|
|
@@ -2590,6 +2523,19 @@ function useThemeContext() {
|
|
|
2590
2523
|
return context;
|
|
2591
2524
|
}
|
|
2592
2525
|
//#endregion
|
|
2526
|
+
//#region src/providers/PortalTenantClientProvider.tsx
|
|
2527
|
+
const PortalTenantClientContext = createContext(null);
|
|
2528
|
+
const PortalTenantClientProvider = PortalTenantClientContext.Provider;
|
|
2529
|
+
/**
|
|
2530
|
+
* Returns the portal-tenant FetchClient from context.
|
|
2531
|
+
* Must be used within a FluidProvider.
|
|
2532
|
+
*/
|
|
2533
|
+
function usePortalTenantClient() {
|
|
2534
|
+
const client = useContext(PortalTenantClientContext);
|
|
2535
|
+
if (!client) throw new Error("usePortalTenantClient must be used within a FluidProvider");
|
|
2536
|
+
return client;
|
|
2537
|
+
}
|
|
2538
|
+
//#endregion
|
|
2593
2539
|
//#region src/providers/FluidAuthProvider.tsx
|
|
2594
2540
|
/**
|
|
2595
2541
|
* FluidAuthProvider - Authentication Provider for Fluid Portal SDK
|
|
@@ -2867,6 +2813,11 @@ function FluidProvider({ config, children, queryClient, initialTheme, themeConta
|
|
|
2867
2813
|
onAuthError: () => configRef.current.onAuthError?.()
|
|
2868
2814
|
}), [config.baseUrl]);
|
|
2869
2815
|
const fluidOsApi = useMemo(() => createFluidOsReadAdapter(client.fetchClient), [client.fetchClient]);
|
|
2816
|
+
const portalTenantClient = useMemo(() => createFetchClient({
|
|
2817
|
+
baseUrl: configRef.current.baseUrl,
|
|
2818
|
+
onAuthError: () => configRef.current.onAuthError?.(),
|
|
2819
|
+
credentials: "include"
|
|
2820
|
+
}), [config.baseUrl]);
|
|
2870
2821
|
const contextValue = useMemo(() => ({
|
|
2871
2822
|
client,
|
|
2872
2823
|
config: configRef.current
|
|
@@ -2895,16 +2846,19 @@ function FluidProvider({ config, children, queryClient, initialTheme, themeConta
|
|
|
2895
2846
|
client: queryClient ?? defaultQueryClient,
|
|
2896
2847
|
children: /* @__PURE__ */ jsx(FluidContext.Provider, {
|
|
2897
2848
|
value: contextValue,
|
|
2898
|
-
children: /* @__PURE__ */ jsx(
|
|
2899
|
-
value:
|
|
2900
|
-
children: /* @__PURE__ */ jsx(
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2849
|
+
children: /* @__PURE__ */ jsx(PortalTenantClientProvider, {
|
|
2850
|
+
value: portalTenantClient,
|
|
2851
|
+
children: /* @__PURE__ */ jsx(FluidOsApiProvider, {
|
|
2852
|
+
value: fluidOsApi,
|
|
2853
|
+
children: /* @__PURE__ */ jsx(CustomerIdEnricher, {
|
|
2854
|
+
baseUrl: dataSourceBaseUrl,
|
|
2855
|
+
getApiHeaders,
|
|
2856
|
+
variables: effectiveVariables,
|
|
2857
|
+
registry,
|
|
2858
|
+
themeProviderProps,
|
|
2859
|
+
onAuthError: config.onAuthError,
|
|
2860
|
+
children
|
|
2861
|
+
})
|
|
2908
2862
|
})
|
|
2909
2863
|
})
|
|
2910
2864
|
})
|
|
@@ -2967,6 +2921,6 @@ function useFluidContext() {
|
|
|
2967
2921
|
return context;
|
|
2968
2922
|
}
|
|
2969
2923
|
//#endregion
|
|
2970
|
-
export {
|
|
2924
|
+
export { AUTH_CONSTANTS as $, DEFAULT_FONT_FAMILIES as A, getForegroundColor as B, removeTheme as C, deserialiseTheme as D, transformThemes as E, DEFAULT_THEME_NAME as F, FONT_SIZE_KEYS as G, parseColor as H, getDefaultThemeDefinition as I, SHADE_STEPS as J, RADIUS_KEYS as K, generateThemeCSS as L, DEFAULT_RADII as M, DEFAULT_SPACING as N, serialiseTheme as O, DEFAULT_THEME_ID as P, clearTokens as Q, deriveDarkVariant as R, removeAllThemes as S, getActiveThemeId as T, resolveTheme as U, mergeDarkOverrides as V, FONT_FAMILY_KEYS as W, createDefaultAuthRedirect as X, DEFAULT_AUTH_URL as Y, cleanTokenFromUrl as Z, transformManifestToRepAppData as _, createScreen as a, useCountryStates as at, toScreenDefinition as b, FluidAuthProvider as c, createFetchClient as ct, FluidThemeProvider as d, USER_TYPES as et, useThemeContext as f, toRawManifest as g, isApiError as h, widgetPropertySchemas as i, deleteDatabase as it, DEFAULT_FONT_SIZES as j, DEFAULT_COLORS as k, useFluidAuthContext as l, createFluidClient as m, useFluidContext as n, useFluidOsApiOptional as nt, createWidgetFromShareable as o, useFluidPayApi as ot, ApiError as p, SEMANTIC_COLOR_NAMES as q, DEFAULT_SDK_WIDGET_REGISTRY as r, createPersister as rt, createWidgetRegistry as s, ApiError$1 as st, FluidProvider as t, isUserType as tt, usePortalTenantClient as u, toNavigationItem as v, buildThemeDefinition as w, applyTheme as x, normalizeComponentTree as y, generateShades as z };
|
|
2971
2925
|
|
|
2972
|
-
//# sourceMappingURL=FluidProvider-
|
|
2926
|
+
//# sourceMappingURL=FluidProvider-CMGu8wbx.mjs.map
|