@fluid-app/portal-sdk 0.1.524 → 0.1.526

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 (53) hide show
  1. package/dist/{ContactsScreen-DeXNeKhZ.cjs → ContactsScreen-C3ccWqAe.cjs} +41 -38
  2. package/dist/{ContactsScreen-DeXNeKhZ.cjs.map → ContactsScreen-C3ccWqAe.cjs.map} +1 -1
  3. package/dist/{ContactsScreen-C29wHxlb.mjs → ContactsScreen-C_UMnqhN.mjs} +2 -2
  4. package/dist/{ContactsScreen-xXR5SM7U.cjs → ContactsScreen-DEQAF0fC.cjs} +2 -2
  5. package/dist/{ContactsScreen-C5WtXbuk.mjs → ContactsScreen-DkChLGnB.mjs} +41 -38
  6. package/dist/{ContactsScreen-C5WtXbuk.mjs.map → ContactsScreen-DkChLGnB.mjs.map} +1 -1
  7. package/dist/{ContactsTranslationBridge-7hUvizHe.mjs → ContactsTranslationBridge-B4SlrRSR.mjs} +4 -3
  8. package/dist/{ContactsTranslationBridge-7hUvizHe.mjs.map → ContactsTranslationBridge-B4SlrRSR.mjs.map} +1 -1
  9. package/dist/{ContactsTranslationBridge-MTW9WS-j.cjs → ContactsTranslationBridge-C7Q9rpKH.cjs} +4 -3
  10. package/dist/{ContactsTranslationBridge-MTW9WS-j.cjs.map → ContactsTranslationBridge-C7Q9rpKH.cjs.map} +1 -1
  11. package/dist/{FluidProvider-BsFKQnUK.cjs → FluidProvider-B4msuwpR.cjs} +2 -2
  12. package/dist/{FluidProvider-BsFKQnUK.cjs.map → FluidProvider-B4msuwpR.cjs.map} +1 -1
  13. package/dist/{FluidProvider-BnzzWdqN.mjs → FluidProvider-CqFIXA9E.mjs} +2 -2
  14. package/dist/{FluidProvider-BnzzWdqN.mjs.map → FluidProvider-CqFIXA9E.mjs.map} +1 -1
  15. package/dist/{MessagingScreen-CPbJ2scr.mjs → MessagingScreen-8OZSwMYW.mjs} +3 -3
  16. package/dist/{MessagingScreen-Dn4YnN6I.cjs → MessagingScreen-CY8VbrOx.cjs} +3 -3
  17. package/dist/{MessagingScreen-CkTXrFJI.cjs → MessagingScreen-D_Y3Coa6.cjs} +38 -17
  18. package/dist/MessagingScreen-D_Y3Coa6.cjs.map +1 -0
  19. package/dist/{MessagingScreen-D0elghP1.mjs → MessagingScreen-DwU7sqzj.mjs} +38 -17
  20. package/dist/MessagingScreen-DwU7sqzj.mjs.map +1 -0
  21. package/dist/{OrdersScreen-BwrCczgL.mjs → OrdersScreen-CNYPIZBb.mjs} +3 -3
  22. package/dist/{OrdersScreen-Bkw8Gakq.mjs → OrdersScreen-CNzRy_gk.mjs} +3 -3
  23. package/dist/{OrdersScreen-Bkw8Gakq.mjs.map → OrdersScreen-CNzRy_gk.mjs.map} +1 -1
  24. package/dist/{OrdersScreen-DTyk0hBC.cjs → OrdersScreen-CSYdmQVZ.cjs} +3 -3
  25. package/dist/{OrdersScreen-CE6w3HTb.cjs → OrdersScreen-DZfsHpZK.cjs} +3 -3
  26. package/dist/{OrdersScreen-CE6w3HTb.cjs.map → OrdersScreen-DZfsHpZK.cjs.map} +1 -1
  27. package/dist/{ProfileScreen-Bjs-nBKq.cjs → ProfileScreen-B8Df2C1b.cjs} +3 -3
  28. package/dist/{ProfileScreen-Bjs-nBKq.cjs.map → ProfileScreen-B8Df2C1b.cjs.map} +1 -1
  29. package/dist/{ProfileScreen-CpPCRKK7.cjs → ProfileScreen-DYNeWfwK.cjs} +4 -4
  30. package/dist/{ProfileScreen-D7n2kWsy.mjs → ProfileScreen-DsFhKUi2.mjs} +4 -4
  31. package/dist/{ProfileScreen-W3mNfSGX.mjs → ProfileScreen-OH5UYO9J.mjs} +3 -3
  32. package/dist/{ProfileScreen-W3mNfSGX.mjs.map → ProfileScreen-OH5UYO9J.mjs.map} +1 -1
  33. package/dist/{SubscriptionsScreen-DdJKVEEk.cjs → SubscriptionsScreen-C0s1Dy_5.cjs} +4 -4
  34. package/dist/{SubscriptionsScreen-zlS5PXyR.mjs → SubscriptionsScreen-CJheY605.mjs} +4 -4
  35. package/dist/{SubscriptionsScreen-zlS5PXyR.mjs.map → SubscriptionsScreen-CJheY605.mjs.map} +1 -1
  36. package/dist/{SubscriptionsScreen-o3DKCuSN.mjs → SubscriptionsScreen-D0wBR3ji.mjs} +4 -4
  37. package/dist/{SubscriptionsScreen-C-v8uneR.cjs → SubscriptionsScreen-DplufOOc.cjs} +4 -4
  38. package/dist/{SubscriptionsScreen-C-v8uneR.cjs.map → SubscriptionsScreen-DplufOOc.cjs.map} +1 -1
  39. package/dist/index.cjs +18 -18
  40. package/dist/index.d.cts +309 -1
  41. package/dist/index.d.cts.map +1 -1
  42. package/dist/index.d.mts +309 -1
  43. package/dist/index.d.mts.map +1 -1
  44. package/dist/index.mjs +18 -18
  45. package/dist/task-composer-form-DDzxr6_A.cjs.map +1 -1
  46. package/dist/task-composer-form-DTHeuJ9-.mjs.map +1 -1
  47. package/dist/{use-portal-card-add-3ds-flow-gj_LSjop.mjs → use-portal-card-add-3ds-flow-ps5Lr2c3.mjs} +2 -2
  48. package/dist/{use-portal-card-add-3ds-flow-gj_LSjop.mjs.map → use-portal-card-add-3ds-flow-ps5Lr2c3.mjs.map} +1 -1
  49. package/dist/{use-portal-card-add-3ds-flow-BEZtTxel.cjs → use-portal-card-add-3ds-flow-r2akoTNE.cjs} +2 -2
  50. package/dist/{use-portal-card-add-3ds-flow-BEZtTxel.cjs.map → use-portal-card-add-3ds-flow-r2akoTNE.cjs.map} +1 -1
  51. package/package.json +19 -19
  52. package/dist/MessagingScreen-CkTXrFJI.cjs.map +0 -1
  53. package/dist/MessagingScreen-D0elghP1.mjs.map +0 -1
@@ -5,8 +5,8 @@ import "./account-api-context-8vg35E7d.mjs";
5
5
  import "./use-optional-store-DpB_jK4Q.mjs";
6
6
  import "./use-mysite-portal-BlOgU7cc.mjs";
7
7
  import "./Combobox-D8ukt9Tb.mjs";
8
- import "./FluidProvider-BnzzWdqN.mjs";
9
- import "./ContactsTranslationBridge-7hUvizHe.mjs";
8
+ import "./FluidProvider-CqFIXA9E.mjs";
9
+ import "./ContactsTranslationBridge-B4SlrRSR.mjs";
10
10
  import "./prop-types-CwLyDfek.mjs";
11
11
  import "./MobileBottomSheet-BKm3ysnd.mjs";
12
12
  import "./registry-context-DeQRPEBN.mjs";
@@ -33,7 +33,7 @@ import "./BulletListWidget-DvYksMFr.mjs";
33
33
  import "./preview-context-BWmZf_Qw.mjs";
34
34
  import "./CalendarWidget-XcCCAFsM.mjs";
35
35
  import "./error-state-Vy3ZKhKa.mjs";
36
- import { n as messagingScreenPropertySchema, t as MessagingScreen } from "./MessagingScreen-D0elghP1.mjs";
36
+ import { n as messagingScreenPropertySchema, t as MessagingScreen } from "./MessagingScreen-DwU7sqzj.mjs";
37
37
  import "./WidgetLoadingSkeleton-VmD6A-rW.mjs";
38
38
  import "./CardWidget-BeTseq2w.mjs";
39
39
  import "./helpers-BmP1pE-e.mjs";
@@ -5,8 +5,8 @@ require("./account-api-context-CrShCYnN.cjs");
5
5
  require("./use-optional-store-CIM4spDu.cjs");
6
6
  require("./use-mysite-portal-BCcNoszb.cjs");
7
7
  require("./Combobox-CReJLJfk.cjs");
8
- require("./FluidProvider-BsFKQnUK.cjs");
9
- require("./ContactsTranslationBridge-MTW9WS-j.cjs");
8
+ require("./FluidProvider-B4msuwpR.cjs");
9
+ require("./ContactsTranslationBridge-C7Q9rpKH.cjs");
10
10
  require("./prop-types-B7bFaw8n.cjs");
11
11
  require("./MobileBottomSheet-HzfAr8dE.cjs");
12
12
  require("./registry-context-DLWP4Bzy.cjs");
@@ -66,7 +66,7 @@ require("./translation-adapter-Dw2qIlJq.cjs");
66
66
  require("./translation-adapter-DoSZB36K.cjs");
67
67
  require("./translation-adapter-D_fMLp4u.cjs");
68
68
  require("./sidebar-zkV-HxHW.cjs");
69
- const require_MessagingScreen = require("./MessagingScreen-CkTXrFJI.cjs");
69
+ const require_MessagingScreen = require("./MessagingScreen-D_Y3Coa6.cjs");
70
70
  require("./ScreenHeaderContext-Df1DvpEW.cjs");
71
71
  require("./dist-ZqdCmmRH.cjs");
72
72
  require("./es-BF8O5PvG.cjs");
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require("./chunk-9hOWP6kD.cjs");
2
- const require_FluidProvider = require("./FluidProvider-BsFKQnUK.cjs");
2
+ const require_FluidProvider = require("./FluidProvider-B4msuwpR.cjs");
3
3
  const require_fetch_client = require("./fetch-client-wO-vh6_f.cjs");
4
- const require_ContactsTranslationBridge = require("./ContactsTranslationBridge-MTW9WS-j.cjs");
4
+ const require_ContactsTranslationBridge = require("./ContactsTranslationBridge-C7Q9rpKH.cjs");
5
5
  const require_static_dict_adapter = require("./static-dict-adapter-BCgoKiVT.cjs");
6
6
  const require_translation_api_context_factory = require("./translation-api-context-factory-mbsJk2UU.cjs");
7
7
  const require_use_account = require("./use-account-BRzw_4Wp.cjs");
@@ -176,7 +176,7 @@ async function fetchMessaging(config, options) {
176
176
  } : headers;
177
177
  let response;
178
178
  try {
179
- response = await fetch(url, {
179
+ response = await (config.fetch ?? fetch)(url, {
180
180
  method,
181
181
  headers: requestHeaders,
182
182
  body: hasBody ? JSON.stringify(input) : void 0
@@ -1059,7 +1059,7 @@ function createMessagingApi(config) {
1059
1059
  function deriveWebsocketUrl(baseUrl) {
1060
1060
  return `${baseUrl.replace(/\/+$/, "").replace(/\/api$/, "")}/cable`;
1061
1061
  }
1062
- function useMessagingConfig() {
1062
+ function useMessagingConfig(apiConfigOverride) {
1063
1063
  const { config } = require_ContactsTranslationBridge.useFluidContext();
1064
1064
  const getHeaders = (0, react.useCallback)(async () => {
1065
1065
  return {
@@ -1071,7 +1071,7 @@ function useMessagingConfig() {
1071
1071
  const base = config.baseUrl.replace(/\/+$/, "");
1072
1072
  return base.endsWith("/api") ? base : `${base}/api`;
1073
1073
  }, [config.baseUrl]);
1074
- const apiConfig = (0, react.useMemo)(() => ({
1074
+ const defaultApiConfig = (0, react.useMemo)(() => ({
1075
1075
  baseUrl: apiBaseUrl,
1076
1076
  getHeaders,
1077
1077
  ...config.onAuthError != null && { onAuthError: config.onAuthError }
@@ -1080,6 +1080,7 @@ function useMessagingConfig() {
1080
1080
  config.onAuthError,
1081
1081
  getHeaders
1082
1082
  ]);
1083
+ const apiConfig = apiConfigOverride ?? defaultApiConfig;
1083
1084
  return {
1084
1085
  apiConfig,
1085
1086
  messagingApi: (0, react.useMemo)(() => createMessagingApi(apiConfig), [apiConfig]),
@@ -2314,6 +2315,20 @@ const memberSettingsSchema = zod.z.object({
2314
2315
  });
2315
2316
  channelDetailsSchema.extend(memberSettingsSchema.shape);
2316
2317
  //#endregion
2318
+ //#region ../../messaging/core/src/cable/cable-url.ts
2319
+ /** Builds a Cable URL without exposing credentials for storefront sessions. */
2320
+ function messagingCableUrl(url, origin, token, sessionAuthentication) {
2321
+ const address = new URL(url, origin);
2322
+ if (sessionAuthentication) {
2323
+ const storefront = new URL(origin);
2324
+ const protocol = storefront.protocol === "https:" ? "wss:" : "ws:";
2325
+ if (address.host !== storefront.host || ![storefront.protocol, protocol].includes(address.protocol)) throw new Error("Member session WebSocket must use the storefront origin");
2326
+ address.searchParams.delete("token");
2327
+ address.searchParams.set("member_storefront", "true");
2328
+ } else if (token) address.searchParams.set("token", token);
2329
+ return address.toString();
2330
+ }
2331
+ //#endregion
2317
2332
  //#region ../../../node_modules/.pnpm/@rails+actioncable@7.2.300/node_modules/@rails/actioncable/app/assets/javascripts/actioncable.js
2318
2333
  var require_actioncable = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
2319
2334
  (function(global, factory) {
@@ -2884,7 +2899,7 @@ const NotificationEventSchema = zod.z.strictObject({
2884
2899
  var import_actioncable = /* @__PURE__ */ require_chunk.__toESM(require_actioncable(), 1);
2885
2900
  const APPEARANCE_LOG_BATCH_MS = 1200;
2886
2901
  function useMessagingCable(options) {
2887
- const { websocketUrl, token, recipientId, companyId, onAppearanceChange } = options;
2902
+ const { websocketUrl, token, recipientId, companyId, onAppearanceChange, sessionAuthentication = false } = options;
2888
2903
  const queryClient = (0, _tanstack_react_query.useQueryClient)();
2889
2904
  const appearanceLogBufferRef = (0, react.useRef)(/* @__PURE__ */ new Map());
2890
2905
  const appearanceLogTimerRef = (0, react.useRef)(null);
@@ -2930,7 +2945,7 @@ function useMessagingCable(options) {
2930
2945
  }, APPEARANCE_LOG_BATCH_MS);
2931
2946
  });
2932
2947
  (0, react.useEffect)(() => {
2933
- if (!token || !websocketUrl) return;
2948
+ if (!token && !sessionAuthentication || !websocketUrl) return;
2934
2949
  flushAppearanceLogs();
2935
2950
  appearanceLogBufferRef.current.clear();
2936
2951
  let consumer = null;
@@ -3126,7 +3141,7 @@ function useMessagingCable(options) {
3126
3141
  };
3127
3142
  const connectAt = (url) => {
3128
3143
  try {
3129
- consumer = import_actioncable.createConsumer(`${url}?token=${token}`);
3144
+ consumer = import_actioncable.createConsumer(messagingCableUrl(url, window.location.origin, token, sessionAuthentication));
3130
3145
  } catch (err) {
3131
3146
  console.error("[ws] failed to create consumer", err);
3132
3147
  return;
@@ -3177,7 +3192,7 @@ function useMessagingCable(options) {
3177
3192
  console.error("[ws] appearance subscription rejected");
3178
3193
  }
3179
3194
  });
3180
- notificationsSub = consumer.subscriptions.create({ channel: "NotificationsChannel" }, {
3195
+ if (!sessionAuthentication) notificationsSub = consumer.subscriptions.create({ channel: "NotificationsChannel" }, {
3181
3196
  connected: report,
3182
3197
  disconnected: () => handleDisconnect("notifications channel"),
3183
3198
  received: (data) => {
@@ -3206,6 +3221,7 @@ function useMessagingCable(options) {
3206
3221
  };
3207
3222
  }, [
3208
3223
  token,
3224
+ sessionAuthentication,
3209
3225
  recipientId,
3210
3226
  companyId,
3211
3227
  websocketUrl,
@@ -56514,7 +56530,7 @@ function ScheduledMessagesView({ onToast }) {
56514
56530
  }
56515
56531
  //#endregion
56516
56532
  //#region ../../messaging/ui/src/app/MessagingApp.tsx
56517
- function MessagingApp({ translationAdapter, api, auth, websocketUrl, token, renderImage, renderProfileTrigger, onNavigate, initialRoute, renderLockedDownlineItem, renderNewChannelSidebar, showAdminFeatures, canUseMyDownline, downlineData, topBar, messagesViewProps, newMessageViewProps, onToast, getMessageLink, renderProfileContent, hideTopBar, hideMobileBackButton, children }) {
56533
+ function MessagingApp({ translationAdapter, api, auth, websocketUrl, token, sessionAuthentication = false, renderImage, renderProfileTrigger, onNavigate, initialRoute, renderLockedDownlineItem, renderNewChannelSidebar, showAdminFeatures, canUseMyDownline, downlineData, topBar, messagesViewProps, newMessageViewProps, onToast, getMessageLink, renderProfileContent, hideTopBar, hideMobileBackButton, children }) {
56518
56534
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MessagingTranslationProvider, {
56519
56535
  value: translationAdapter,
56520
56536
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MessagingAppProvider, {
@@ -56527,9 +56543,10 @@ function MessagingApp({ translationAdapter, api, auth, websocketUrl, token, rend
56527
56543
  onNavigate,
56528
56544
  initialRoute,
56529
56545
  children: [
56530
- websocketUrl && token && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CableBootstrap, {
56546
+ websocketUrl && (token || sessionAuthentication) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CableBootstrap, {
56531
56547
  websocketUrl,
56532
- token,
56548
+ token: token ?? null,
56549
+ sessionAuthentication,
56533
56550
  recipientId: auth.recipientId,
56534
56551
  companyId: auth.companyId
56535
56552
  }),
@@ -56674,9 +56691,9 @@ function defaultToast(message, type) {
56674
56691
  type
56675
56692
  });
56676
56693
  }
56677
- function MessagingScreenContent({ translationAdapter, onToast, fileUploader, websocketUrl: websocketUrlOverride, ...divProps }) {
56694
+ function MessagingScreenContent({ translationAdapter, onToast, fileUploader, websocketUrl: websocketUrlOverride, apiConfig: apiConfigOverride, websocketSession, hideMobileBackButton = true, ...divProps }) {
56678
56695
  const { t } = useMessagingTranslation();
56679
- const { apiConfig, messagingApi, websocketUrl } = useMessagingConfig();
56696
+ const { apiConfig, messagingApi, websocketUrl } = useMessagingConfig(apiConfigOverride);
56680
56697
  const messagingAuth = useMessagingAuth();
56681
56698
  const { currentSlug, navigate } = require_AppNavigationContext.useAppNavigation();
56682
56699
  const uploader = fileUploader ?? disabledFileUploader;
@@ -56770,13 +56787,14 @@ function MessagingScreenContent({ translationAdapter, onToast, fileUploader, web
56770
56787
  auth: messagingAuth,
56771
56788
  websocketUrl: effectiveWsUrl,
56772
56789
  token: null,
56790
+ sessionAuthentication: websocketSession,
56773
56791
  initialRoute,
56774
56792
  onNavigate: handleMessagingNavigate,
56775
56793
  renderImage,
56776
56794
  showAdminFeatures: false,
56777
56795
  onToast: effectiveToast,
56778
56796
  hideTopBar: true,
56779
- hideMobileBackButton: true,
56797
+ hideMobileBackButton,
56780
56798
  messagesViewProps: {
56781
56799
  uploader,
56782
56800
  saveDrafts: true,
@@ -56790,7 +56808,7 @@ function MessagingScreenContent({ translationAdapter, onToast, fileUploader, web
56790
56808
  })
56791
56809
  });
56792
56810
  }
56793
- function MessagingScreen({ onToast, fileUploader, websocketUrl, background, textColor, accentColor, padding, borderRadius, ...divProps }) {
56811
+ function MessagingScreen({ onToast, fileUploader, websocketUrl, apiConfig, websocketSession, hideMobileBackButton, background, textColor, accentColor, padding, borderRadius, ...divProps }) {
56794
56812
  const translationAdapter = useMessagingTranslationAdapter();
56795
56813
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MessagingTranslationProvider, {
56796
56814
  value: translationAdapter,
@@ -56799,6 +56817,9 @@ function MessagingScreen({ onToast, fileUploader, websocketUrl, background, text
56799
56817
  onToast,
56800
56818
  fileUploader,
56801
56819
  websocketUrl,
56820
+ apiConfig,
56821
+ websocketSession,
56822
+ hideMobileBackButton,
56802
56823
  ...divProps
56803
56824
  })
56804
56825
  });
@@ -56850,4 +56871,4 @@ Object.defineProperty(exports, "useMessagingConfig", {
56850
56871
  }
56851
56872
  });
56852
56873
 
56853
- //# sourceMappingURL=MessagingScreen-CkTXrFJI.cjs.map
56874
+ //# sourceMappingURL=MessagingScreen-D_Y3Coa6.cjs.map