@fluid-app/portal-sdk 0.1.112 → 0.1.114

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.
Files changed (91) hide show
  1. package/dist/{AppDownloadScreen-BvcyEKCk.mjs → AppDownloadScreen-85-mmB0D.mjs} +2 -2
  2. package/dist/{AppDownloadScreen-BvcyEKCk.mjs.map → AppDownloadScreen-85-mmB0D.mjs.map} +1 -1
  3. package/dist/{AppDownloadScreen-Uc9N7K_K.cjs → AppDownloadScreen-DjeXmc3C.cjs} +2 -2
  4. package/dist/{AppDownloadScreen-DzFc_CDn.cjs → AppDownloadScreen-zvqM2Niu.cjs} +2 -2
  5. package/dist/{AppDownloadScreen-DzFc_CDn.cjs.map → AppDownloadScreen-zvqM2Niu.cjs.map} +1 -1
  6. package/dist/{ContactsScreen-D2DYk3A-.cjs → ContactsScreen-CbOLlj7I.cjs} +2 -2
  7. package/dist/{ContactsScreen-C6cCTl51.cjs → ContactsScreen-Ck_0JVKN.cjs} +2 -2
  8. package/dist/{ContactsScreen-C6cCTl51.cjs.map → ContactsScreen-Ck_0JVKN.cjs.map} +1 -1
  9. package/dist/{ContactsScreen-BNqIi0XS.mjs → ContactsScreen-ljoKwQWZ.mjs} +2 -2
  10. package/dist/{ContactsScreen-BNqIi0XS.mjs.map → ContactsScreen-ljoKwQWZ.mjs.map} +1 -1
  11. package/dist/{FluidProvider-dTwaHRzI.mjs → FluidProvider-DV87ZCCY.mjs} +34 -79
  12. package/dist/FluidProvider-DV87ZCCY.mjs.map +1 -0
  13. package/dist/{FluidProvider-NnE6s3O0.cjs → FluidProvider-RXzH-KA9.cjs} +39 -78
  14. package/dist/FluidProvider-RXzH-KA9.cjs.map +1 -0
  15. package/dist/{MessagingScreen-DH0YxaOG.cjs → MessagingScreen-CkXV8WHH.cjs} +3 -3
  16. package/dist/{MessagingScreen-DH0YxaOG.cjs.map → MessagingScreen-CkXV8WHH.cjs.map} +1 -1
  17. package/dist/{MessagingScreen-Dv8HVEt-.mjs → MessagingScreen-CtH_ycNV.mjs} +3 -3
  18. package/dist/{MessagingScreen-Dv8HVEt-.mjs.map → MessagingScreen-CtH_ycNV.mjs.map} +1 -1
  19. package/dist/{MessagingScreen-C_tCav2Y.cjs → MessagingScreen-Dj1NK0CP.cjs} +2 -2
  20. package/dist/{MessagingScreen-BA6fMOmD.mjs → MessagingScreen-DyoTr6qg.mjs} +2 -3
  21. package/dist/{MySiteScreen-t89PLodk.mjs → MySiteScreen-BvLsBrYD.mjs} +2 -2
  22. package/dist/{MySiteScreen-t89PLodk.mjs.map → MySiteScreen-BvLsBrYD.mjs.map} +1 -1
  23. package/dist/{MySiteScreen-Bda8FzQ9.cjs → MySiteScreen-BzO3lthV.cjs} +2 -2
  24. package/dist/{MySiteScreen-DydtAGvt.cjs → MySiteScreen-DTW2mzIG.cjs} +2 -2
  25. package/dist/{MySiteScreen-DydtAGvt.cjs.map → MySiteScreen-DTW2mzIG.cjs.map} +1 -1
  26. package/dist/{OrdersScreen-BhJkW3TG.cjs → OrdersScreen-5WUQMIIr.cjs} +3 -3
  27. package/dist/{OrdersScreen-BhJkW3TG.cjs.map → OrdersScreen-5WUQMIIr.cjs.map} +1 -1
  28. package/dist/{OrdersScreen-DP1WdqVT.mjs → OrdersScreen-DpuLEnAB.mjs} +3 -3
  29. package/dist/{OrdersScreen-DP1WdqVT.mjs.map → OrdersScreen-DpuLEnAB.mjs.map} +1 -1
  30. package/dist/{OrdersScreen-DvaV61fj.cjs → OrdersScreen-pGm8L4IL.cjs} +2 -2
  31. package/dist/{ProductsScreen-DYECF3gJ.mjs → ProductsScreen-C9crLQdu.mjs} +2 -5
  32. package/dist/{ProductsScreen-CI9G5UJh.cjs → ProductsScreen-CJ4c9gD7.cjs} +2 -2
  33. package/dist/{ProductsScreen-sEcByLGy.mjs → ProductsScreen-D21JX2Fi.mjs} +3 -3
  34. package/dist/{ProductsScreen-sEcByLGy.mjs.map → ProductsScreen-D21JX2Fi.mjs.map} +1 -1
  35. package/dist/{ProductsScreen-ssonMzdl.cjs → ProductsScreen-DFDg4YKH.cjs} +3 -3
  36. package/dist/{ProductsScreen-ssonMzdl.cjs.map → ProductsScreen-DFDg4YKH.cjs.map} +1 -1
  37. package/dist/{ProfileScreen-BPvudlCM.cjs → ProfileScreen-6ncejUCd.cjs} +5 -5
  38. package/dist/{ProfileScreen-BPvudlCM.cjs.map → ProfileScreen-6ncejUCd.cjs.map} +1 -1
  39. package/dist/{ProfileScreen-Bc4znBmb.cjs → ProfileScreen-BFOtOkTV.cjs} +2 -2
  40. package/dist/{ProfileScreen-BWiBC4y3.mjs → ProfileScreen-DtRy_GWa.mjs} +5 -5
  41. package/dist/{ProfileScreen-BWiBC4y3.mjs.map → ProfileScreen-DtRy_GWa.mjs.map} +1 -1
  42. package/dist/{ShareablesScreen-CIrWSh5q.mjs → ShareablesScreen-BXBZ7Z-9.mjs} +5 -5
  43. package/dist/{ShareablesScreen-CIrWSh5q.mjs.map → ShareablesScreen-BXBZ7Z-9.mjs.map} +1 -1
  44. package/dist/{ShareablesScreen-BvBfPJ69.cjs → ShareablesScreen-C5pk-L4i.cjs} +2 -2
  45. package/dist/{ShareablesScreen-TEWnxGs0.mjs → ShareablesScreen-CEslRgCn.mjs} +2 -6
  46. package/dist/{ShareablesScreen-D3JVKFVA.cjs → ShareablesScreen-GggsoaXv.cjs} +5 -5
  47. package/dist/{ShareablesScreen-D3JVKFVA.cjs.map → ShareablesScreen-GggsoaXv.cjs.map} +1 -1
  48. package/dist/{ShopScreen-CDscN4-a.mjs → ShopScreen-DCV6T_CN.mjs} +4 -4
  49. package/dist/{ShopScreen-CDscN4-a.mjs.map → ShopScreen-DCV6T_CN.mjs.map} +1 -1
  50. package/dist/{ShopScreen-TWpb8sxs.cjs → ShopScreen-DRChaCjS.cjs} +2 -2
  51. package/dist/{ShopScreen-BTTKNmtT.cjs → ShopScreen-DW7BHdjS.cjs} +4 -4
  52. package/dist/{ShopScreen-BTTKNmtT.cjs.map → ShopScreen-DW7BHdjS.cjs.map} +1 -1
  53. package/dist/{SubscriptionsScreen-WtnN9Ka0.cjs → SubscriptionsScreen-Bn0UaE2W.cjs} +2 -2
  54. package/dist/{SubscriptionsScreen-B0drtNfN.cjs → SubscriptionsScreen-DPsEEgbq.cjs} +3 -3
  55. package/dist/{SubscriptionsScreen-B0drtNfN.cjs.map → SubscriptionsScreen-DPsEEgbq.cjs.map} +1 -1
  56. package/dist/{SubscriptionsScreen-D-BXah4H.mjs → SubscriptionsScreen-gJ0bWDng.mjs} +3 -3
  57. package/dist/{SubscriptionsScreen-D-BXah4H.mjs.map → SubscriptionsScreen-gJ0bWDng.mjs.map} +1 -1
  58. package/dist/index.cjs +35 -34
  59. package/dist/index.d.cts +183 -241
  60. package/dist/index.d.cts.map +1 -1
  61. package/dist/index.d.mts +183 -241
  62. package/dist/index.d.mts.map +1 -1
  63. package/dist/index.mjs +35 -35
  64. package/dist/{use-account-clients-vDDhNW8x.mjs → use-account-clients-DaJbAmJW.mjs} +2 -2
  65. package/dist/use-account-clients-DaJbAmJW.mjs.map +1 -0
  66. package/dist/{use-account-clients-CDTUFb6O.cjs → use-account-clients-DsnyF503.cjs} +2 -2
  67. package/dist/use-account-clients-DsnyF503.cjs.map +1 -0
  68. package/dist/{use-current-user-C7O5SJ_L.cjs → use-current-user-DdOenMYu.cjs} +3 -3
  69. package/dist/{use-current-user-C7O5SJ_L.cjs.map → use-current-user-DdOenMYu.cjs.map} +1 -1
  70. package/dist/{use-current-user-Czzb9Zc4.mjs → use-current-user-YXY2vnPc.mjs} +3 -3
  71. package/dist/{use-current-user-Czzb9Zc4.mjs.map → use-current-user-YXY2vnPc.mjs.map} +1 -1
  72. package/dist/{use-customer-account-DHZ8wLs9.mjs → use-customer-account-CceDA_tz.mjs} +3 -3
  73. package/dist/{use-customer-account-DHZ8wLs9.mjs.map → use-customer-account-CceDA_tz.mjs.map} +1 -1
  74. package/dist/{use-customer-account-zgiEdZ89.cjs → use-customer-account-fM3dyrQa.cjs} +3 -3
  75. package/dist/{use-customer-account-zgiEdZ89.cjs.map → use-customer-account-fM3dyrQa.cjs.map} +1 -1
  76. package/dist/{use-fluid-api-Wjw57-uD.cjs → use-fluid-api-Bv3G906Q.cjs} +7 -7
  77. package/dist/use-fluid-api-Bv3G906Q.cjs.map +1 -0
  78. package/dist/use-fluid-api-CvCyT9Qg.mjs +27 -0
  79. package/dist/use-fluid-api-CvCyT9Qg.mjs.map +1 -0
  80. package/dist/{use-fluid-auth-BPwsWZNu.cjs → use-fluid-auth-BLFWj2Cx.cjs} +2 -2
  81. package/dist/{use-fluid-auth-BPwsWZNu.cjs.map → use-fluid-auth-BLFWj2Cx.cjs.map} +1 -1
  82. package/dist/{use-fluid-auth-Dy5K7BQ9.mjs → use-fluid-auth-C2pSlmtB.mjs} +2 -2
  83. package/dist/{use-fluid-auth-Dy5K7BQ9.mjs.map → use-fluid-auth-C2pSlmtB.mjs.map} +1 -1
  84. package/package.json +16 -16
  85. package/dist/FluidProvider-NnE6s3O0.cjs.map +0 -1
  86. package/dist/FluidProvider-dTwaHRzI.mjs.map +0 -1
  87. package/dist/use-account-clients-CDTUFb6O.cjs.map +0 -1
  88. package/dist/use-account-clients-vDDhNW8x.mjs.map +0 -1
  89. package/dist/use-fluid-api-D0kldm0L.mjs +0 -27
  90. package/dist/use-fluid-api-D0kldm0L.mjs.map +0 -1
  91. 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)(FluidOsApiProvider, {
2915
- value: fluidOsApi,
2916
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomerIdEnricher, {
2917
- baseUrl: dataSourceBaseUrl,
2918
- getApiHeaders,
2919
- variables: effectiveVariables,
2920
- registry,
2921
- themeProviderProps,
2922
- onAuthError: config.onAuthError,
2923
- children
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
  })
@@ -2941,6 +2895,7 @@ function CustomerIdEnricher({ baseUrl, getApiHeaders, variables, registry, theme
2941
2895
  const fluidPayApi = (0, react.useMemo)(() => {
2942
2896
  return createFluidPayApi(createFetchClient({
2943
2897
  baseUrl: baseUrl.endsWith("/api") ? baseUrl : `${baseUrl.replace(/\/+$/, "")}/api`,
2898
+ credentials: "include",
2944
2899
  onAuthError: () => onAuthErrorRef.current?.()
2945
2900
  }));
2946
2901
  }, [baseUrl]);
@@ -3337,6 +3292,12 @@ Object.defineProperty(exports, "useFluidPayApi", {
3337
3292
  return useFluidPayApi;
3338
3293
  }
3339
3294
  });
3295
+ Object.defineProperty(exports, "usePortalTenantClient", {
3296
+ enumerable: true,
3297
+ get: function() {
3298
+ return usePortalTenantClient;
3299
+ }
3300
+ });
3340
3301
  Object.defineProperty(exports, "useThemeContext", {
3341
3302
  enumerable: true,
3342
3303
  get: function() {
@@ -3350,4 +3311,4 @@ Object.defineProperty(exports, "widgetPropertySchemas", {
3350
3311
  }
3351
3312
  });
3352
3313
 
3353
- //# sourceMappingURL=FluidProvider-NnE6s3O0.cjs.map
3314
+ //# sourceMappingURL=FluidProvider-RXzH-KA9.cjs.map