@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
|
@@ -2398,51 +2398,6 @@ function createFluidClient(config) {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
2400
|
/**
|
|
2401
|
-
* Request wrapper for paginated list endpoints.
|
|
2402
|
-
* Parses the API envelope and returns both `data` and cursor pagination metadata.
|
|
2403
|
-
* Falls back gracefully when the response is not an envelope.
|
|
2404
|
-
*/
|
|
2405
|
-
async function requestPaginated(endpoint, options = {}) {
|
|
2406
|
-
const { method = defaultRequestOptions.method, headers: customHeaders, params, body, signal } = options;
|
|
2407
|
-
const url = buildUrl(endpoint, method === HTTP_METHODS.GET ? params : void 0);
|
|
2408
|
-
const headers = buildHeaders(customHeaders);
|
|
2409
|
-
let response;
|
|
2410
|
-
try {
|
|
2411
|
-
const fetchOptions = {
|
|
2412
|
-
method,
|
|
2413
|
-
headers,
|
|
2414
|
-
credentials: "include"
|
|
2415
|
-
};
|
|
2416
|
-
if (signal !== void 0) fetchOptions.signal = signal;
|
|
2417
|
-
if (body && method !== HTTP_METHODS.GET) fetchOptions.body = JSON.stringify(body);
|
|
2418
|
-
response = await fetch(url, fetchOptions);
|
|
2419
|
-
} catch (networkError) {
|
|
2420
|
-
throw new ApiError(`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`, 0, null);
|
|
2421
|
-
}
|
|
2422
|
-
if (response.status === 401) {
|
|
2423
|
-
effectiveOnAuthError();
|
|
2424
|
-
throw new ApiError("Authentication required", 401, null);
|
|
2425
|
-
}
|
|
2426
|
-
if (!response.ok) try {
|
|
2427
|
-
if (response.headers.get("content-type")?.includes("application/json")) {
|
|
2428
|
-
const errorData = await response.json();
|
|
2429
|
-
throw new ApiError(extractErrorMessage(errorData, `${method} request failed`), response.status, "errors" in errorData ? errorData.errors : errorData);
|
|
2430
|
-
} else throw new ApiError(`${method} request failed with status ${response.status}`, response.status, null);
|
|
2431
|
-
} catch (error) {
|
|
2432
|
-
if (isApiError(error)) throw error;
|
|
2433
|
-
throw new ApiError(`${method} request failed with status ${response.status}`, response.status, null);
|
|
2434
|
-
}
|
|
2435
|
-
const raw = await response.json();
|
|
2436
|
-
if (isApiEnvelope(raw)) return {
|
|
2437
|
-
data: raw.data,
|
|
2438
|
-
pagination: raw.meta.pagination
|
|
2439
|
-
};
|
|
2440
|
-
return {
|
|
2441
|
-
data: raw,
|
|
2442
|
-
pagination: void 0
|
|
2443
|
-
};
|
|
2444
|
-
}
|
|
2445
|
-
/**
|
|
2446
2401
|
* Helper to safely convert typed params to Record<string, unknown>.
|
|
2447
2402
|
* Type assertion required: TypeScript's structural typing allows any object
|
|
2448
2403
|
* to be treated as Record<string, unknown> when we only need to iterate
|
|
@@ -2491,25 +2446,6 @@ function createFluidClient(config) {
|
|
|
2491
2446
|
put,
|
|
2492
2447
|
patch,
|
|
2493
2448
|
delete: del,
|
|
2494
|
-
products: {
|
|
2495
|
-
list: (params) => requestPaginated("/api/company/v1/products", {
|
|
2496
|
-
method: HTTP_METHODS.GET,
|
|
2497
|
-
params: toParams(params)
|
|
2498
|
-
}),
|
|
2499
|
-
get: (id) => get(`/api/company/v1/products/${id}`),
|
|
2500
|
-
search: (query, params) => requestPaginated("/api/company/v1/products", {
|
|
2501
|
-
method: HTTP_METHODS.GET,
|
|
2502
|
-
params: {
|
|
2503
|
-
search_query: query,
|
|
2504
|
-
...toParams(params)
|
|
2505
|
-
}
|
|
2506
|
-
})
|
|
2507
|
-
},
|
|
2508
|
-
orders: {
|
|
2509
|
-
list: (params) => get("/api/orders", params),
|
|
2510
|
-
get: (id) => get(`/api/orders/${id}`),
|
|
2511
|
-
create: (data) => post("/api/orders", data)
|
|
2512
|
-
},
|
|
2513
2449
|
users: {
|
|
2514
2450
|
me: () => get("/api/me"),
|
|
2515
2451
|
switchCompany: (companyId) => put(`/api/authentication/company/${companyId}/switch`)
|
|
@@ -2518,9 +2454,6 @@ function createFluidClient(config) {
|
|
|
2518
2454
|
current: () => get("/api/reps/me"),
|
|
2519
2455
|
updateProfile: (data) => patch("/api/reps/me", data)
|
|
2520
2456
|
},
|
|
2521
|
-
profile: { get: async () => {
|
|
2522
|
-
return transformManifestToRepAppData(toRawManifest(await getFluidOSManifest(fetchClient, { platform: "browser" }))).profile;
|
|
2523
|
-
} },
|
|
2524
2457
|
app: {
|
|
2525
2458
|
getRaw: async () => {
|
|
2526
2459
|
return toRawManifest(await getFluidOSManifest(fetchClient, { platform: "browser" }));
|
|
@@ -2606,6 +2539,19 @@ function useThemeContext() {
|
|
|
2606
2539
|
return context;
|
|
2607
2540
|
}
|
|
2608
2541
|
//#endregion
|
|
2542
|
+
//#region src/providers/PortalTenantClientProvider.tsx
|
|
2543
|
+
const PortalTenantClientContext = (0, react.createContext)(null);
|
|
2544
|
+
const PortalTenantClientProvider = PortalTenantClientContext.Provider;
|
|
2545
|
+
/**
|
|
2546
|
+
* Returns the portal-tenant FetchClient from context.
|
|
2547
|
+
* Must be used within a FluidProvider.
|
|
2548
|
+
*/
|
|
2549
|
+
function usePortalTenantClient() {
|
|
2550
|
+
const client = (0, react.useContext)(PortalTenantClientContext);
|
|
2551
|
+
if (!client) throw new Error("usePortalTenantClient must be used within a FluidProvider");
|
|
2552
|
+
return client;
|
|
2553
|
+
}
|
|
2554
|
+
//#endregion
|
|
2609
2555
|
//#region src/providers/FluidAuthProvider.tsx
|
|
2610
2556
|
/**
|
|
2611
2557
|
* FluidAuthProvider - Authentication Provider for Fluid Portal SDK
|
|
@@ -2883,6 +2829,11 @@ function FluidProvider({ config, children, queryClient, initialTheme, themeConta
|
|
|
2883
2829
|
onAuthError: () => configRef.current.onAuthError?.()
|
|
2884
2830
|
}), [config.baseUrl]);
|
|
2885
2831
|
const fluidOsApi = (0, react.useMemo)(() => createFluidOsReadAdapter(client.fetchClient), [client.fetchClient]);
|
|
2832
|
+
const portalTenantClient = (0, react.useMemo)(() => createFetchClient({
|
|
2833
|
+
baseUrl: configRef.current.baseUrl,
|
|
2834
|
+
onAuthError: () => configRef.current.onAuthError?.(),
|
|
2835
|
+
credentials: "include"
|
|
2836
|
+
}), [config.baseUrl]);
|
|
2886
2837
|
const contextValue = (0, react.useMemo)(() => ({
|
|
2887
2838
|
client,
|
|
2888
2839
|
config: configRef.current
|
|
@@ -2911,16 +2862,19 @@ function FluidProvider({ config, children, queryClient, initialTheme, themeConta
|
|
|
2911
2862
|
client: queryClient ?? defaultQueryClient,
|
|
2912
2863
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FluidContext.Provider, {
|
|
2913
2864
|
value: contextValue,
|
|
2914
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2915
|
-
value:
|
|
2916
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2865
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalTenantClientProvider, {
|
|
2866
|
+
value: portalTenantClient,
|
|
2867
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FluidOsApiProvider, {
|
|
2868
|
+
value: fluidOsApi,
|
|
2869
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomerIdEnricher, {
|
|
2870
|
+
baseUrl: dataSourceBaseUrl,
|
|
2871
|
+
getApiHeaders,
|
|
2872
|
+
variables: effectiveVariables,
|
|
2873
|
+
registry,
|
|
2874
|
+
themeProviderProps,
|
|
2875
|
+
onAuthError: config.onAuthError,
|
|
2876
|
+
children
|
|
2877
|
+
})
|
|
2924
2878
|
})
|
|
2925
2879
|
})
|
|
2926
2880
|
})
|
|
@@ -3337,6 +3291,12 @@ Object.defineProperty(exports, "useFluidPayApi", {
|
|
|
3337
3291
|
return useFluidPayApi;
|
|
3338
3292
|
}
|
|
3339
3293
|
});
|
|
3294
|
+
Object.defineProperty(exports, "usePortalTenantClient", {
|
|
3295
|
+
enumerable: true,
|
|
3296
|
+
get: function() {
|
|
3297
|
+
return usePortalTenantClient;
|
|
3298
|
+
}
|
|
3299
|
+
});
|
|
3340
3300
|
Object.defineProperty(exports, "useThemeContext", {
|
|
3341
3301
|
enumerable: true,
|
|
3342
3302
|
get: function() {
|
|
@@ -3350,4 +3310,4 @@ Object.defineProperty(exports, "widgetPropertySchemas", {
|
|
|
3350
3310
|
}
|
|
3351
3311
|
});
|
|
3352
3312
|
|
|
3353
|
-
//# sourceMappingURL=FluidProvider-
|
|
3313
|
+
//# sourceMappingURL=FluidProvider-DEHDER6T.cjs.map
|