@fluid-app/portal-sdk 0.1.199 → 0.1.200

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 (62) hide show
  1. package/dist/{ContactsScreen-Cheiwaxn.cjs → ContactsScreen-BOMxeTG8.cjs} +2 -2
  2. package/dist/{ContactsScreen-BtBNMZzG.mjs → ContactsScreen-Bm9SlMY3.mjs} +17 -7
  3. package/dist/ContactsScreen-Bm9SlMY3.mjs.map +1 -0
  4. package/dist/{ContactsScreen-DvohvoOE.cjs → ContactsScreen-DflUjayA.cjs} +291 -281
  5. package/dist/ContactsScreen-DflUjayA.cjs.map +1 -0
  6. package/dist/{FluidProvider-D177ez3m.cjs → FluidProvider-ByBDIQeW.cjs} +6 -986
  7. package/dist/FluidProvider-ByBDIQeW.cjs.map +1 -0
  8. package/dist/{FluidProvider-DiJy4Zve.mjs → FluidProvider-DFZiXiqm.mjs} +3 -814
  9. package/dist/FluidProvider-DFZiXiqm.mjs.map +1 -0
  10. package/dist/{MessagingScreen-Cu3tcpPs.mjs → MessagingScreen-D6d83q2n.mjs} +2 -2
  11. package/dist/{MessagingScreen-Cu3tcpPs.mjs.map → MessagingScreen-D6d83q2n.mjs.map} +1 -1
  12. package/dist/{MessagingScreen-Ysi48svi.cjs → MessagingScreen-HT_HSiNW.cjs} +3 -3
  13. package/dist/{MessagingScreen-gKidMcrr.cjs → MessagingScreen-shEWzTmQ.cjs} +2 -2
  14. package/dist/{MessagingScreen-gKidMcrr.cjs.map → MessagingScreen-shEWzTmQ.cjs.map} +1 -1
  15. package/dist/{PortalContentApiProvider-CWRAw9kL.mjs → PortalContentApiProvider-CNYq1_OD.mjs} +114 -88
  16. package/dist/PortalContentApiProvider-CNYq1_OD.mjs.map +1 -0
  17. package/dist/{PortalContentApiProvider-CPnqELEX.cjs → PortalContentApiProvider-ChmcXmbv.cjs} +113 -87
  18. package/dist/PortalContentApiProvider-ChmcXmbv.cjs.map +1 -0
  19. package/dist/{ProductsScreen-Al6H4ujs.mjs → ProductsScreen-CDjpHF49.mjs} +2 -2
  20. package/dist/{ProductsScreen-Al6H4ujs.mjs.map → ProductsScreen-CDjpHF49.mjs.map} +1 -1
  21. package/dist/{ProductsScreen-CQ5-A8AL.cjs → ProductsScreen-CzfDX0xx.cjs} +2 -2
  22. package/dist/{ProductsScreen-CQ5-A8AL.cjs.map → ProductsScreen-CzfDX0xx.cjs.map} +1 -1
  23. package/dist/{ProductsScreen-CexZ0gx9.mjs → ProductsScreen-D6-ehQjh.mjs} +2 -2
  24. package/dist/{ProductsScreen-BnwMOZ4-.cjs → ProductsScreen-fN3fh3PB.cjs} +2 -2
  25. package/dist/{ProfileScreen-DJZoMzE6.cjs → ProfileScreen-B0EU-TLa.cjs} +101 -101
  26. package/dist/{ProfileScreen-DJZoMzE6.cjs.map → ProfileScreen-B0EU-TLa.cjs.map} +1 -1
  27. package/dist/{ProfileScreen-hE1S_99P.mjs → ProfileScreen-BIs70k9W.mjs} +3 -3
  28. package/dist/{ProfileScreen-hE1S_99P.mjs.map → ProfileScreen-BIs70k9W.mjs.map} +1 -1
  29. package/dist/{ProfileScreen-CGS7YkcT.cjs → ProfileScreen-Dqu2nK_2.cjs} +3 -3
  30. package/dist/{ShareablesScreen-CzTU7e0l.mjs → ShareablesScreen-B8rPq-_7.mjs} +2 -2
  31. package/dist/{ShareablesScreen-CzTU7e0l.mjs.map → ShareablesScreen-B8rPq-_7.mjs.map} +1 -1
  32. package/dist/{ShareablesScreen-DujtMoAi.cjs → ShareablesScreen-DFLAJxjs.cjs} +2 -2
  33. package/dist/{ShareablesScreen-CmZ5CX99.cjs → ShareablesScreen-DLXK1PAg.cjs} +2 -2
  34. package/dist/{ShareablesScreen-CmZ5CX99.cjs.map → ShareablesScreen-DLXK1PAg.cjs.map} +1 -1
  35. package/dist/{ShareablesScreen-yscAsNpq.mjs → ShareablesScreen-Dc57L9m8.mjs} +2 -2
  36. package/dist/{ShopScreen-Bdo59te-.mjs → ShopScreen-2yMsyFwk.mjs} +2 -2
  37. package/dist/{ShopScreen-Bdo59te-.mjs.map → ShopScreen-2yMsyFwk.mjs.map} +1 -1
  38. package/dist/{ShopScreen-DKlDKNom.cjs → ShopScreen-BmHSLZ7H.cjs} +2 -2
  39. package/dist/{ShopScreen-DKlDKNom.cjs.map → ShopScreen-BmHSLZ7H.cjs.map} +1 -1
  40. package/dist/{ShopScreen-R9zk7d5d.cjs → ShopScreen-kk4yLzrW.cjs} +3 -3
  41. package/dist/index.cjs +67 -67
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.cts +132 -128
  44. package/dist/index.d.cts.map +1 -1
  45. package/dist/index.d.mts +132 -128
  46. package/dist/index.d.mts.map +1 -1
  47. package/dist/index.mjs +21 -21
  48. package/dist/src-BRTXunU1.mjs +851 -0
  49. package/dist/src-BRTXunU1.mjs.map +1 -0
  50. package/dist/src-DvVPCD01.cjs +1038 -0
  51. package/dist/src-DvVPCD01.cjs.map +1 -0
  52. package/package.json +16 -16
  53. package/dist/ContactsScreen-BtBNMZzG.mjs.map +0 -1
  54. package/dist/ContactsScreen-DvohvoOE.cjs.map +0 -1
  55. package/dist/FluidProvider-D177ez3m.cjs.map +0 -1
  56. package/dist/FluidProvider-DiJy4Zve.mjs.map +0 -1
  57. package/dist/PortalContentApiProvider-CPnqELEX.cjs.map +0 -1
  58. package/dist/PortalContentApiProvider-CWRAw9kL.mjs.map +0 -1
  59. package/dist/countries-api-context-Dob_AzPO.mjs +0 -13
  60. package/dist/countries-api-context-Dob_AzPO.mjs.map +0 -1
  61. package/dist/countries-api-context-G-NW4BoH.cjs +0 -25
  62. package/dist/countries-api-context-G-NW4BoH.cjs.map +0 -1
@@ -1,10 +1,10 @@
1
1
  require("./chunk-9hOWP6kD.cjs");
2
- require("./FluidProvider-D177ez3m.cjs");
2
+ require("./FluidProvider-ByBDIQeW.cjs");
3
3
  require("./ScreenRenderer-DfeRRgBO.cjs");
4
4
  require("./account-api-context-DZP9IiGg.cjs");
5
5
  require("./store-api-context-D1gZn22Z.cjs");
6
6
  require("./mysite-api-context-CilZcDS4.cjs");
7
- require("./countries-api-context-G-NW4BoH.cjs");
7
+ require("./src-DvVPCD01.cjs");
8
8
  require("./registry-context-RWj2xJlC.cjs");
9
9
  require("./WidgetInteractionContext-Bd1hEEV2.cjs");
10
10
  require("./EmbedWidget-CLArhSmx.cjs");
@@ -39,6 +39,6 @@ require("./TableWidget-FDbnEYZb.cjs");
39
39
  require("./ToDoWidget-B2qEGt7v.cjs");
40
40
  require("./VideoWidget-sEVQcp9o.cjs");
41
41
  require("./ScreenHeaderContext-BXgWydjB.cjs");
42
- const require_ProfileScreen = require("./ProfileScreen-DJZoMzE6.cjs");
42
+ const require_ProfileScreen = require("./ProfileScreen-B0EU-TLa.cjs");
43
43
  exports.ProfileScreen = require_ProfileScreen.ProfileScreen;
44
44
  exports.profileScreenPropertySchema = require_ProfileScreen.profileScreenPropertySchema;
@@ -3,7 +3,7 @@ import { b as fluidToast } from "./src-BTbz18gY.mjs";
3
3
  import { t as useAccount } from "./use-account-Djaaw5GX.mjs";
4
4
  import { t as useStore } from "./use-store-D1Qv56T2.mjs";
5
5
  import { n as useAppNavigation } from "./AppNavigationContext-7JSRmNdX.mjs";
6
- import { a as ShareablesApp, c as ShareablesCoreProvider, n as usePortalContentContext, o as useFilePickerApi, r as toggleFavorite, s as ShareablesUIProvider, t as PortalContentApiProvider } from "./PortalContentApiProvider-CWRAw9kL.mjs";
6
+ import { a as ShareablesApp, c as ShareablesCoreProvider, n as usePortalContentContext, o as useFilePickerApi, r as toggleFavorite, s as ShareablesUIProvider, t as PortalContentApiProvider } from "./PortalContentApiProvider-CNYq1_OD.mjs";
7
7
  import { t as PortalProductsApiProvider } from "./PortalProductsApiProvider-B1IjNhl8.mjs";
8
8
  import { t as PORTAL_MYSITE_KEYS } from "./use-mysite-portal-axe_PFzR.mjs";
9
9
  import { useCallback, useMemo } from "react";
@@ -185,4 +185,4 @@ const shareablesScreenPropertySchema = {
185
185
  //#endregion
186
186
  export { shareablesScreenPropertySchema as n, ShareablesScreen as t };
187
187
 
188
- //# sourceMappingURL=ShareablesScreen-CzTU7e0l.mjs.map
188
+ //# sourceMappingURL=ShareablesScreen-B8rPq-_7.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ShareablesScreen-CzTU7e0l.mjs","names":[],"sources":["../src/screens/ShareablesScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { fluidToast } from \"@fluid-app/ui-primitives\";\nimport { PORTAL_MYSITE_KEYS } from \"@fluid-app/mysite-ui/portal/hooks/use-mysite-portal\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { ShareablesCoreProvider } from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ShareablesApp } from \"@fluid-app/shareables-ui\";\nimport { useFilePickerApi } from \"@fluid-app/file-picker-core\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useAccount } from \"../hooks/use-account\";\nimport { useStore } from \"../hooks/use-store\";\nimport { PortalProductsApiProvider } from \"../products/PortalProductsApiProvider\";\nimport {\n PortalContentApiProvider,\n usePortalContentContext,\n} from \"../content/PortalContentApiProvider\";\nimport { toggleFavorite } from \"../adapters/content-api-adapter\";\nimport { usePortalTenantClient } from \"../providers/PortalTenantClientProvider\";\n\ntype ShareablesScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\n/**\n * Parse the current shareables sub-route from the full slug.\n *\n * System nav slugs are \"share/products\", \"share/media\", \"share/playlists\".\n * Detail pages append an ID: \"share/products/123\", \"share/media/456\".\n *\n * \"share/products\" → screen=\"products\", detailId=null\n * \"share/products/123\" → screen=\"products\", detailId=\"123\"\n * \"share/media/456\" → screen=\"media\", detailId=\"456\"\n * \"share/playlists\" → screen=\"playlists\", detailId=null\n * \"share/playlists/789\" → screen=\"playlists\", detailId=\"789\"\n * \"share/files\" → screen=\"files\", detailId=null\n * \"share\" → screen=null (default to products)\n */\nfunction parseShareablesRoute(currentSlug: string): {\n screen: string | null;\n detailId: string | null;\n action: string | null;\n} {\n // Strip the \"share\" prefix\n const slugWithoutPrefix = currentSlug.replace(/^share\\/?/, \"\");\n if (!slugWithoutPrefix) {\n return { screen: null, detailId: null, action: null };\n }\n\n const parts = slugWithoutPrefix.split(\"/\");\n const screen = parts[0] || null;\n const detailId = parts[1] || null;\n const action = parts[2] || null;\n return { screen, detailId, action };\n}\n\nexport function ShareablesScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ShareablesScreenProps): React.JSX.Element {\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <PortalProductsApiProvider>\n <PortalContentApiProvider>\n <ShareablesScreenContent />\n </PortalContentApiProvider>\n </PortalProductsApiProvider>\n </div>\n );\n}\n\n/** Inner component rendered inside providers so hooks can access context. */\nfunction ShareablesScreenContent(): React.JSX.Element {\n const shareablesCtx = usePortalContentContext();\n const { productsApi: portalProductsApi } = shareablesCtx;\n const filePickerApi = useFilePickerApi();\n const { data: account } = useAccount();\n const { data: store } = useStore();\n const { currentSlug, navigate } = useAppNavigation();\n const isCustomer = account?.member_type === \"customer\";\n const client = usePortalTenantClient();\n const queryClient = useQueryClient();\n\n const fetchProducts = useCallback(\n async (search: string, cursor?: string, limit?: number, sort?: string) => {\n if (search) {\n return portalProductsApi.searchProducts(search, { cursor, limit });\n }\n return portalProductsApi.listProducts({ cursor, limit, sort });\n },\n [portalProductsApi],\n );\n\n const fetchProduct = useCallback(\n async (id: string | number) => portalProductsApi.getProduct(id),\n [portalProductsApi],\n );\n\n const { screen, detailId, action } = parseShareablesRoute(currentSlug);\n\n const handleNavigate = useCallback(\n (subScreen: string, id?: string) => {\n const path = id ? `share/${subScreen}/${id}` : `share/${subScreen}`;\n navigate(path);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n if (detailId && screen) {\n navigate(`share/${screen}`);\n } else {\n navigate(\"share/products\");\n }\n }, [navigate, detailId, screen]);\n\n const coreConfig = useMemo(\n () => ({\n user: account ? { id: account.id } : null,\n repContext: true,\n }),\n [account],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: account\n ? {\n id: account.id,\n company: { logo_url: store?.logo_url ?? null },\n }\n : undefined,\n // TODO(portal-tenant): affiliate_id not available from /api/account\n affiliateId: null,\n basePath: \"\",\n navigate: (path: string) => {\n const cleanPath = path.replace(/^\\//, \"\");\n const prefixed = cleanPath.startsWith(\"share/\")\n ? cleanPath\n : `share/${cleanPath}`;\n navigate(prefixed);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n error?: unknown;\n }) => {\n fluidToast({ title: opts.title, type: opts.type });\n if (opts.error) console.error(\"[Shareables]\", opts.error);\n },\n filePickerApi,\n onToggleFavorite: async (params: {\n favoriteableId: number;\n favoriteableType: string;\n }) => {\n const result = await toggleFavorite(\n client,\n params.favoriteableId,\n params.favoriteableType,\n );\n void queryClient.invalidateQueries({\n queryKey: PORTAL_MYSITE_KEYS.favorites(),\n });\n return result;\n },\n onMySiteShare: async (params: {\n shareLink: string;\n relateable_id: number;\n relateable_type: string;\n }) => {\n await toggleFavorite(\n client,\n params.relateable_id,\n params.relateable_type,\n );\n void queryClient.invalidateQueries({\n queryKey: PORTAL_MYSITE_KEYS.favorites(),\n });\n },\n onDeletePlaylist: isCustomer\n ? undefined\n : async (playlistId: number) => {\n await shareablesCtx.playlistsAdapter.deletePlaylist(playlistId);\n },\n mediaProductsApi: isCustomer\n ? undefined\n : shareablesCtx.mediaProductsAdapter,\n searchProducts: isCustomer\n ? undefined\n : async (\n query: string,\n options?: { cursor?: string | null; limit?: number },\n ) => {\n // Empty query → listProducts so the tag modal opens with\n // suggestions instead of a blank state. Non-empty → real search.\n // Both APIs forward cursor/limit so the tag modal can paginate.\n const limit = options?.limit ?? 25;\n const cursor = options?.cursor ?? undefined;\n const result =\n query.trim().length > 0\n ? await portalProductsApi.searchProducts(query, {\n cursor,\n limit,\n })\n : await portalProductsApi.listProducts({ cursor, limit });\n // Filter out products without an id — mapping an id-less record\n // to `id: 0` would let a subsequent add/remove tag operation\n // silently run on id=0 (confusing 404/422 at best, incorrect\n // mutation at worst).\n const mapped = (result.products ?? [])\n .map(\n (p: {\n id?: number;\n title?: string;\n name?: string;\n image_url?: string | null;\n price?: string | null;\n }) =>\n p.id != null\n ? {\n id: p.id,\n name: p.name ?? p.title ?? \"Untitled\",\n image_url: p.image_url ?? null,\n price: p.price ?? null,\n }\n : null,\n )\n .filter((p): p is NonNullable<typeof p> => p !== null);\n return {\n products: mapped,\n nextCursor: result.meta?.pagination?.next_cursor ?? null,\n };\n },\n readOnly: isCustomer,\n uploadThumbnail: isCustomer\n ? undefined\n : async (blob: Blob, filename: string) => {\n const formData = new FormData();\n formData.append(\"asset[name]\", filename);\n formData.append(\"asset[file]\", blob, filename);\n const response = await client.requestWithFormData<{\n asset?: { default_variant_url?: string | null };\n }>(\"/api/content/dam/assets\", formData);\n const url = response.asset?.default_variant_url;\n if (!url) {\n // DAM accepted the upload but didn't return a playable URL.\n // Throwing here lets the caller (MediaEditScreen catch handler)\n // surface a toast and keeps the pending thumbnail state clean —\n // returning \"\" silently would corrupt the save payload with an\n // empty thumbnail URL.\n throw new Error(\"Thumbnail upload succeeded but no URL returned\");\n }\n return url;\n },\n }),\n [\n account,\n store,\n navigate,\n filePickerApi,\n isCustomer,\n shareablesCtx.playlistsAdapter,\n shareablesCtx.mediaProductsAdapter,\n portalProductsApi,\n client,\n queryClient,\n ],\n );\n\n return (\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ShareablesApp\n screen={screen}\n detailId={detailId}\n action={action}\n companyLogoUrl={undefined}\n countryCode={undefined}\n fetchProducts={fetchProducts}\n fetchProduct={fetchProduct}\n onNavigate={handleNavigate}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n );\n}\n\nexport const shareablesScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ShareablesScreen\",\n displayName: \"Shareables Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAS,qBAAqB,aAI5B;CAEA,MAAM,oBAAoB,YAAY,QAAQ,aAAa,GAAG;AAC9D,KAAI,CAAC,kBACH,QAAO;EAAE,QAAQ;EAAM,UAAU;EAAM,QAAQ;EAAM;CAGvD,MAAM,QAAQ,kBAAkB,MAAM,IAAI;AAI1C,QAAO;EAAE,QAHM,MAAM,MAAM;EAGV,UAFA,MAAM,MAAM;EAEF,QADZ,MAAM,MAAM;EACQ;;AAGrC,SAAgB,iBAAiB,EAE/B,YACA,WACA,aACA,SACA,cAEA,GAAG,YACwC;AAC3C,QACE,oBAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,oBAAC,2BAAD,EAAA,UACE,oBAAC,0BAAD,EAAA,UACE,oBAAC,yBAAD,EAA2B,CAAA,EACF,CAAA,EACD,CAAA;EACxB,CAAA;;;AAKV,SAAS,0BAA6C;CACpD,MAAM,gBAAgB,yBAAyB;CAC/C,MAAM,EAAE,aAAa,sBAAsB;CAC3C,MAAM,gBAAgB,kBAAkB;CACxC,MAAM,EAAE,MAAM,YAAY,YAAY;CACtC,MAAM,EAAE,MAAM,UAAU,UAAU;CAClC,MAAM,EAAE,aAAa,aAAa,kBAAkB;CACpD,MAAM,aAAa,SAAS,gBAAgB;CAC5C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IACA;IACA;IACA,cAAc;IACd,cAAc;IACd;IACA;IACA;IACD,CACF;aAKK,oBAAC,eAAD;IACU;IACE;IACF;IACR,gBAAgB,KAAA;IAChB,aAAa,KAAA;IACE;IACD;IACd,YAAY;IACZ,QAAQ;IACR,CAAA;GACmB,CAAA;EACA,CAAA;;AAI7B,MAAa,iCAAuD;CAClE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
1
+ {"version":3,"file":"ShareablesScreen-B8rPq-_7.mjs","names":[],"sources":["../src/screens/ShareablesScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { fluidToast } from \"@fluid-app/ui-primitives\";\nimport { PORTAL_MYSITE_KEYS } from \"@fluid-app/mysite-ui/portal/hooks/use-mysite-portal\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { ShareablesCoreProvider } from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ShareablesApp } from \"@fluid-app/shareables-ui\";\nimport { useFilePickerApi } from \"@fluid-app/file-picker-core\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useAccount } from \"../hooks/use-account\";\nimport { useStore } from \"../hooks/use-store\";\nimport { PortalProductsApiProvider } from \"../products/PortalProductsApiProvider\";\nimport {\n PortalContentApiProvider,\n usePortalContentContext,\n} from \"../content/PortalContentApiProvider\";\nimport { toggleFavorite } from \"../adapters/content-api-adapter\";\nimport { usePortalTenantClient } from \"../providers/PortalTenantClientProvider\";\n\ntype ShareablesScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\n/**\n * Parse the current shareables sub-route from the full slug.\n *\n * System nav slugs are \"share/products\", \"share/media\", \"share/playlists\".\n * Detail pages append an ID: \"share/products/123\", \"share/media/456\".\n *\n * \"share/products\" → screen=\"products\", detailId=null\n * \"share/products/123\" → screen=\"products\", detailId=\"123\"\n * \"share/media/456\" → screen=\"media\", detailId=\"456\"\n * \"share/playlists\" → screen=\"playlists\", detailId=null\n * \"share/playlists/789\" → screen=\"playlists\", detailId=\"789\"\n * \"share/files\" → screen=\"files\", detailId=null\n * \"share\" → screen=null (default to products)\n */\nfunction parseShareablesRoute(currentSlug: string): {\n screen: string | null;\n detailId: string | null;\n action: string | null;\n} {\n // Strip the \"share\" prefix\n const slugWithoutPrefix = currentSlug.replace(/^share\\/?/, \"\");\n if (!slugWithoutPrefix) {\n return { screen: null, detailId: null, action: null };\n }\n\n const parts = slugWithoutPrefix.split(\"/\");\n const screen = parts[0] || null;\n const detailId = parts[1] || null;\n const action = parts[2] || null;\n return { screen, detailId, action };\n}\n\nexport function ShareablesScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ShareablesScreenProps): React.JSX.Element {\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <PortalProductsApiProvider>\n <PortalContentApiProvider>\n <ShareablesScreenContent />\n </PortalContentApiProvider>\n </PortalProductsApiProvider>\n </div>\n );\n}\n\n/** Inner component rendered inside providers so hooks can access context. */\nfunction ShareablesScreenContent(): React.JSX.Element {\n const shareablesCtx = usePortalContentContext();\n const { productsApi: portalProductsApi } = shareablesCtx;\n const filePickerApi = useFilePickerApi();\n const { data: account } = useAccount();\n const { data: store } = useStore();\n const { currentSlug, navigate } = useAppNavigation();\n const isCustomer = account?.member_type === \"customer\";\n const client = usePortalTenantClient();\n const queryClient = useQueryClient();\n\n const fetchProducts = useCallback(\n async (search: string, cursor?: string, limit?: number, sort?: string) => {\n if (search) {\n return portalProductsApi.searchProducts(search, { cursor, limit });\n }\n return portalProductsApi.listProducts({ cursor, limit, sort });\n },\n [portalProductsApi],\n );\n\n const fetchProduct = useCallback(\n async (id: string | number) => portalProductsApi.getProduct(id),\n [portalProductsApi],\n );\n\n const { screen, detailId, action } = parseShareablesRoute(currentSlug);\n\n const handleNavigate = useCallback(\n (subScreen: string, id?: string) => {\n const path = id ? `share/${subScreen}/${id}` : `share/${subScreen}`;\n navigate(path);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n if (detailId && screen) {\n navigate(`share/${screen}`);\n } else {\n navigate(\"share/products\");\n }\n }, [navigate, detailId, screen]);\n\n const coreConfig = useMemo(\n () => ({\n user: account ? { id: account.id } : null,\n repContext: true,\n }),\n [account],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: account\n ? {\n id: account.id,\n company: { logo_url: store?.logo_url ?? null },\n }\n : undefined,\n // TODO(portal-tenant): affiliate_id not available from /api/account\n affiliateId: null,\n basePath: \"\",\n navigate: (path: string) => {\n const cleanPath = path.replace(/^\\//, \"\");\n const prefixed = cleanPath.startsWith(\"share/\")\n ? cleanPath\n : `share/${cleanPath}`;\n navigate(prefixed);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n error?: unknown;\n }) => {\n fluidToast({ title: opts.title, type: opts.type });\n if (opts.error) console.error(\"[Shareables]\", opts.error);\n },\n filePickerApi,\n onToggleFavorite: async (params: {\n favoriteableId: number;\n favoriteableType: string;\n }) => {\n const result = await toggleFavorite(\n client,\n params.favoriteableId,\n params.favoriteableType,\n );\n void queryClient.invalidateQueries({\n queryKey: PORTAL_MYSITE_KEYS.favorites(),\n });\n return result;\n },\n onMySiteShare: async (params: {\n shareLink: string;\n relateable_id: number;\n relateable_type: string;\n }) => {\n await toggleFavorite(\n client,\n params.relateable_id,\n params.relateable_type,\n );\n void queryClient.invalidateQueries({\n queryKey: PORTAL_MYSITE_KEYS.favorites(),\n });\n },\n onDeletePlaylist: isCustomer\n ? undefined\n : async (playlistId: number) => {\n await shareablesCtx.playlistsAdapter.deletePlaylist(playlistId);\n },\n mediaProductsApi: isCustomer\n ? undefined\n : shareablesCtx.mediaProductsAdapter,\n searchProducts: isCustomer\n ? undefined\n : async (\n query: string,\n options?: { cursor?: string | null; limit?: number },\n ) => {\n // Empty query → listProducts so the tag modal opens with\n // suggestions instead of a blank state. Non-empty → real search.\n // Both APIs forward cursor/limit so the tag modal can paginate.\n const limit = options?.limit ?? 25;\n const cursor = options?.cursor ?? undefined;\n const result =\n query.trim().length > 0\n ? await portalProductsApi.searchProducts(query, {\n cursor,\n limit,\n })\n : await portalProductsApi.listProducts({ cursor, limit });\n // Filter out products without an id — mapping an id-less record\n // to `id: 0` would let a subsequent add/remove tag operation\n // silently run on id=0 (confusing 404/422 at best, incorrect\n // mutation at worst).\n const mapped = (result.products ?? [])\n .map(\n (p: {\n id?: number;\n title?: string;\n name?: string;\n image_url?: string | null;\n price?: string | null;\n }) =>\n p.id != null\n ? {\n id: p.id,\n name: p.name ?? p.title ?? \"Untitled\",\n image_url: p.image_url ?? null,\n price: p.price ?? null,\n }\n : null,\n )\n .filter((p): p is NonNullable<typeof p> => p !== null);\n return {\n products: mapped,\n nextCursor: result.meta?.pagination?.next_cursor ?? null,\n };\n },\n readOnly: isCustomer,\n uploadThumbnail: isCustomer\n ? undefined\n : async (blob: Blob, filename: string) => {\n const formData = new FormData();\n formData.append(\"asset[name]\", filename);\n formData.append(\"asset[file]\", blob, filename);\n const response = await client.requestWithFormData<{\n asset?: { default_variant_url?: string | null };\n }>(\"/api/content/dam/assets\", formData);\n const url = response.asset?.default_variant_url;\n if (!url) {\n // DAM accepted the upload but didn't return a playable URL.\n // Throwing here lets the caller (MediaEditScreen catch handler)\n // surface a toast and keeps the pending thumbnail state clean —\n // returning \"\" silently would corrupt the save payload with an\n // empty thumbnail URL.\n throw new Error(\"Thumbnail upload succeeded but no URL returned\");\n }\n return url;\n },\n }),\n [\n account,\n store,\n navigate,\n filePickerApi,\n isCustomer,\n shareablesCtx.playlistsAdapter,\n shareablesCtx.mediaProductsAdapter,\n portalProductsApi,\n client,\n queryClient,\n ],\n );\n\n return (\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ShareablesApp\n screen={screen}\n detailId={detailId}\n action={action}\n companyLogoUrl={undefined}\n countryCode={undefined}\n fetchProducts={fetchProducts}\n fetchProduct={fetchProduct}\n onNavigate={handleNavigate}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n );\n}\n\nexport const shareablesScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ShareablesScreen\",\n displayName: \"Shareables Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAS,qBAAqB,aAI5B;CAEA,MAAM,oBAAoB,YAAY,QAAQ,aAAa,GAAG;AAC9D,KAAI,CAAC,kBACH,QAAO;EAAE,QAAQ;EAAM,UAAU;EAAM,QAAQ;EAAM;CAGvD,MAAM,QAAQ,kBAAkB,MAAM,IAAI;AAI1C,QAAO;EAAE,QAHM,MAAM,MAAM;EAGV,UAFA,MAAM,MAAM;EAEF,QADZ,MAAM,MAAM;EACQ;;AAGrC,SAAgB,iBAAiB,EAE/B,YACA,WACA,aACA,SACA,cAEA,GAAG,YACwC;AAC3C,QACE,oBAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,oBAAC,2BAAD,EAAA,UACE,oBAAC,0BAAD,EAAA,UACE,oBAAC,yBAAD,EAA2B,CAAA,EACF,CAAA,EACD,CAAA;EACxB,CAAA;;;AAKV,SAAS,0BAA6C;CACpD,MAAM,gBAAgB,yBAAyB;CAC/C,MAAM,EAAE,aAAa,sBAAsB;CAC3C,MAAM,gBAAgB,kBAAkB;CACxC,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AHW,MAAM,OAAO,oBAE3B,2BAA2B,SAAS,EAClB,OAAO;AAC5B,SAAI,CAAC,IAMH,OAAM,IAAI,MAAM,iDAAiD;AAEnE,YAAO;;IAEd,GACD;IACE;IACA;IACA;IACA;IACA;IACA,cAAc;IACd,cAAc;IACd;IACA;IACA;IACD,CACF;aAKK,oBAAC,eAAD;IACU;IACE;IACF;IACR,gBAAgB,KAAA;IAChB,aAAa,KAAA;IACE;IACD;IACd,YAAY;IACZ,QAAQ;IACR,CAAA;GACmB,CAAA;EACA,CAAA;;AAI7B,MAAa,iCAAuD;CAClE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
@@ -8,10 +8,10 @@ require("./dist-CN_rfvBt.cjs");
8
8
  require("./es-C37CagK2.cjs");
9
9
  require("./SearchSort-CUDMZIkf.cjs");
10
10
  require("./dist-bL3uiYn3.cjs");
11
- require("./PortalContentApiProvider-CPnqELEX.cjs");
11
+ require("./PortalContentApiProvider-ChmcXmbv.cjs");
12
12
  require("./dist-Ck1Xpuzh.cjs");
13
13
  require("./PortalProductsApiProvider-o1axGadc.cjs");
14
14
  require("./use-mysite-portal-CJBowMpK.cjs");
15
- const require_ShareablesScreen = require("./ShareablesScreen-CmZ5CX99.cjs");
15
+ const require_ShareablesScreen = require("./ShareablesScreen-DLXK1PAg.cjs");
16
16
  exports.ShareablesScreen = require_ShareablesScreen.ShareablesScreen;
17
17
  exports.shareablesScreenPropertySchema = require_ShareablesScreen.shareablesScreenPropertySchema;
@@ -4,7 +4,7 @@ const require_src = require("./src-D57IFKXU.cjs");
4
4
  const require_use_account = require("./use-account-C5QI6NSe.cjs");
5
5
  const require_use_store = require("./use-store-BLcehk1A.cjs");
6
6
  const require_AppNavigationContext = require("./AppNavigationContext-CbK8uCjS.cjs");
7
- const require_PortalContentApiProvider = require("./PortalContentApiProvider-CPnqELEX.cjs");
7
+ const require_PortalContentApiProvider = require("./PortalContentApiProvider-ChmcXmbv.cjs");
8
8
  const require_PortalProductsApiProvider = require("./PortalProductsApiProvider-o1axGadc.cjs");
9
9
  const require_use_mysite_portal = require("./use-mysite-portal-CJBowMpK.cjs");
10
10
  let react = require("react");
@@ -197,4 +197,4 @@ Object.defineProperty(exports, "shareablesScreenPropertySchema", {
197
197
  }
198
198
  });
199
199
 
200
- //# sourceMappingURL=ShareablesScreen-CmZ5CX99.cjs.map
200
+ //# sourceMappingURL=ShareablesScreen-DLXK1PAg.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ShareablesScreen-CmZ5CX99.cjs","names":["PortalProductsApiProvider","PortalContentApiProvider","usePortalContentContext","useFilePickerApi","useAccount","useStore","useAppNavigation","usePortalTenantClient","ShareablesCoreProvider","ShareablesUIProvider","toggleFavorite","PORTAL_MYSITE_KEYS","ShareablesApp"],"sources":["../src/screens/ShareablesScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { fluidToast } from \"@fluid-app/ui-primitives\";\nimport { PORTAL_MYSITE_KEYS } from \"@fluid-app/mysite-ui/portal/hooks/use-mysite-portal\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { ShareablesCoreProvider } from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ShareablesApp } from \"@fluid-app/shareables-ui\";\nimport { useFilePickerApi } from \"@fluid-app/file-picker-core\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useAccount } from \"../hooks/use-account\";\nimport { useStore } from \"../hooks/use-store\";\nimport { PortalProductsApiProvider } from \"../products/PortalProductsApiProvider\";\nimport {\n PortalContentApiProvider,\n usePortalContentContext,\n} from \"../content/PortalContentApiProvider\";\nimport { toggleFavorite } from \"../adapters/content-api-adapter\";\nimport { usePortalTenantClient } from \"../providers/PortalTenantClientProvider\";\n\ntype ShareablesScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\n/**\n * Parse the current shareables sub-route from the full slug.\n *\n * System nav slugs are \"share/products\", \"share/media\", \"share/playlists\".\n * Detail pages append an ID: \"share/products/123\", \"share/media/456\".\n *\n * \"share/products\" → screen=\"products\", detailId=null\n * \"share/products/123\" → screen=\"products\", detailId=\"123\"\n * \"share/media/456\" → screen=\"media\", detailId=\"456\"\n * \"share/playlists\" → screen=\"playlists\", detailId=null\n * \"share/playlists/789\" → screen=\"playlists\", detailId=\"789\"\n * \"share/files\" → screen=\"files\", detailId=null\n * \"share\" → screen=null (default to products)\n */\nfunction parseShareablesRoute(currentSlug: string): {\n screen: string | null;\n detailId: string | null;\n action: string | null;\n} {\n // Strip the \"share\" prefix\n const slugWithoutPrefix = currentSlug.replace(/^share\\/?/, \"\");\n if (!slugWithoutPrefix) {\n return { screen: null, detailId: null, action: null };\n }\n\n const parts = slugWithoutPrefix.split(\"/\");\n const screen = parts[0] || null;\n const detailId = parts[1] || null;\n const action = parts[2] || null;\n return { screen, detailId, action };\n}\n\nexport function ShareablesScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ShareablesScreenProps): React.JSX.Element {\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <PortalProductsApiProvider>\n <PortalContentApiProvider>\n <ShareablesScreenContent />\n </PortalContentApiProvider>\n </PortalProductsApiProvider>\n </div>\n );\n}\n\n/** Inner component rendered inside providers so hooks can access context. */\nfunction ShareablesScreenContent(): React.JSX.Element {\n const shareablesCtx = usePortalContentContext();\n const { productsApi: portalProductsApi } = shareablesCtx;\n const filePickerApi = useFilePickerApi();\n const { data: account } = useAccount();\n const { data: store } = useStore();\n const { currentSlug, navigate } = useAppNavigation();\n const isCustomer = account?.member_type === \"customer\";\n const client = usePortalTenantClient();\n const queryClient = useQueryClient();\n\n const fetchProducts = useCallback(\n async (search: string, cursor?: string, limit?: number, sort?: string) => {\n if (search) {\n return portalProductsApi.searchProducts(search, { cursor, limit });\n }\n return portalProductsApi.listProducts({ cursor, limit, sort });\n },\n [portalProductsApi],\n );\n\n const fetchProduct = useCallback(\n async (id: string | number) => portalProductsApi.getProduct(id),\n [portalProductsApi],\n );\n\n const { screen, detailId, action } = parseShareablesRoute(currentSlug);\n\n const handleNavigate = useCallback(\n (subScreen: string, id?: string) => {\n const path = id ? `share/${subScreen}/${id}` : `share/${subScreen}`;\n navigate(path);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n if (detailId && screen) {\n navigate(`share/${screen}`);\n } else {\n navigate(\"share/products\");\n }\n }, [navigate, detailId, screen]);\n\n const coreConfig = useMemo(\n () => ({\n user: account ? { id: account.id } : null,\n repContext: true,\n }),\n [account],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: account\n ? {\n id: account.id,\n company: { logo_url: store?.logo_url ?? null },\n }\n : undefined,\n // TODO(portal-tenant): affiliate_id not available from /api/account\n affiliateId: null,\n basePath: \"\",\n navigate: (path: string) => {\n const cleanPath = path.replace(/^\\//, \"\");\n const prefixed = cleanPath.startsWith(\"share/\")\n ? cleanPath\n : `share/${cleanPath}`;\n navigate(prefixed);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n error?: unknown;\n }) => {\n fluidToast({ title: opts.title, type: opts.type });\n if (opts.error) console.error(\"[Shareables]\", opts.error);\n },\n filePickerApi,\n onToggleFavorite: async (params: {\n favoriteableId: number;\n favoriteableType: string;\n }) => {\n const result = await toggleFavorite(\n client,\n params.favoriteableId,\n params.favoriteableType,\n );\n void queryClient.invalidateQueries({\n queryKey: PORTAL_MYSITE_KEYS.favorites(),\n });\n return result;\n },\n onMySiteShare: async (params: {\n shareLink: string;\n relateable_id: number;\n relateable_type: string;\n }) => {\n await toggleFavorite(\n client,\n params.relateable_id,\n params.relateable_type,\n );\n void queryClient.invalidateQueries({\n queryKey: PORTAL_MYSITE_KEYS.favorites(),\n });\n },\n onDeletePlaylist: isCustomer\n ? undefined\n : async (playlistId: number) => {\n await shareablesCtx.playlistsAdapter.deletePlaylist(playlistId);\n },\n mediaProductsApi: isCustomer\n ? undefined\n : shareablesCtx.mediaProductsAdapter,\n searchProducts: isCustomer\n ? undefined\n : async (\n query: string,\n options?: { cursor?: string | null; limit?: number },\n ) => {\n // Empty query → listProducts so the tag modal opens with\n // suggestions instead of a blank state. Non-empty → real search.\n // Both APIs forward cursor/limit so the tag modal can paginate.\n const limit = options?.limit ?? 25;\n const cursor = options?.cursor ?? undefined;\n const result =\n query.trim().length > 0\n ? await portalProductsApi.searchProducts(query, {\n cursor,\n limit,\n })\n : await portalProductsApi.listProducts({ cursor, limit });\n // Filter out products without an id — mapping an id-less record\n // to `id: 0` would let a subsequent add/remove tag operation\n // silently run on id=0 (confusing 404/422 at best, incorrect\n // mutation at worst).\n const mapped = (result.products ?? [])\n .map(\n (p: {\n id?: number;\n title?: string;\n name?: string;\n image_url?: string | null;\n price?: string | null;\n }) =>\n p.id != null\n ? {\n id: p.id,\n name: p.name ?? p.title ?? \"Untitled\",\n image_url: p.image_url ?? null,\n price: p.price ?? null,\n }\n : null,\n )\n .filter((p): p is NonNullable<typeof p> => p !== null);\n return {\n products: mapped,\n nextCursor: result.meta?.pagination?.next_cursor ?? null,\n };\n },\n readOnly: isCustomer,\n uploadThumbnail: isCustomer\n ? undefined\n : async (blob: Blob, filename: string) => {\n const formData = new FormData();\n formData.append(\"asset[name]\", filename);\n formData.append(\"asset[file]\", blob, filename);\n const response = await client.requestWithFormData<{\n asset?: { default_variant_url?: string | null };\n }>(\"/api/content/dam/assets\", formData);\n const url = response.asset?.default_variant_url;\n if (!url) {\n // DAM accepted the upload but didn't return a playable URL.\n // Throwing here lets the caller (MediaEditScreen catch handler)\n // surface a toast and keeps the pending thumbnail state clean —\n // returning \"\" silently would corrupt the save payload with an\n // empty thumbnail URL.\n throw new Error(\"Thumbnail upload succeeded but no URL returned\");\n }\n return url;\n },\n }),\n [\n account,\n store,\n navigate,\n filePickerApi,\n isCustomer,\n shareablesCtx.playlistsAdapter,\n shareablesCtx.mediaProductsAdapter,\n portalProductsApi,\n client,\n queryClient,\n ],\n );\n\n return (\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ShareablesApp\n screen={screen}\n detailId={detailId}\n action={action}\n companyLogoUrl={undefined}\n countryCode={undefined}\n fetchProducts={fetchProducts}\n fetchProduct={fetchProduct}\n onNavigate={handleNavigate}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n );\n}\n\nexport const shareablesScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ShareablesScreen\",\n displayName: \"Shareables Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAS,qBAAqB,aAI5B;CAEA,MAAM,oBAAoB,YAAY,QAAQ,aAAa,GAAG;AAC9D,KAAI,CAAC,kBACH,QAAO;EAAE,QAAQ;EAAM,UAAU;EAAM,QAAQ;EAAM;CAGvD,MAAM,QAAQ,kBAAkB,MAAM,IAAI;AAI1C,QAAO;EAAE,QAHM,MAAM,MAAM;EAGV,UAFA,MAAM,MAAM;EAEF,QADZ,MAAM,MAAM;EACQ;;AAGrC,SAAgB,iBAAiB,EAE/B,YACA,WACA,aACA,SACA,cAEA,GAAG,YACwC;AAC3C,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,iBAAA,GAAA,kBAAA,KAACA,kCAAAA,2BAAD,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;MACA;MACD,CAAC,GACF,MAAM,kBAAkB,aAAa;MAAE;MAAQ;MAAO,CAAC;AAwB7D,YAAO;MACL,WApBc,OAAO,YAAY,EAAE,EAClC,KACE,MAOC,EAAE,MAAM,OACJ;OACE,IAAI,EAAE;OACN,MAAM,EAAE,QAAQ,EAAE,SAAS;OAC3B,WAAW,EAAE,aAAa;OAC1B,OAAO,EAAE,SAAS;OACnB,GACD,KACP,CACA,QAAQ,MAAkC,MAAM,KAAK;MAGtD,YAAY,OAAO,MAAM,YAAY,eAAe;MACrD;;IAEP,UAAU;IACV,iBAAiB,aACb,KAAA,IACA,OAAO,MAAY,aAAqB;KACtC,MAAM,WAAW,IAAI,UAAU;AAC/B,cAAS,OAAO,eAAe,SAAS;AACxC,cAAS,OAAO,eAAe,MAAM,SAAS;KAI9C,MAAM,OAHW,MAAM,OAAO,oBAE3B,2BAA2B,SAAS,EAClB,OAAO;AAC5B,SAAI,CAAC,IAMH,OAAM,IAAI,MAAM,iDAAiD;AAEnE,YAAO;;IAEd,GACD;IACE;IACA;IACA;IACA;IACA;IACA,cAAc;IACd,cAAc;IACd;IACA;IACA;IACD,CACF;aAKK,iBAAA,GAAA,kBAAA,KAACC,iCAAAA,eAAD;IACU;IACE;IACF;IACR,gBAAgB,KAAA;IAChB,aAAa,KAAA;IACE;IACD;IACd,YAAY;IACZ,QAAQ;IACR,CAAA;GACmB,CAAA;EACA,CAAA;;AAI7B,MAAa,iCAAuD;CAClE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
1
+ {"version":3,"file":"ShareablesScreen-DLXK1PAg.cjs","names":["PortalProductsApiProvider","PortalContentApiProvider","usePortalContentContext","useFilePickerApi","useAccount","useStore","useAppNavigation","usePortalTenantClient","ShareablesCoreProvider","ShareablesUIProvider","toggleFavorite","PORTAL_MYSITE_KEYS","ShareablesApp"],"sources":["../src/screens/ShareablesScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { fluidToast } from \"@fluid-app/ui-primitives\";\nimport { PORTAL_MYSITE_KEYS } from \"@fluid-app/mysite-ui/portal/hooks/use-mysite-portal\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { ShareablesCoreProvider } from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ShareablesApp } from \"@fluid-app/shareables-ui\";\nimport { useFilePickerApi } from \"@fluid-app/file-picker-core\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useAccount } from \"../hooks/use-account\";\nimport { useStore } from \"../hooks/use-store\";\nimport { PortalProductsApiProvider } from \"../products/PortalProductsApiProvider\";\nimport {\n PortalContentApiProvider,\n usePortalContentContext,\n} from \"../content/PortalContentApiProvider\";\nimport { toggleFavorite } from \"../adapters/content-api-adapter\";\nimport { usePortalTenantClient } from \"../providers/PortalTenantClientProvider\";\n\ntype ShareablesScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\n/**\n * Parse the current shareables sub-route from the full slug.\n *\n * System nav slugs are \"share/products\", \"share/media\", \"share/playlists\".\n * Detail pages append an ID: \"share/products/123\", \"share/media/456\".\n *\n * \"share/products\" → screen=\"products\", detailId=null\n * \"share/products/123\" → screen=\"products\", detailId=\"123\"\n * \"share/media/456\" → screen=\"media\", detailId=\"456\"\n * \"share/playlists\" → screen=\"playlists\", detailId=null\n * \"share/playlists/789\" → screen=\"playlists\", detailId=\"789\"\n * \"share/files\" → screen=\"files\", detailId=null\n * \"share\" → screen=null (default to products)\n */\nfunction parseShareablesRoute(currentSlug: string): {\n screen: string | null;\n detailId: string | null;\n action: string | null;\n} {\n // Strip the \"share\" prefix\n const slugWithoutPrefix = currentSlug.replace(/^share\\/?/, \"\");\n if (!slugWithoutPrefix) {\n return { screen: null, detailId: null, action: null };\n }\n\n const parts = slugWithoutPrefix.split(\"/\");\n const screen = parts[0] || null;\n const detailId = parts[1] || null;\n const action = parts[2] || null;\n return { screen, detailId, action };\n}\n\nexport function ShareablesScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ShareablesScreenProps): React.JSX.Element {\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <PortalProductsApiProvider>\n <PortalContentApiProvider>\n <ShareablesScreenContent />\n </PortalContentApiProvider>\n </PortalProductsApiProvider>\n </div>\n );\n}\n\n/** Inner component rendered inside providers so hooks can access context. */\nfunction ShareablesScreenContent(): React.JSX.Element {\n const shareablesCtx = usePortalContentContext();\n const { productsApi: portalProductsApi } = shareablesCtx;\n const filePickerApi = useFilePickerApi();\n const { data: account } = useAccount();\n const { data: store } = useStore();\n const { currentSlug, navigate } = useAppNavigation();\n const isCustomer = account?.member_type === \"customer\";\n const client = usePortalTenantClient();\n const queryClient = useQueryClient();\n\n const fetchProducts = useCallback(\n async (search: string, cursor?: string, limit?: number, sort?: string) => {\n if (search) {\n return portalProductsApi.searchProducts(search, { cursor, limit });\n }\n return portalProductsApi.listProducts({ cursor, limit, sort });\n },\n [portalProductsApi],\n );\n\n const fetchProduct = useCallback(\n async (id: string | number) => portalProductsApi.getProduct(id),\n [portalProductsApi],\n );\n\n const { screen, detailId, action } = parseShareablesRoute(currentSlug);\n\n const handleNavigate = useCallback(\n (subScreen: string, id?: string) => {\n const path = id ? `share/${subScreen}/${id}` : `share/${subScreen}`;\n navigate(path);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n if (detailId && screen) {\n navigate(`share/${screen}`);\n } else {\n navigate(\"share/products\");\n }\n }, [navigate, detailId, screen]);\n\n const coreConfig = useMemo(\n () => ({\n user: account ? { id: account.id } : null,\n repContext: true,\n }),\n [account],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: account\n ? {\n id: account.id,\n company: { logo_url: store?.logo_url ?? null },\n }\n : undefined,\n // TODO(portal-tenant): affiliate_id not available from /api/account\n affiliateId: null,\n basePath: \"\",\n navigate: (path: string) => {\n const cleanPath = path.replace(/^\\//, \"\");\n const prefixed = cleanPath.startsWith(\"share/\")\n ? cleanPath\n : `share/${cleanPath}`;\n navigate(prefixed);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n error?: unknown;\n }) => {\n fluidToast({ title: opts.title, type: opts.type });\n if (opts.error) console.error(\"[Shareables]\", opts.error);\n },\n filePickerApi,\n onToggleFavorite: async (params: {\n favoriteableId: number;\n favoriteableType: string;\n }) => {\n const result = await toggleFavorite(\n client,\n params.favoriteableId,\n params.favoriteableType,\n );\n void queryClient.invalidateQueries({\n queryKey: PORTAL_MYSITE_KEYS.favorites(),\n });\n return result;\n },\n onMySiteShare: async (params: {\n shareLink: string;\n relateable_id: number;\n relateable_type: string;\n }) => {\n await toggleFavorite(\n client,\n params.relateable_id,\n params.relateable_type,\n );\n void queryClient.invalidateQueries({\n queryKey: PORTAL_MYSITE_KEYS.favorites(),\n });\n },\n onDeletePlaylist: isCustomer\n ? undefined\n : async (playlistId: number) => {\n await shareablesCtx.playlistsAdapter.deletePlaylist(playlistId);\n },\n mediaProductsApi: isCustomer\n ? undefined\n : shareablesCtx.mediaProductsAdapter,\n searchProducts: isCustomer\n ? undefined\n : async (\n query: string,\n options?: { cursor?: string | null; limit?: number },\n ) => {\n // Empty query → listProducts so the tag modal opens with\n // suggestions instead of a blank state. Non-empty → real search.\n // Both APIs forward cursor/limit so the tag modal can paginate.\n const limit = options?.limit ?? 25;\n const cursor = options?.cursor ?? undefined;\n const result =\n query.trim().length > 0\n ? await portalProductsApi.searchProducts(query, {\n cursor,\n limit,\n })\n : await portalProductsApi.listProducts({ cursor, limit });\n // Filter out products without an id — mapping an id-less record\n // to `id: 0` would let a subsequent add/remove tag operation\n // silently run on id=0 (confusing 404/422 at best, incorrect\n // mutation at worst).\n const mapped = (result.products ?? [])\n .map(\n (p: {\n id?: number;\n title?: string;\n name?: string;\n image_url?: string | null;\n price?: string | null;\n }) =>\n p.id != null\n ? {\n id: p.id,\n name: p.name ?? p.title ?? \"Untitled\",\n image_url: p.image_url ?? null,\n price: p.price ?? null,\n }\n : null,\n )\n .filter((p): p is NonNullable<typeof p> => p !== null);\n return {\n products: mapped,\n nextCursor: result.meta?.pagination?.next_cursor ?? null,\n };\n },\n readOnly: isCustomer,\n uploadThumbnail: isCustomer\n ? undefined\n : async (blob: Blob, filename: string) => {\n const formData = new FormData();\n formData.append(\"asset[name]\", filename);\n formData.append(\"asset[file]\", blob, filename);\n const response = await client.requestWithFormData<{\n asset?: { default_variant_url?: string | null };\n }>(\"/api/content/dam/assets\", formData);\n const url = response.asset?.default_variant_url;\n if (!url) {\n // DAM accepted the upload but didn't return a playable URL.\n // Throwing here lets the caller (MediaEditScreen catch handler)\n // surface a toast and keeps the pending thumbnail state clean —\n // returning \"\" silently would corrupt the save payload with an\n // empty thumbnail URL.\n throw new Error(\"Thumbnail upload succeeded but no URL returned\");\n }\n return url;\n },\n }),\n [\n account,\n store,\n navigate,\n filePickerApi,\n isCustomer,\n shareablesCtx.playlistsAdapter,\n shareablesCtx.mediaProductsAdapter,\n portalProductsApi,\n client,\n queryClient,\n ],\n );\n\n return (\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ShareablesApp\n screen={screen}\n detailId={detailId}\n action={action}\n companyLogoUrl={undefined}\n countryCode={undefined}\n fetchProducts={fetchProducts}\n fetchProduct={fetchProduct}\n onNavigate={handleNavigate}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n );\n}\n\nexport const shareablesScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ShareablesScreen\",\n displayName: \"Shareables Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAS,qBAAqB,aAI5B;CAEA,MAAM,oBAAoB,YAAY,QAAQ,aAAa,GAAG;AAC9D,KAAI,CAAC,kBACH,QAAO;EAAE,QAAQ;EAAM,UAAU;EAAM,QAAQ;EAAM;CAGvD,MAAM,QAAQ,kBAAkB,MAAM,IAAI;AAI1C,QAAO;EAAE,QAHM,MAAM,MAAM;EAGV,UAFA,MAAM,MAAM;EAEF,QADZ,MAAM,MAAM;EACQ;;AAGrC,SAAgB,iBAAiB,EAE/B,YACA,WACA,aACA,SACA,cAEA,GAAG,YACwC;AAC3C,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,iBAAA,GAAA,kBAAA,KAACA,kCAAAA,2BAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAACC,iCAAAA,0BAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,yBAAD,EAA2B,CAAA,EACF,CAAA,EACD,CAAA;EACxB,CAAA;;;AAKV,SAAS,0BAA6C;CACpD,MAAM,gBAAgBC,iCAAAA,yBAAyB;CAC/C,MAAM,EAAE,aAAa,sBAAsB;CAC3C,MAAM,gBAAgBC,iCAAAA,kBAAkB;CACxC,MAAM,EAAE,MAAM,YAAYC,oBAAAA,YAAY;CACtC,MAAM,EAAE,MAAM,UAAUC,kBAAAA,UAAU;CAClC,MAAM,EAAE,aAAa,aAAaC,6BAAAA,kBAAkB;CACpD,MAAM,aAAa,SAAS,gBAAgB;CAC5C,MAAM,SAASC,mCAAAA,uBAAuB;CACtC,MAAM,eAAA,GAAA,sBAAA,iBAA8B;CAEpC,MAAM,iBAAA,GAAA,MAAA,aACJ,OAAO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,SAAI,CAAC,IAMH,OAAM,IAAI,MAAM,iDAAiD;AAEnE,YAAO;;IAEd,GACD;IACE;IACA;IACA;IACA;IACA;IACA,cAAc;IACd,cAAc;IACd;IACA;IACA;IACD,CACF;aAKK,iBAAA,GAAA,kBAAA,KAACC,iCAAAA,eAAD;IACU;IACE;IACF;IACR,gBAAgB,KAAA;IAChB,aAAa,KAAA;IACE;IACD;IACd,YAAY;IACZ,QAAQ;IACR,CAAA;GACmB,CAAA;EACA,CAAA;;AAI7B,MAAa,iCAAuD;CAClE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
@@ -7,9 +7,9 @@ import "./ScreenHeaderContext-BD6Zo-ep.mjs";
7
7
  import "./dist-tv6N_HgZ.mjs";
8
8
  import "./SearchSort-TmRTxK16.mjs";
9
9
  import "./dist-wzcShuuv.mjs";
10
- import "./PortalContentApiProvider-CWRAw9kL.mjs";
10
+ import "./PortalContentApiProvider-CNYq1_OD.mjs";
11
11
  import "./sortable.esm-DFTEWOHN.mjs";
12
12
  import "./PortalProductsApiProvider-B1IjNhl8.mjs";
13
13
  import "./use-mysite-portal-axe_PFzR.mjs";
14
- import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-CzTU7e0l.mjs";
14
+ import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-B8rPq-_7.mjs";
15
15
  export { ShareablesScreen, shareablesScreenPropertySchema };
@@ -1,5 +1,5 @@
1
1
  import { r as __exportAll } from "./es-BeIE2Uzn.mjs";
2
- import { n as useFluidContext } from "./FluidProvider-DiJy4Zve.mjs";
2
+ import { n as useFluidContext } from "./FluidProvider-DFZiXiqm.mjs";
3
3
  import { $ as DropdownMenuSeparator, $t as BreadcrumbPage, A as Select, C as Skeleton, F as RadioGroup, I as RadioGroupItem, J as DropdownMenuContent, M as SelectItem, N as SelectTrigger, P as SelectValue, Q as DropdownMenuRadioItem, Qt as BreadcrumbList, X as DropdownMenuLabel, Xt as BreadcrumbItem, Yt as Breadcrumb, Z as DropdownMenuRadioGroup, Zt as BreadcrumbLink, en as BreadcrumbSeparator, j as SelectContent, pn as Button, q as DropdownMenu, rt as DropdownMenuTrigger, wt as Card } from "./src-BTbz18gY.mjs";
4
4
  import { n as useScreenHeaderActions, r as useScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-BD6Zo-ep.mjs";
5
5
  import { t as useStore } from "./use-store-D1Qv56T2.mjs";
@@ -1163,4 +1163,4 @@ function ProductBreadcrumb({ productId }) {
1163
1163
  //#endregion
1164
1164
  export { ShopScreen_exports as n, shopScreenPropertySchema as r, ShopScreen as t };
1165
1165
 
1166
- //# sourceMappingURL=ShopScreen-Bdo59te-.mjs.map
1166
+ //# sourceMappingURL=ShopScreen-2yMsyFwk.mjs.map