@fluid-app/portal-sdk 0.1.74 → 0.1.75
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/{ProductsScreen-xjbHMcvT.cjs → ProductsScreen-D1hLP4qn.cjs} +2 -2
- package/dist/{ProductsScreen-xjbHMcvT.cjs.map → ProductsScreen-D1hLP4qn.cjs.map} +1 -1
- package/dist/{ProductsScreen-BvpKx6qj.cjs → ProductsScreen-DD07WW44.cjs} +2 -2
- package/dist/{ProductsScreen-hvPMLQ9W.mjs → ProductsScreen-KLajmCLk.mjs} +2 -2
- package/dist/{ProductsScreen-hvPMLQ9W.mjs.map → ProductsScreen-KLajmCLk.mjs.map} +1 -1
- package/dist/{ProductsScreen-CI4XIK-8.mjs → ProductsScreen-SExV06P8.mjs} +2 -5
- package/dist/{ShareablesScreen-DdwtbkpR.cjs → ShareablesScreen-BKidUZz_.cjs} +2 -2
- package/dist/{ShareablesScreen-Cvo2ujdv.cjs → ShareablesScreen-CA8sm7n_.cjs} +2 -2
- package/dist/{ShareablesScreen-Cvo2ujdv.cjs.map → ShareablesScreen-CA8sm7n_.cjs.map} +1 -1
- package/dist/{ShareablesScreen-Bry6-PII.mjs → ShareablesScreen-CTruUco1.mjs} +2 -2
- package/dist/{ShareablesScreen-Bry6-PII.mjs.map → ShareablesScreen-CTruUco1.mjs.map} +1 -1
- package/dist/{ShareablesScreen-htQIO4oW.mjs → ShareablesScreen-C_aJXryA.mjs} +2 -5
- package/dist/index.cjs +7 -7
- package/dist/index.mjs +7 -7
- package/dist/{src-2yiesCJi.cjs → src-B-aQFEbA.cjs} +17 -5
- package/dist/src-B-aQFEbA.cjs.map +1 -0
- package/dist/{src-CghkSQGd.mjs → src-CvQ9ezCI.mjs} +17 -5
- package/dist/src-CvQ9ezCI.mjs.map +1 -0
- package/package.json +12 -12
- package/dist/src-2yiesCJi.cjs.map +0 -1
- package/dist/src-CghkSQGd.mjs.map +0 -1
|
@@ -2,7 +2,7 @@ require("./chunk-9hOWP6kD.cjs");
|
|
|
2
2
|
const require_use_account_clients = require("./use-account-clients-8yvdvTIC.cjs");
|
|
3
3
|
const require_use_current_user = require("./use-current-user-CWnlXU8G.cjs");
|
|
4
4
|
const require_AppNavigationContext = require("./AppNavigationContext-Agp0UkCQ.cjs");
|
|
5
|
-
const require_src = require("./src-
|
|
5
|
+
const require_src = require("./src-B-aQFEbA.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
//#region src/screens/ProductsScreen.tsx
|
|
@@ -77,4 +77,4 @@ Object.defineProperty(exports, "productsScreenPropertySchema", {
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
//# sourceMappingURL=ProductsScreen-
|
|
80
|
+
//# sourceMappingURL=ProductsScreen-D1hLP4qn.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductsScreen-
|
|
1
|
+
{"version":3,"file":"ProductsScreen-D1hLP4qn.cjs","names":["useSdkClient","useCurrentUser","useAppNavigation","ShareablesCoreProvider","ShareablesUIProvider","ProductsApp"],"sources":["../src/screens/ProductsScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\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, ProductsApp } from \"@fluid-app/shareables-ui\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\n\ntype ProductsScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\nexport function ProductsScreen({\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}: ProductsScreenProps): React.JSX.Element {\n const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\n\n // Extract product ID from slug: \"products/123\" → \"123\"\n const productId = useMemo(() => {\n const match = currentSlug.match(/^products\\/(.+)/);\n return match?.[1] ?? null;\n }, [currentSlug]);\n\n const handleSelectProduct = useCallback(\n (id: string) => {\n navigate(`products/${id}`);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n navigate(\"products\");\n }, [navigate]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n }),\n [domainClient, userData],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n basePath: \"\",\n navigate: (path: string) => {\n navigate(path);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n }) => {\n console.log(`[Products] ${opts.type}: ${opts.title}`);\n },\n }),\n [userData, navigate],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ProductsApp\n countryCode={userData?.country?.iso}\n companyLogoUrl={userData?.company?.logo_url}\n productId={productId}\n onSelectProduct={handleSelectProduct}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\n );\n}\n\nexport const productsScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ProductsScreen\",\n displayName: \"Products Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;AA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jB,QAAQ;KACR,CAAA;IACmB,CAAA;GACA,CAAA;EACrB,CAAA;;AAIV,MAAa,+BAAqD;CAChE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
|
|
@@ -37,8 +37,8 @@ require("./ScreenHeaderContext-wrJlkhgN.cjs");
|
|
|
37
37
|
require("./dist-BbS_7TvS.cjs");
|
|
38
38
|
require("./es-BSkb3AZk.cjs");
|
|
39
39
|
require("./dist-B4Ke7bHH.cjs");
|
|
40
|
-
require("./src-
|
|
40
|
+
require("./src-B-aQFEbA.cjs");
|
|
41
41
|
require("./dist-lO2OG0T5.cjs");
|
|
42
|
-
const require_ProductsScreen = require("./ProductsScreen-
|
|
42
|
+
const require_ProductsScreen = require("./ProductsScreen-D1hLP4qn.cjs");
|
|
43
43
|
exports.ProductsScreen = require_ProductsScreen.ProductsScreen;
|
|
44
44
|
exports.productsScreenPropertySchema = require_ProductsScreen.productsScreenPropertySchema;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as useSdkClient } from "./use-account-clients-G3DvbvPH.mjs";
|
|
2
2
|
import { n as useCurrentUser } from "./use-current-user-DJW-ZwIi.mjs";
|
|
3
3
|
import { n as useAppNavigation } from "./AppNavigationContext-Du3Qq0yc.mjs";
|
|
4
|
-
import { i as ShareablesCoreProvider, r as ShareablesUIProvider, t as ProductsApp } from "./src-
|
|
4
|
+
import { i as ShareablesCoreProvider, r as ShareablesUIProvider, t as ProductsApp } from "./src-CvQ9ezCI.mjs";
|
|
5
5
|
import { useCallback, useMemo } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region src/screens/ProductsScreen.tsx
|
|
@@ -65,4 +65,4 @@ const productsScreenPropertySchema = {
|
|
|
65
65
|
//#endregion
|
|
66
66
|
export { productsScreenPropertySchema as n, ProductsScreen as t };
|
|
67
67
|
|
|
68
|
-
//# sourceMappingURL=ProductsScreen-
|
|
68
|
+
//# sourceMappingURL=ProductsScreen-KLajmCLk.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductsScreen-
|
|
1
|
+
{"version":3,"file":"ProductsScreen-KLajmCLk.mjs","names":[],"sources":["../src/screens/ProductsScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\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, ProductsApp } from \"@fluid-app/shareables-ui\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\n\ntype ProductsScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\nexport function ProductsScreen({\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}: ProductsScreenProps): React.JSX.Element {\n const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\n\n // Extract product ID from slug: \"products/123\" → \"123\"\n const productId = useMemo(() => {\n const match = currentSlug.match(/^products\\/(.+)/);\n return match?.[1] ?? null;\n }, [currentSlug]);\n\n const handleSelectProduct = useCallback(\n (id: string) => {\n navigate(`products/${id}`);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n navigate(\"products\");\n }, [navigate]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n }),\n [domainClient, userData],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n basePath: \"\",\n navigate: (path: string) => {\n navigate(path);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n }) => {\n console.log(`[Products] ${opts.type}: ${opts.title}`);\n },\n }),\n [userData, navigate],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ProductsApp\n countryCode={userData?.country?.iso}\n companyLogoUrl={userData?.company?.logo_url}\n productId={productId}\n onSelectProduct={handleSelectProduct}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\n );\n}\n\nexport const productsScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ProductsScreen\",\n displayName: \"Products Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;AAsBA,SAAgB,eAAe,EAE7B,YACA,WACA,aACA,SACA,cAEA,GAAG,YACsC;CACzC,MAAM,eAAe,cAAc;CACnC,MAAM,EAAE,MAAM,aAAa,gBAAgB;CAC3C,MAAM,EAAE,aAAa,aAAa,kBAAkB;CAGpD,MAAM,YAAY,cAAc;AAE9B,SADc,YAAY,MAAM,kBAAkB,GACnC,MAAM;IACpB,CAAC,YAAY,CAAC;CAEjB,MAAM,sBAAsB,aACzB,OAAe;AACd,WAAS,YAAY,KAAK;IAE5B,CAAC,SAAS,CACX;CAED,MAAM,aAAa,kBAAkB;AACnC,WAAS,WAAW;IACnB,CAAC,SAAS,CAAC;CAEd,MAAM,aAAa,eACV;EACL,QAAQ;EACR,MAAM,WAAW,EAAE,IAAI,SAAS,IAAI,GAAG;EACxC,GACD,CAAC,cAAc,SAAS,CACzB;CAED,MAAM,WAAW,eACR;EACL,MAAM,WACF;GACE,IAAI,SAAS;GACb,SAAS,SAAS,UACd,EAAE,UAAU,SAAS,QAAQ,UAAU,GACvC;GACL,GACD,KAAA;EACJ,UAAU;EACV,WAAW,SAAiB;AAC1B,YAAS,KAAK;;EAEhB,YAAY,SAGN;AACJ,WAAQ,IAAI,cAAc,KAAK,KAAK,IAAI,KAAK,QAAQ;;EAExD,GACD,CAAC,UAAU,SAAS,CACrB;AAED,QACE,oBAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,oBAAC,wBAAD;GAAwB,QAAQ;aAC9B,oBAAC,sBAAD;IAAsB,QAAQ;cAC5B,oBAAC,aAAD;KACE,aAAa,UAAU,SAAS;KAChC,gBAAgB,UAAU,SAAS;KACxB;KACX,iBAAiB;KACjB,QAAQ;KACR,CAAA;IACmB,CAAA;GACA,CAAA;EACrB,CAAA;;AAIV,MAAa,+BAAqD;CAChE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
|
|
@@ -32,14 +32,11 @@ import "./SpacerWidget-CX7bjjNF.mjs";
|
|
|
32
32
|
import "./TableWidget-BDUXriyw.mjs";
|
|
33
33
|
import "./ToDoWidget-D52-GT7f.mjs";
|
|
34
34
|
import "./VideoWidget-ZMSFyE1Y.mjs";
|
|
35
|
-
import "./use-account-clients-G3DvbvPH.mjs";
|
|
36
35
|
import "./ScreenHeaderContext-NdrJ58Mg.mjs";
|
|
37
|
-
import "./use-current-user-DJW-ZwIi.mjs";
|
|
38
|
-
import "./AppNavigationContext-Du3Qq0yc.mjs";
|
|
39
36
|
import "./dist-CMGXkSgZ.mjs";
|
|
40
37
|
import "./es-1KItbbYg.mjs";
|
|
41
38
|
import "./dist-Cl4FsM3V.mjs";
|
|
42
|
-
import "./src-
|
|
39
|
+
import "./src-CvQ9ezCI.mjs";
|
|
43
40
|
import "./sortable.esm-CzzU6kIR.mjs";
|
|
44
|
-
import { n as productsScreenPropertySchema, t as ProductsScreen } from "./ProductsScreen-
|
|
41
|
+
import { n as productsScreenPropertySchema, t as ProductsScreen } from "./ProductsScreen-KLajmCLk.mjs";
|
|
45
42
|
export { ProductsScreen, productsScreenPropertySchema };
|
|
@@ -37,8 +37,8 @@ require("./ScreenHeaderContext-wrJlkhgN.cjs");
|
|
|
37
37
|
require("./dist-BbS_7TvS.cjs");
|
|
38
38
|
require("./es-BSkb3AZk.cjs");
|
|
39
39
|
require("./dist-B4Ke7bHH.cjs");
|
|
40
|
-
require("./src-
|
|
41
|
-
const require_ShareablesScreen = require("./ShareablesScreen-
|
|
40
|
+
require("./src-B-aQFEbA.cjs");
|
|
41
|
+
const require_ShareablesScreen = require("./ShareablesScreen-CA8sm7n_.cjs");
|
|
42
42
|
require("./dist-lO2OG0T5.cjs");
|
|
43
43
|
exports.ShareablesScreen = require_ShareablesScreen.ShareablesScreen;
|
|
44
44
|
exports.shareablesScreenPropertySchema = require_ShareablesScreen.shareablesScreenPropertySchema;
|
|
@@ -2,7 +2,7 @@ require("./chunk-9hOWP6kD.cjs");
|
|
|
2
2
|
const require_use_account_clients = require("./use-account-clients-8yvdvTIC.cjs");
|
|
3
3
|
const require_use_current_user = require("./use-current-user-CWnlXU8G.cjs");
|
|
4
4
|
const require_AppNavigationContext = require("./AppNavigationContext-Agp0UkCQ.cjs");
|
|
5
|
-
const require_src = require("./src-
|
|
5
|
+
const require_src = require("./src-B-aQFEbA.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
//#region ../../file-picker/api-client/src/client.ts
|
|
@@ -142,4 +142,4 @@ Object.defineProperty(exports, "shareablesScreenPropertySchema", {
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
//# sourceMappingURL=ShareablesScreen-
|
|
145
|
+
//# sourceMappingURL=ShareablesScreen-CA8sm7n_.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareablesScreen-Cvo2ujdv.cjs","names":["useSdkClient","useCurrentUser","useAppNavigation","ShareablesCoreProvider","ShareablesUIProvider","ShareablesApp"],"sources":["../../../file-picker/api-client/src/client.ts","../src/screens/ShareablesScreen.tsx"],"sourcesContent":["import type { FetchClientInstance } from \"@fluid-app/api-client-core\";\nimport type { DamAssetCreateResponse } from \"@fluid-app/file-picker-core\";\n\nexport interface DamUploadStrategy {\n uploadFile(params: {\n file: File;\n name: string;\n description?: string;\n tags?: string[];\n onProgress?: (progress: number) => void;\n companyId?: number;\n }): Promise<DamAssetCreateResponse>;\n}\n\nexport interface FilePickerClientConfig {\n fetchClient: FetchClientInstance;\n uploadStrategy?: DamUploadStrategy;\n unsplashAccessKey?: string;\n proxyEndpoint?: string; // defaults to \"/api/proxy-url\"\n}\n\nexport interface FilePickerClient {\n fetchClient: FetchClientInstance;\n uploadStrategy?: DamUploadStrategy;\n unsplashAccessKey?: string;\n proxyEndpoint: string;\n}\n\nexport function createFilePickerClient(\n config: FilePickerClientConfig,\n): FilePickerClient {\n return {\n fetchClient: config.fetchClient,\n uploadStrategy: config.uploadStrategy,\n unsplashAccessKey: config.unsplashAccessKey,\n proxyEndpoint: config.proxyEndpoint ?? \"/api/proxy-url\",\n };\n}\n","import { useCallback, useMemo, type ComponentProps } from \"react\";\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 { createFilePickerClient } from \"@fluid-app/file-picker-api-client\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\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 const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\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 back to the listing for the current screen\n navigate(`share/${screen}`);\n } else {\n // Navigate to the default shareables screen\n navigate(\"share/products\");\n }\n }, [navigate, detailId, screen]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n repContext: true,\n }),\n [domainClient, userData],\n );\n\n const filePickerClient = useMemo(\n () => createFilePickerClient({ fetchClient: domainClient }),\n [domainClient],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n affiliateId:\n (userData as { affiliate_id?: number } | undefined)?.affiliate_id ??\n null,\n basePath: \"\",\n navigate: (path: string) => {\n // Strip leading slash — cards generate paths like \"/share/product/123\"\n const cleanPath = path.replace(/^\\//, \"\");\n // Ensure share/ prefix — screen components pass relative paths like \"media/new\"\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 }) => {\n console.warn(`[Shareables] ${opts.type}: ${opts.title}`);\n },\n filePickerClient,\n onToggleFavorite: async (params: {\n favoriteableId: number;\n favoriteableType: string;\n }) => {\n const affiliateId = (userData as { affiliate_id?: number } | undefined)\n ?.affiliate_id;\n if (!affiliateId) throw new Error(\"No affiliate ID\");\n return domainClient.post<{ is_favorited: boolean }>(\n `/user_companies/${affiliateId}/favorites/toggle.json`,\n {\n favoriteable_id: params.favoriteableId,\n favoriteable_type: params.favoriteableType,\n },\n );\n },\n onDeletePlaylist: async (playlistId: number) => {\n const { playlists: playlistsApi } =\n await import(\"@fluid-app/shareables-api-client\");\n await playlistsApi.deletePlaylist(domainClient, playlistId);\n },\n }),\n [userData, navigate, filePickerClient, domainClient],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ShareablesApp\n screen={screen}\n detailId={detailId}\n action={action}\n companyLogoUrl={userData?.company?.logo_url}\n countryCode={userData?.country?.iso}\n onNavigate={handleNavigate}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\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":";;;;;;;;AA4BA,SAAgB,uBACd,QACkB;AAClB,QAAO;EACL,aAAa,OAAO;EACpB,gBAAgB,OAAO;EACvB,mBAAmB,OAAO;EAC1B,eAAe,OAAO,iBAAiB;EACxC;;;;;;;;;;;;;;;;;;ACCH,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;CAC3C,MAAM,eAAeA,4BAAAA,cAAc;CACnC,MAAM,EAAE,MAAM,aAAaC,yBAAAA,gBAAgB;CAC3C,MAAM,EAAE,aAAa,aAAaC,6BAAAA,kBAAkB;CAEpD,MAAM,EAAE,QAAQ,UAAU,WAAW,qBAAqB,YAAY;CAEtE,MAAM,kBAAA,GAAA,MAAA,cACH,WAAmB,OAAgB;AAElC,WADa,KAAK,SAAS,UAAU,GAAG,OAAO,SAAS,YAC1C;IAEhB,CAAC,SAAS,CACX;CAED,MAAM,cAAA,GAAA,MAAA,mBAA+B;AACnC,MAAI,YAAY,OAEd,UAAS,SAAS,SAAS;MAG3B,UAAS,iBAAiB;IAE3B;EAAC;EAAU;EAAU;EAAO,CAAC;CAEhC,MAAM,cAAA,GAAA,MAAA,gBACG;EACL,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BAAA,KAACC,YAAAA,eAAD;KACU;KACE;KACF;KACR,gBAAgB,UAAU,SAAS;KACnC,aAAa,UAAU,SAAS;KAChC,YAAY;KACZ,QAAQ;KACR,CAAA;IACmB,CAAA;GACA,CAAA;EACrB,CAAA;;AAIV,MAAa,iCAAuD;CAClE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
|
|
1
|
+
{"version":3,"file":"ShareablesScreen-CA8sm7n_.cjs","names":["useSdkClient","useCurrentUser","useAppNavigation","ShareablesCoreProvider","ShareablesUIProvider","ShareablesApp"],"sources":["../../../file-picker/api-client/src/client.ts","../src/screens/ShareablesScreen.tsx"],"sourcesContent":["import type { FetchClientInstance } from \"@fluid-app/api-client-core\";\nimport type { DamAssetCreateResponse } from \"@fluid-app/file-picker-core\";\n\nexport interface DamUploadStrategy {\n uploadFile(params: {\n file: File;\n name: string;\n description?: string;\n tags?: string[];\n onProgress?: (progress: number) => void;\n companyId?: number;\n }): Promise<DamAssetCreateResponse>;\n}\n\nexport interface FilePickerClientConfig {\n fetchClient: FetchClientInstance;\n uploadStrategy?: DamUploadStrategy;\n unsplashAccessKey?: string;\n proxyEndpoint?: string; // defaults to \"/api/proxy-url\"\n}\n\nexport interface FilePickerClient {\n fetchClient: FetchClientInstance;\n uploadStrategy?: DamUploadStrategy;\n unsplashAccessKey?: string;\n proxyEndpoint: string;\n}\n\nexport function createFilePickerClient(\n config: FilePickerClientConfig,\n): FilePickerClient {\n return {\n fetchClient: config.fetchClient,\n uploadStrategy: config.uploadStrategy,\n unsplashAccessKey: config.unsplashAccessKey,\n proxyEndpoint: config.proxyEndpoint ?? \"/api/proxy-url\",\n };\n}\n","import { useCallback, useMemo, type ComponentProps } from \"react\";\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 { createFilePickerClient } from \"@fluid-app/file-picker-api-client\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\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 const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\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 back to the listing for the current screen\n navigate(`share/${screen}`);\n } else {\n // Navigate to the default shareables screen\n navigate(\"share/products\");\n }\n }, [navigate, detailId, screen]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n repContext: true,\n }),\n [domainClient, userData],\n );\n\n const filePickerClient = useMemo(\n () => createFilePickerClient({ fetchClient: domainClient }),\n [domainClient],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n affiliateId:\n (userData as { affiliate_id?: number } | undefined)?.affiliate_id ??\n null,\n basePath: \"\",\n navigate: (path: string) => {\n // Strip leading slash — cards generate paths like \"/share/product/123\"\n const cleanPath = path.replace(/^\\//, \"\");\n // Ensure share/ prefix — screen components pass relative paths like \"media/new\"\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 }) => {\n console.warn(`[Shareables] ${opts.type}: ${opts.title}`);\n },\n filePickerClient,\n onToggleFavorite: async (params: {\n favoriteableId: number;\n favoriteableType: string;\n }) => {\n const affiliateId = (userData as { affiliate_id?: number } | undefined)\n ?.affiliate_id;\n if (!affiliateId) throw new Error(\"No affiliate ID\");\n return domainClient.post<{ is_favorited: boolean }>(\n `/user_companies/${affiliateId}/favorites/toggle.json`,\n {\n favoriteable_id: params.favoriteableId,\n favoriteable_type: params.favoriteableType,\n },\n );\n },\n onDeletePlaylist: async (playlistId: number) => {\n const { playlists: playlistsApi } =\n await import(\"@fluid-app/shareables-api-client\");\n await playlistsApi.deletePlaylist(domainClient, playlistId);\n },\n }),\n [userData, navigate, filePickerClient, domainClient],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ShareablesApp\n screen={screen}\n detailId={detailId}\n action={action}\n companyLogoUrl={userData?.company?.logo_url}\n countryCode={userData?.country?.iso}\n onNavigate={handleNavigate}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\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":";;;;;;;;AA4BA,SAAgB,uBACd,QACkB;AAClB,QAAO;EACL,aAAa,OAAO;EACpB,gBAAgB,OAAO;EACvB,mBAAmB,OAAO;EAC1B,eAAe,OAAO,iBAAiB;EACxC;;;;;;;;;;;;;;;;;;ACCH,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;CAC3C,MAAM,eAAeA,4BAAAA,cAAc;CACnC,MAAM,EAAE,MAAM,aAAaC,yBAAAA,gBAAgB;CAC3C,MAAM,EAAE,aAAa,aAAaC,6BAAAA,kBAAkB;CAEpD,MAAM,EAAE,QAAQ,UAAU,WAAW,qBAAqB,YAAY;CAEtE,MAAM,kBAAA,GAAA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AW;;EAE9D,GACD;EAAC;EAAU;EAAU;EAAkB;EAAa,CACrD;AAED,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,iBAAA,GAAA,kBAAA,KAACC,YAAAA,wBAAD;GAAwB,QAAQ;aAC9B,iBAAA,GAAA,kBAAA,KAACC,YAAAA,sBAAD;IAAsB,QAAQ;cAC5B,iBAAA,GAAA,kBAAA,KAACC,YAAAA,eAAD;KACU;KACE;KACF;KACR,gBAAgB,UAAU,SAAS;KACnC,aAAa,UAAU,SAAS;KAChC,YAAY;KACZ,QAAQ;KACR,CAAA;IACmB,CAAA;GACA,CAAA;EACrB,CAAA;;AAIV,MAAa,iCAAuD;CAClE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as useSdkClient } from "./use-account-clients-G3DvbvPH.mjs";
|
|
2
2
|
import { n as useCurrentUser } from "./use-current-user-DJW-ZwIi.mjs";
|
|
3
3
|
import { n as useAppNavigation } from "./AppNavigationContext-Du3Qq0yc.mjs";
|
|
4
|
-
import { i as ShareablesCoreProvider, n as ShareablesApp, r as ShareablesUIProvider } from "./src-
|
|
4
|
+
import { i as ShareablesCoreProvider, n as ShareablesApp, r as ShareablesUIProvider } from "./src-CvQ9ezCI.mjs";
|
|
5
5
|
import { useCallback, useMemo } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region ../../file-picker/api-client/src/client.ts
|
|
@@ -130,4 +130,4 @@ const shareablesScreenPropertySchema = {
|
|
|
130
130
|
//#endregion
|
|
131
131
|
export { shareablesScreenPropertySchema as n, ShareablesScreen as t };
|
|
132
132
|
|
|
133
|
-
//# sourceMappingURL=ShareablesScreen-
|
|
133
|
+
//# sourceMappingURL=ShareablesScreen-CTruUco1.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareablesScreen-
|
|
1
|
+
{"version":3,"file":"ShareablesScreen-CTruUco1.mjs","names":[],"sources":["../../../file-picker/api-client/src/client.ts","../src/screens/ShareablesScreen.tsx"],"sourcesContent":["import type { FetchClientInstance } from \"@fluid-app/api-client-core\";\nimport type { DamAssetCreateResponse } from \"@fluid-app/file-picker-core\";\n\nexport interface DamUploadStrategy {\n uploadFile(params: {\n file: File;\n name: string;\n description?: string;\n tags?: string[];\n onProgress?: (progress: number) => void;\n companyId?: number;\n }): Promise<DamAssetCreateResponse>;\n}\n\nexport interface FilePickerClientConfig {\n fetchClient: FetchClientInstance;\n uploadStrategy?: DamUploadStrategy;\n unsplashAccessKey?: string;\n proxyEndpoint?: string; // defaults to \"/api/proxy-url\"\n}\n\nexport interface FilePickerClient {\n fetchClient: FetchClientInstance;\n uploadStrategy?: DamUploadStrategy;\n unsplashAccessKey?: string;\n proxyEndpoint: string;\n}\n\nexport function createFilePickerClient(\n config: FilePickerClientConfig,\n): FilePickerClient {\n return {\n fetchClient: config.fetchClient,\n uploadStrategy: config.uploadStrategy,\n unsplashAccessKey: config.unsplashAccessKey,\n proxyEndpoint: config.proxyEndpoint ?? \"/api/proxy-url\",\n };\n}\n","import { useCallback, useMemo, type ComponentProps } from \"react\";\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 { createFilePickerClient } from \"@fluid-app/file-picker-api-client\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\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 const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\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 back to the listing for the current screen\n navigate(`share/${screen}`);\n } else {\n // Navigate to the default shareables screen\n navigate(\"share/products\");\n }\n }, [navigate, detailId, screen]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n repContext: true,\n }),\n [domainClient, userData],\n );\n\n const filePickerClient = useMemo(\n () => createFilePickerClient({ fetchClient: domainClient }),\n [domainClient],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n affiliateId:\n (userData as { affiliate_id?: number } | undefined)?.affiliate_id ??\n null,\n basePath: \"\",\n navigate: (path: string) => {\n // Strip leading slash — cards generate paths like \"/share/product/123\"\n const cleanPath = path.replace(/^\\//, \"\");\n // Ensure share/ prefix — screen components pass relative paths like \"media/new\"\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 }) => {\n console.warn(`[Shareables] ${opts.type}: ${opts.title}`);\n },\n filePickerClient,\n onToggleFavorite: async (params: {\n favoriteableId: number;\n favoriteableType: string;\n }) => {\n const affiliateId = (userData as { affiliate_id?: number } | undefined)\n ?.affiliate_id;\n if (!affiliateId) throw new Error(\"No affiliate ID\");\n return domainClient.post<{ is_favorited: boolean }>(\n `/user_companies/${affiliateId}/favorites/toggle.json`,\n {\n favoriteable_id: params.favoriteableId,\n favoriteable_type: params.favoriteableType,\n },\n );\n },\n onDeletePlaylist: async (playlistId: number) => {\n const { playlists: playlistsApi } =\n await import(\"@fluid-app/shareables-api-client\");\n await playlistsApi.deletePlaylist(domainClient, playlistId);\n },\n }),\n [userData, navigate, filePickerClient, domainClient],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ShareablesApp\n screen={screen}\n detailId={detailId}\n action={action}\n companyLogoUrl={userData?.company?.logo_url}\n countryCode={userData?.country?.iso}\n onNavigate={handleNavigate}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\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":";;;;;;;AA4BA,SAAgB,uBACd,QACkB;AAClB,QAAO;EACL,aAAa,OAAO;EACpB,gBAAgB,OAAO;EACvB,mBAAmB,OAAO;EAC1B,eAAe,OAAO,iBAAiB;EACxC;;;;;;;;;;;;;;;;;;ACCH,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;CAC3C,MAAM,eAAe,cAAc;CACnC,MAAM,EAAE,MAAM,aAAa,gBAAgB;CAC3C,MAAM,EAAE,aAAa,aAAa,kBAAkB;CAEpD,MAAM,EAAE,QAAQ,UAAU,WAAW,qBAAqB,YAAY;CAEtE,MAAM,iBAAiB,aACpB,WAAmB,OAAgB;AAElC,WADa,KAAK,SAAS,UAAU,GAAG,OAAO,SAAS,YAC1C;IAEhB,CAAC,SAAS,CACX;CAED,MAAM,aAAa,kBAAkB;AACnC,MAAI,YAAY,OAEd,UAAS,SAAS,SAAS;MAG3B,UAAS,iBAAiB;IAE3B;EAAC;EAAU;EAAU;EAAO,CAAC;CAEhC,MAAM,aAAa,eACV;EACL,QAAQ;EACR,MAAM,WAAW,EAAE,IAAI,SAAS,IAAI,GAAG;EACvC,YAAY;EACb,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IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
|
|
@@ -32,14 +32,11 @@ import "./SpacerWidget-CX7bjjNF.mjs";
|
|
|
32
32
|
import "./TableWidget-BDUXriyw.mjs";
|
|
33
33
|
import "./ToDoWidget-D52-GT7f.mjs";
|
|
34
34
|
import "./VideoWidget-ZMSFyE1Y.mjs";
|
|
35
|
-
import "./use-account-clients-G3DvbvPH.mjs";
|
|
36
35
|
import "./ScreenHeaderContext-NdrJ58Mg.mjs";
|
|
37
|
-
import "./use-current-user-DJW-ZwIi.mjs";
|
|
38
|
-
import "./AppNavigationContext-Du3Qq0yc.mjs";
|
|
39
36
|
import "./dist-CMGXkSgZ.mjs";
|
|
40
37
|
import "./es-1KItbbYg.mjs";
|
|
41
38
|
import "./dist-Cl4FsM3V.mjs";
|
|
42
|
-
import "./src-
|
|
43
|
-
import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-
|
|
39
|
+
import "./src-CvQ9ezCI.mjs";
|
|
40
|
+
import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-CTruUco1.mjs";
|
|
44
41
|
import "./sortable.esm-CzzU6kIR.mjs";
|
|
45
42
|
export { ShareablesScreen, shareablesScreenPropertySchema };
|
package/dist/index.cjs
CHANGED
|
@@ -50,11 +50,11 @@ const require_ContactsScreen = require("./ContactsScreen-fNFKA1nn.cjs");
|
|
|
50
50
|
require("./src-C_kOrGdZ.cjs");
|
|
51
51
|
require("./dist-B4Ke7bHH.cjs");
|
|
52
52
|
const require_OrdersScreen = require("./OrdersScreen-Bkdrj8I1.cjs");
|
|
53
|
-
require("./src-
|
|
53
|
+
require("./src-B-aQFEbA.cjs");
|
|
54
54
|
const require_ShopScreen = require("./ShopScreen-saEPQJZ-.cjs");
|
|
55
|
-
const require_ShareablesScreen = require("./ShareablesScreen-
|
|
55
|
+
const require_ShareablesScreen = require("./ShareablesScreen-CA8sm7n_.cjs");
|
|
56
56
|
require("./dist-lO2OG0T5.cjs");
|
|
57
|
-
const require_ProductsScreen = require("./ProductsScreen-
|
|
57
|
+
const require_ProductsScreen = require("./ProductsScreen-D1hLP4qn.cjs");
|
|
58
58
|
const require_MySiteScreen = require("./MySiteScreen-Ci2rLGQc.cjs");
|
|
59
59
|
require("./UpgradeScreen-C93rBNY2.cjs");
|
|
60
60
|
require("./AppDownloadScreen-BICgVr39.cjs");
|
|
@@ -2640,8 +2640,8 @@ const MessagingScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => req
|
|
|
2640
2640
|
const ContactsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ContactsScreen-pCkw9htG.cjs")).then((m) => ({ default: m.ContactsScreen })));
|
|
2641
2641
|
const ShopScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ShopScreen-D0xqkK7W.cjs")).then((m) => ({ default: m.ShopScreen })));
|
|
2642
2642
|
const CustomersScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./CustomersScreen-9f10-_AZ.cjs")).then((n) => n.CustomersScreen_exports).then((m) => ({ default: m.CustomersScreen })));
|
|
2643
|
-
const ProductsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ProductsScreen-
|
|
2644
|
-
const ShareablesScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ShareablesScreen-
|
|
2643
|
+
const ProductsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ProductsScreen-DD07WW44.cjs")).then((m) => ({ default: m.ProductsScreen })));
|
|
2644
|
+
const ShareablesScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ShareablesScreen-BKidUZz_.cjs")).then((m) => ({ default: m.ShareablesScreen })));
|
|
2645
2645
|
const MySiteScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./MySiteScreen-BhFE_jmk.cjs")).then((m) => ({ default: m.MySiteScreen })));
|
|
2646
2646
|
const UpgradeScreen = (0, react.lazy)(() => Promise.resolve().then(() => require("./UpgradeScreen-DTNlUcYa.cjs")).then((m) => ({ default: m.UpgradeScreen })));
|
|
2647
2647
|
const AppDownloadScreen = (0, react.lazy)(() => Promise.resolve().then(() => require("./AppDownloadScreen-B2Cfv-uS.cjs")).then((m) => ({ default: m.AppDownloadScreen })));
|
|
@@ -4103,9 +4103,9 @@ const screenPropertySchemas = {
|
|
|
4103
4103
|
OrdersScreen: () => Promise.resolve().then(() => require("./OrdersScreen-GlJc86ai.cjs")).then((m) => m.ordersScreenPropertySchema),
|
|
4104
4104
|
SubscriptionsScreen: () => Promise.resolve().then(() => require("./SubscriptionsScreen-B_RaW9A9.cjs")).then((m) => m.subscriptionsScreenPropertySchema),
|
|
4105
4105
|
CustomersScreen: () => Promise.resolve().then(() => require("./CustomersScreen-9f10-_AZ.cjs")).then((n) => n.CustomersScreen_exports).then((m) => m.customersScreenPropertySchema),
|
|
4106
|
-
ProductsScreen: () => Promise.resolve().then(() => require("./ProductsScreen-
|
|
4106
|
+
ProductsScreen: () => Promise.resolve().then(() => require("./ProductsScreen-DD07WW44.cjs")).then((m) => m.productsScreenPropertySchema),
|
|
4107
4107
|
MySiteScreen: () => Promise.resolve().then(() => require("./MySiteScreen-BhFE_jmk.cjs")).then((m) => m.mySiteScreenPropertySchema),
|
|
4108
|
-
ShareablesScreen: () => Promise.resolve().then(() => require("./ShareablesScreen-
|
|
4108
|
+
ShareablesScreen: () => Promise.resolve().then(() => require("./ShareablesScreen-BKidUZz_.cjs")).then((m) => m.shareablesScreenPropertySchema),
|
|
4109
4109
|
ShopScreen: () => Promise.resolve().then(() => require("./ShopScreen-D0xqkK7W.cjs")).then((m) => m.shopScreenPropertySchema),
|
|
4110
4110
|
UpgradeScreen: () => Promise.resolve().then(() => require("./UpgradeScreen-DTNlUcYa.cjs")).then((m) => m.upgradeScreenPropertySchema),
|
|
4111
4111
|
AppDownloadScreen: () => Promise.resolve().then(() => require("./AppDownloadScreen-B2Cfv-uS.cjs")).then((m) => m.appDownloadScreenPropertySchema)
|
package/dist/index.mjs
CHANGED
|
@@ -48,11 +48,11 @@ import { r as contactsScreenPropertySchema, t as ContactsScreen } from "./Contac
|
|
|
48
48
|
import "./src-BakNjVTk.mjs";
|
|
49
49
|
import "./dist-Cl4FsM3V.mjs";
|
|
50
50
|
import { r as ordersScreenPropertySchema, t as OrdersScreen } from "./OrdersScreen-DOI-Rl_H.mjs";
|
|
51
|
-
import "./src-
|
|
51
|
+
import "./src-CvQ9ezCI.mjs";
|
|
52
52
|
import { r as shopScreenPropertySchema, t as ShopScreen } from "./ShopScreen-BZLvCzbI.mjs";
|
|
53
|
-
import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-
|
|
53
|
+
import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-CTruUco1.mjs";
|
|
54
54
|
import "./sortable.esm-CzzU6kIR.mjs";
|
|
55
|
-
import { n as productsScreenPropertySchema, t as ProductsScreen } from "./ProductsScreen-
|
|
55
|
+
import { n as productsScreenPropertySchema, t as ProductsScreen } from "./ProductsScreen-KLajmCLk.mjs";
|
|
56
56
|
import { r as mySiteScreenPropertySchema, t as MySiteScreen } from "./MySiteScreen-CqeZTwj9.mjs";
|
|
57
57
|
import "./UpgradeScreen-CaTBqSyO.mjs";
|
|
58
58
|
import "./AppDownloadScreen-0bjHFsn8.mjs";
|
|
@@ -2638,8 +2638,8 @@ const MessagingScreen$1 = lazy(() => import("./MessagingScreen-Bp5t4STI.mjs").th
|
|
|
2638
2638
|
const ContactsScreen$1 = lazy(() => import("./ContactsScreen-CzvfANNV.mjs").then((n) => n.n).then((m) => ({ default: m.ContactsScreen })));
|
|
2639
2639
|
const ShopScreen$1 = lazy(() => import("./ShopScreen-BZLvCzbI.mjs").then((n) => n.n).then((m) => ({ default: m.ShopScreen })));
|
|
2640
2640
|
const CustomersScreen$1 = lazy(() => import("./CustomersScreen-xAauAB-B.mjs").then((n) => n.n).then((m) => ({ default: m.CustomersScreen })));
|
|
2641
|
-
const ProductsScreen$1 = lazy(() => import("./ProductsScreen-
|
|
2642
|
-
const ShareablesScreen$1 = lazy(() => import("./ShareablesScreen-
|
|
2641
|
+
const ProductsScreen$1 = lazy(() => import("./ProductsScreen-SExV06P8.mjs").then((m) => ({ default: m.ProductsScreen })));
|
|
2642
|
+
const ShareablesScreen$1 = lazy(() => import("./ShareablesScreen-C_aJXryA.mjs").then((m) => ({ default: m.ShareablesScreen })));
|
|
2643
2643
|
const MySiteScreen$1 = lazy(() => import("./MySiteScreen-CqeZTwj9.mjs").then((n) => n.n).then((m) => ({ default: m.MySiteScreen })));
|
|
2644
2644
|
const UpgradeScreen = lazy(() => import("./UpgradeScreen-CaTBqSyO.mjs").then((n) => n.t).then((m) => ({ default: m.UpgradeScreen })));
|
|
2645
2645
|
const AppDownloadScreen = lazy(() => import("./AppDownloadScreen-0bjHFsn8.mjs").then((n) => n.t).then((m) => ({ default: m.AppDownloadScreen })));
|
|
@@ -4101,9 +4101,9 @@ const screenPropertySchemas = {
|
|
|
4101
4101
|
OrdersScreen: () => import("./OrdersScreen-DOI-Rl_H.mjs").then((n) => n.n).then((m) => m.ordersScreenPropertySchema),
|
|
4102
4102
|
SubscriptionsScreen: () => import("./SubscriptionsScreen-C2n-qh9n.mjs").then((n) => n.n).then((m) => m.subscriptionsScreenPropertySchema),
|
|
4103
4103
|
CustomersScreen: () => import("./CustomersScreen-xAauAB-B.mjs").then((n) => n.n).then((m) => m.customersScreenPropertySchema),
|
|
4104
|
-
ProductsScreen: () => import("./ProductsScreen-
|
|
4104
|
+
ProductsScreen: () => import("./ProductsScreen-SExV06P8.mjs").then((m) => m.productsScreenPropertySchema),
|
|
4105
4105
|
MySiteScreen: () => import("./MySiteScreen-CqeZTwj9.mjs").then((n) => n.n).then((m) => m.mySiteScreenPropertySchema),
|
|
4106
|
-
ShareablesScreen: () => import("./ShareablesScreen-
|
|
4106
|
+
ShareablesScreen: () => import("./ShareablesScreen-C_aJXryA.mjs").then((m) => m.shareablesScreenPropertySchema),
|
|
4107
4107
|
ShopScreen: () => import("./ShopScreen-BZLvCzbI.mjs").then((n) => n.n).then((m) => m.shopScreenPropertySchema),
|
|
4108
4108
|
UpgradeScreen: () => import("./UpgradeScreen-CaTBqSyO.mjs").then((n) => n.t).then((m) => m.upgradeScreenPropertySchema),
|
|
4109
4109
|
AppDownloadScreen: () => import("./AppDownloadScreen-0bjHFsn8.mjs").then((n) => n.t).then((m) => m.appDownloadScreenPropertySchema)
|
|
@@ -1011,7 +1011,15 @@ const AnalyticsPlaceholder = react.default.memo(function AnalyticsPlaceholder()
|
|
|
1011
1011
|
})
|
|
1012
1012
|
});
|
|
1013
1013
|
});
|
|
1014
|
-
const
|
|
1014
|
+
const RELATEABLE_TYPE_LABELS = {
|
|
1015
|
+
Product: "product",
|
|
1016
|
+
Medium: "media",
|
|
1017
|
+
EnrollmentPack: "enrollment pack",
|
|
1018
|
+
MySite: "site",
|
|
1019
|
+
Library: "library"
|
|
1020
|
+
};
|
|
1021
|
+
const NoAssetsState = react.default.memo(function NoAssetsState({ relateable_type }) {
|
|
1022
|
+
const label = RELATEABLE_TYPE_LABELS[relateable_type] ?? "item";
|
|
1015
1023
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1016
1024
|
className: "flex flex-1 items-center justify-center px-6",
|
|
1017
1025
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -1025,9 +1033,13 @@ const NoAssetsState = react.default.memo(function NoAssetsState() {
|
|
|
1025
1033
|
className: "mb-1 text-sm text-gray-500",
|
|
1026
1034
|
children: "No Marketing Assets"
|
|
1027
1035
|
}),
|
|
1028
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
1036
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1029
1037
|
className: "text-xs text-gray-400",
|
|
1030
|
-
children:
|
|
1038
|
+
children: [
|
|
1039
|
+
"This ",
|
|
1040
|
+
label,
|
|
1041
|
+
" does not have any associated media"
|
|
1042
|
+
]
|
|
1031
1043
|
})
|
|
1032
1044
|
]
|
|
1033
1045
|
})
|
|
@@ -1038,7 +1050,7 @@ function MarketingAssetsGrid({ isLoading, error, activeTab, onTabChange, mediaIt
|
|
|
1038
1050
|
onMediaItemClick(mediaItem);
|
|
1039
1051
|
}, [onMediaItemClick]);
|
|
1040
1052
|
const renderContent = () => {
|
|
1041
|
-
if (showEmptyState) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoAssetsState, {});
|
|
1053
|
+
if (showEmptyState) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoAssetsState, { relateable_type });
|
|
1042
1054
|
if (activeMainTab === "Analytics" && relateable_type === "Medium") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnalyticsPlaceholder, {});
|
|
1043
1055
|
if (activeMainTab === "Related Sharables") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1044
1056
|
className: "mb-4 px-4 pt-4",
|
|
@@ -9015,4 +9027,4 @@ Object.defineProperty(exports, "ShareablesUIProvider", {
|
|
|
9015
9027
|
}
|
|
9016
9028
|
});
|
|
9017
9029
|
|
|
9018
|
-
//# sourceMappingURL=src-
|
|
9030
|
+
//# sourceMappingURL=src-B-aQFEbA.cjs.map
|