@fluid-app/portal-sdk 0.1.76 → 0.1.77
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/{MessagingScreen-Bp5t4STI.mjs → MessagingScreen-L76XP3Oz.mjs} +1 -0
- package/dist/{ProductsScreen-SExV06P8.mjs → ProductsScreen-BQlgLkmn.mjs} +6 -2
- package/dist/{ProductsScreen-KLajmCLk.mjs → ProductsScreen-CGe2U2jo.mjs} +2 -2
- package/dist/{ProductsScreen-KLajmCLk.mjs.map → ProductsScreen-CGe2U2jo.mjs.map} +1 -1
- package/dist/{ProductsScreen-D1hLP4qn.cjs → ProductsScreen-DzJlDMus.cjs} +2 -2
- package/dist/{ProductsScreen-D1hLP4qn.cjs.map → ProductsScreen-DzJlDMus.cjs.map} +1 -1
- package/dist/{ProductsScreen-DD07WW44.cjs → ProductsScreen-a7n9oVPF.cjs} +2 -2
- package/dist/{ShareablesScreen-C_aJXryA.mjs → ShareablesScreen-B67BMAUa.mjs} +6 -2
- package/dist/{ShareablesScreen-CA8sm7n_.cjs → ShareablesScreen-BSy0IA8v.cjs} +2 -2
- package/dist/{ShareablesScreen-CA8sm7n_.cjs.map → ShareablesScreen-BSy0IA8v.cjs.map} +1 -1
- package/dist/{ShareablesScreen-BKidUZz_.cjs → ShareablesScreen-BnAtijbM.cjs} +2 -2
- package/dist/{ShareablesScreen-CTruUco1.mjs → ShareablesScreen-CRtMGs-h.mjs} +2 -2
- package/dist/{ShareablesScreen-CTruUco1.mjs.map → ShareablesScreen-CRtMGs-h.mjs.map} +1 -1
- package/dist/{ShopScreen-D0xqkK7W.cjs → ShopScreen-5t5Jqdw5.cjs} +1 -1
- package/dist/{ShopScreen-BZLvCzbI.mjs → ShopScreen-BpQQ00y7.mjs} +3 -3
- package/dist/{ShopScreen-BZLvCzbI.mjs.map → ShopScreen-BpQQ00y7.mjs.map} +1 -1
- package/dist/{ShopScreen-saEPQJZ-.cjs → ShopScreen-OfnN0oCo.cjs} +5 -5
- package/dist/{ShopScreen-saEPQJZ-.cjs.map → ShopScreen-OfnN0oCo.cjs.map} +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.mjs +12 -12
- package/dist/{src-B-aQFEbA.cjs → src-fXyI4AWk.cjs} +36 -35
- package/dist/src-fXyI4AWk.cjs.map +1 -0
- package/dist/{src-CvQ9ezCI.mjs → src-nhqydD53.mjs} +36 -35
- package/dist/src-nhqydD53.mjs.map +1 -0
- package/package.json +20 -16
- package/dist/src-B-aQFEbA.cjs.map +0 -1
- package/dist/src-CvQ9ezCI.mjs.map +0 -1
|
@@ -33,6 +33,7 @@ import "./SpacerWidget-CX7bjjNF.mjs";
|
|
|
33
33
|
import "./TableWidget-BDUXriyw.mjs";
|
|
34
34
|
import "./ToDoWidget-D52-GT7f.mjs";
|
|
35
35
|
import "./VideoWidget-ZMSFyE1Y.mjs";
|
|
36
|
+
import "./use-fluid-api-YzLdiq5t.mjs";
|
|
36
37
|
import "./dist-CMGXkSgZ.mjs";
|
|
37
38
|
import "./es-1KItbbYg.mjs";
|
|
38
39
|
export { MessagingScreen, messagingScreenPropertySchema };
|
|
@@ -32,11 +32,15 @@ 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";
|
|
35
36
|
import "./ScreenHeaderContext-NdrJ58Mg.mjs";
|
|
37
|
+
import "./use-fluid-api-YzLdiq5t.mjs";
|
|
38
|
+
import "./use-current-user-DJW-ZwIi.mjs";
|
|
39
|
+
import "./AppNavigationContext-Du3Qq0yc.mjs";
|
|
36
40
|
import "./dist-CMGXkSgZ.mjs";
|
|
37
41
|
import "./es-1KItbbYg.mjs";
|
|
38
42
|
import "./dist-Cl4FsM3V.mjs";
|
|
39
|
-
import "./src-
|
|
43
|
+
import "./src-nhqydD53.mjs";
|
|
40
44
|
import "./sortable.esm-CzzU6kIR.mjs";
|
|
41
|
-
import { n as productsScreenPropertySchema, t as ProductsScreen } from "./ProductsScreen-
|
|
45
|
+
import { n as productsScreenPropertySchema, t as ProductsScreen } from "./ProductsScreen-CGe2U2jo.mjs";
|
|
42
46
|
export { 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-nhqydD53.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-CGe2U2jo.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductsScreen-
|
|
1
|
+
{"version":3,"file":"ProductsScreen-CGe2U2jo.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"}
|
|
@@ -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-fXyI4AWk.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-DzJlDMus.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductsScreen-
|
|
1
|
+
{"version":3,"file":"ProductsScreen-DzJlDMus.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":";;;;;;;;AAsBA,SAAgB,eAAe,EAE7B,YACA,WACA,aACA,SACA,cAEA,GAAG,YACsC;CACzC,MAAM,eAAeA,4BAAAA,cAAc;CACnC,MAAM,EAAE,MAAM,aAAaC,yBAAAA,gBAAgB;CAC3C,MAAM,EAAE,aAAa,aAAaC,6BAAAA,kBAAkB;CAGpD,MAAM,aAAA,GAAA,MAAA,eAA0B;AAE9B,SADc,YAAY,MAAM,kBAAkB,GACnC,MAAM;IACpB,CAAC,YAAY,CAAC;CAEjB,MAAM,uBAAA,GAAA,MAAA,cACH,OAAe;AACd,WAAS,YAAY,KAAK;IAE5B,CAAC,SAAS,CACX;CAED,MAAM,cAAA,GAAA,MAAA,mBAA+B;AACnC,WAAS,WAAW;IACnB,CAAC,SAAS,CAAC;CAEd,MAAM,cAAA,GAAA,MAAA,gBACG;EACL,QAAQ;EACR,MAAM,WAAW,EAAE,IAAI,SAAS,IAAI,GAAG;EACxC,GACD,CAAC,cAAc,SAAS,CACzB;CAED,MAAM,YAAA,GAAA,MAAA,gBACG;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,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,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"}
|
|
@@ -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-fXyI4AWk.cjs");
|
|
41
41
|
require("./dist-lO2OG0T5.cjs");
|
|
42
|
-
const require_ProductsScreen = require("./ProductsScreen-
|
|
42
|
+
const require_ProductsScreen = require("./ProductsScreen-DzJlDMus.cjs");
|
|
43
43
|
exports.ProductsScreen = require_ProductsScreen.ProductsScreen;
|
|
44
44
|
exports.productsScreenPropertySchema = require_ProductsScreen.productsScreenPropertySchema;
|
|
@@ -32,11 +32,15 @@ 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";
|
|
35
36
|
import "./ScreenHeaderContext-NdrJ58Mg.mjs";
|
|
37
|
+
import "./use-fluid-api-YzLdiq5t.mjs";
|
|
38
|
+
import "./use-current-user-DJW-ZwIi.mjs";
|
|
39
|
+
import "./AppNavigationContext-Du3Qq0yc.mjs";
|
|
36
40
|
import "./dist-CMGXkSgZ.mjs";
|
|
37
41
|
import "./es-1KItbbYg.mjs";
|
|
38
42
|
import "./dist-Cl4FsM3V.mjs";
|
|
39
|
-
import "./src-
|
|
40
|
-
import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-
|
|
43
|
+
import "./src-nhqydD53.mjs";
|
|
44
|
+
import { n as shareablesScreenPropertySchema, t as ShareablesScreen } from "./ShareablesScreen-CRtMGs-h.mjs";
|
|
41
45
|
import "./sortable.esm-CzzU6kIR.mjs";
|
|
42
46
|
export { 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-fXyI4AWk.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-BSy0IA8v.cjs.map
|
|
@@ -1 +1 @@
|
|
|
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\",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Aa,iCAAuD;CAClE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
|
|
1
|
+
{"version":3,"file":"ShareablesScreen-BSy0IA8v.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,UAA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C,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"}
|
|
@@ -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-fXyI4AWk.cjs");
|
|
41
|
+
const require_ShareablesScreen = require("./ShareablesScreen-BSy0IA8v.cjs");
|
|
42
42
|
require("./dist-lO2OG0T5.cjs");
|
|
43
43
|
exports.ShareablesScreen = require_ShareablesScreen.ShareablesScreen;
|
|
44
44
|
exports.shareablesScreenPropertySchema = require_ShareablesScreen.shareablesScreenPropertySchema;
|
|
@@ -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-nhqydD53.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-CRtMGs-h.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareablesScreen-
|
|
1
|
+
{"version":3,"file":"ShareablesScreen-CRtMGs-h.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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AS,aAAa;YAC5D,oBAAC,wBAAD;GAAwB,QAAQ;aAC9B,oBAAC,sBAAD;IAAsB,QAAQ;cAC5B,oBAAC,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"}
|
|
@@ -34,6 +34,6 @@ require("./TableWidget-CYhIcl2j.cjs");
|
|
|
34
34
|
require("./ToDoWidget-eGB9cfou.cjs");
|
|
35
35
|
require("./VideoWidget-C22_tAkf.cjs");
|
|
36
36
|
require("./ScreenHeaderContext-wrJlkhgN.cjs");
|
|
37
|
-
const require_ShopScreen = require("./ShopScreen-
|
|
37
|
+
const require_ShopScreen = require("./ShopScreen-OfnN0oCo.cjs");
|
|
38
38
|
exports.ShopScreen = require_ShopScreen.ShopScreen;
|
|
39
39
|
exports.shopScreenPropertySchema = require_ShopScreen.shopScreenPropertySchema;
|
|
@@ -11,8 +11,8 @@ import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
|
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { ArrowLeft, ChevronLeft, ChevronRight, CirclePlay, Search, ShoppingCart } from "lucide-react";
|
|
13
13
|
import { createPortal } from "react-dom";
|
|
14
|
-
import { create } from "
|
|
15
|
-
import "
|
|
14
|
+
import { create } from "zustand";
|
|
15
|
+
import "zustand/middleware";
|
|
16
16
|
//#region ../../products/api-client/src/utils/product-price.ts
|
|
17
17
|
function stripParentheticalText(text) {
|
|
18
18
|
if (!text) return null;
|
|
@@ -1760,4 +1760,4 @@ const shopScreenPropertySchema = {
|
|
|
1760
1760
|
//#endregion
|
|
1761
1761
|
export { ShopScreen_exports as n, shopScreenPropertySchema as r, ShopScreen as t };
|
|
1762
1762
|
|
|
1763
|
-
//# sourceMappingURL=ShopScreen-
|
|
1763
|
+
//# sourceMappingURL=ShopScreen-BpQQ00y7.mjs.map
|