@fluid-app/portal-sdk 0.1.300 → 0.1.302
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/{AlertWidget-BilCRyau.mjs → AlertWidget-mF7t6q9V.mjs} +3 -3
- package/dist/{AlertWidget-BilCRyau.mjs.map → AlertWidget-mF7t6q9V.mjs.map} +1 -1
- package/dist/{AppDownloadScreen-DtU2S2qh.mjs → AppDownloadScreen-9zlj742F.mjs} +2 -2
- package/dist/{AppDownloadScreen-DtU2S2qh.mjs.map → AppDownloadScreen-9zlj742F.mjs.map} +1 -1
- package/dist/{BulletListWidget-CFPYT5ut.mjs → BulletListWidget-BA7nyDC4.mjs} +2 -2
- package/dist/{BulletListWidget-CFPYT5ut.mjs.map → BulletListWidget-BA7nyDC4.mjs.map} +1 -1
- package/dist/{CalendarWidget-BQP9CfCI.mjs → CalendarWidget-CHpM_XnL.mjs} +2 -2
- package/dist/{CalendarWidget-BQP9CfCI.mjs.map → CalendarWidget-CHpM_XnL.mjs.map} +1 -1
- package/dist/{CardWidget-DfY3Lrm_.mjs → CardWidget-BQdWR7m3.mjs} +2 -2
- package/dist/{CardWidget-DfY3Lrm_.mjs.map → CardWidget-BQdWR7m3.mjs.map} +1 -1
- package/dist/{CarouselWidget-BOWNV3rj.mjs → CarouselWidget-BLQcyVWj.mjs} +2 -2
- package/dist/{CarouselWidget-BOWNV3rj.mjs.map → CarouselWidget-BLQcyVWj.mjs.map} +1 -1
- package/dist/{CatchUpWidget-BtEH9EHQ.mjs → CatchUpWidget-sy6oJqiu.mjs} +2 -2
- package/dist/{CatchUpWidget-BtEH9EHQ.mjs.map → CatchUpWidget-sy6oJqiu.mjs.map} +1 -1
- package/dist/{ChartWidget-rCUOwT7v.mjs → ChartWidget-DE0JNmKi.mjs} +2 -2
- package/dist/{ChartWidget-rCUOwT7v.mjs.map → ChartWidget-DE0JNmKi.mjs.map} +1 -1
- package/dist/{ContactsScreen-Cj2okxTE.mjs → ContactsScreen-suw0tqGW.mjs} +2 -2
- package/dist/{ContactsScreen-Cj2okxTE.mjs.map → ContactsScreen-suw0tqGW.mjs.map} +1 -1
- package/dist/{ContainerWidget-DBRBSg15.mjs → ContainerWidget-CjZOp201.mjs} +3 -3
- package/dist/{ContainerWidget-DBRBSg15.mjs.map → ContainerWidget-CjZOp201.mjs.map} +1 -1
- package/dist/{CustomersScreen-DsRK0m2L.mjs → CustomersScreen-DdSXRmyl.mjs} +2 -2
- package/dist/{CustomersScreen-DsRK0m2L.mjs.map → CustomersScreen-DdSXRmyl.mjs.map} +1 -1
- package/dist/{EmbedWidget-BO6P4QHc.mjs → EmbedWidget-ok8UkJdY.mjs} +2 -2
- package/dist/{EmbedWidget-BO6P4QHc.mjs.map → EmbedWidget-ok8UkJdY.mjs.map} +1 -1
- package/dist/{FluidProvider-CBuTpv9I.cjs → FluidProvider-BAg3B4eD.cjs} +2 -2
- package/dist/{FluidProvider-CBuTpv9I.cjs.map → FluidProvider-BAg3B4eD.cjs.map} +1 -1
- package/dist/{FluidProvider-BBxURUBq.mjs → FluidProvider-C00Px_ej.mjs} +52 -52
- package/dist/{FluidProvider-BBxURUBq.mjs.map → FluidProvider-C00Px_ej.mjs.map} +1 -1
- package/dist/{ImageWidget-DGABEW2_.mjs → ImageWidget-j9pAlihf.mjs} +2 -2
- package/dist/{ImageWidget-DGABEW2_.mjs.map → ImageWidget-j9pAlihf.mjs.map} +1 -1
- package/dist/{LayoutWidget-DYekGAi3.mjs → LayoutWidget-Bvc_oJT-.mjs} +2 -2
- package/dist/{LayoutWidget-DYekGAi3.mjs.map → LayoutWidget-Bvc_oJT-.mjs.map} +1 -1
- package/dist/{LinkWidget-DtuO2cmy.mjs → LinkWidget-CBJjxBOU.mjs} +2 -2
- package/dist/{LinkWidget-DtuO2cmy.mjs.map → LinkWidget-CBJjxBOU.mjs.map} +1 -1
- package/dist/{ListWidget-DRN6ZCp1.mjs → ListWidget-Dw2qxriL.mjs} +2 -2
- package/dist/{ListWidget-DRN6ZCp1.mjs.map → ListWidget-Dw2qxriL.mjs.map} +1 -1
- package/dist/{MessagingScreen-CwzSY_G8.mjs → MessagingScreen-0iAzXjtW.mjs} +4 -4
- package/dist/{MessagingScreen-CwzSY_G8.mjs.map → MessagingScreen-0iAzXjtW.mjs.map} +1 -1
- package/dist/{MessagingScreen-2M2ETWXp.cjs → MessagingScreen-CJ0Rj-M7.cjs} +2 -2
- package/dist/{MessagingScreen-2M2ETWXp.cjs.map → MessagingScreen-CJ0Rj-M7.cjs.map} +1 -1
- package/dist/{MessagingScreen-BI4AufwC.cjs → MessagingScreen-D_feiKUj.cjs} +2 -2
- package/dist/MessagingScreen-aMC3a8cQ.mjs +47 -0
- package/dist/{MySiteScreen-Bx81S9gD.mjs → MySiteScreen-C37AawN3.mjs} +2 -2
- package/dist/{MySiteScreen-Bx81S9gD.mjs.map → MySiteScreen-C37AawN3.mjs.map} +1 -1
- package/dist/{MySiteWidget-D8UtttYC.mjs → MySiteWidget-C37LOc4h.mjs} +2 -2
- package/dist/{MySiteWidget-D8UtttYC.mjs.map → MySiteWidget-C37LOc4h.mjs.map} +1 -1
- package/dist/{NestedWidget-BeOYIuWY.mjs → NestedWidget-DYCR6oXP.mjs} +2 -2
- package/dist/{NestedWidget-BeOYIuWY.mjs.map → NestedWidget-DYCR6oXP.mjs.map} +1 -1
- package/dist/OrdersScreen-B-uk9a0i.mjs +45 -0
- package/dist/{OrdersScreen-sLr0z213.cjs → OrdersScreen-ChbkUQG1.cjs} +2 -2
- package/dist/{OrdersScreen-CFfrQG4i.mjs → OrdersScreen-D1AAopLt.mjs} +40 -40
- package/dist/OrdersScreen-D1AAopLt.mjs.map +1 -0
- package/dist/{OrdersScreen-CS1xA9q5.cjs → OrdersScreen-DrrOttdy.cjs} +40 -40
- package/dist/OrdersScreen-DrrOttdy.cjs.map +1 -0
- package/dist/{PointsWidget-4tTrD6UA.mjs → PointsWidget-D0TPHzoh.mjs} +2 -2
- package/dist/{PointsWidget-4tTrD6UA.mjs.map → PointsWidget-D0TPHzoh.mjs.map} +1 -1
- package/dist/{ProfileScreen-CefqZr-Q.mjs → ProfileScreen-8hi-vFLY.mjs} +70 -70
- package/dist/ProfileScreen-8hi-vFLY.mjs.map +1 -0
- package/dist/{ProfileScreen-BCR3FU5g.cjs → ProfileScreen-BD51dMvj.cjs} +70 -70
- package/dist/ProfileScreen-BD51dMvj.cjs.map +1 -0
- package/dist/{ProfileScreen-CwP66ls2.cjs → ProfileScreen-CHYWGYjZ.cjs} +2 -2
- package/dist/ProfileScreen-HckHOA3z.mjs +47 -0
- package/dist/{QuickLinksWidget-IlrkEORt.mjs → QuickLinksWidget-CQ5u9y6u.mjs} +2 -2
- package/dist/{QuickLinksWidget-IlrkEORt.mjs.map → QuickLinksWidget-CQ5u9y6u.mjs.map} +1 -1
- package/dist/{QuickShareWidget-Bzvh9Yvj.mjs → QuickShareWidget-BIYP_Vju.mjs} +2 -2
- package/dist/{QuickShareWidget-Bzvh9Yvj.mjs.map → QuickShareWidget-BIYP_Vju.mjs.map} +1 -1
- package/dist/{RecentActivityWidget-C9fWPsVD.mjs → RecentActivityWidget-4hDg_4vP.mjs} +2 -2
- package/dist/{RecentActivityWidget-C9fWPsVD.mjs.map → RecentActivityWidget-4hDg_4vP.mjs.map} +1 -1
- package/dist/{SeparatorWidget-CTke2MBj.mjs → SeparatorWidget-N1L4KRZJ.mjs} +2 -2
- package/dist/{SeparatorWidget-CTke2MBj.mjs.map → SeparatorWidget-N1L4KRZJ.mjs.map} +1 -1
- package/dist/{ShareablesScreen-WUM3kwwU.cjs → ShareablesScreen-BmMtSpT8.cjs} +37 -26
- package/dist/ShareablesScreen-BmMtSpT8.cjs.map +1 -0
- package/dist/{ShareablesScreen-DE2k5f6X.mjs → ShareablesScreen-Bx4dJ3uu.mjs} +38 -27
- package/dist/ShareablesScreen-Bx4dJ3uu.mjs.map +1 -0
- package/dist/{ShareablesScreen-Cg10X417.mjs → ShareablesScreen-C2Sj5Jvp.mjs} +2 -2
- package/dist/{ShareablesScreen-BevKtLpN.cjs → ShareablesScreen-D6MjCFu_.cjs} +1 -1
- package/dist/ShopScreen-CIHEblgo.mjs +46 -0
- package/dist/{ShopScreen-CZdXE7dM.cjs → ShopScreen-CnfBzMUM.cjs} +2 -2
- package/dist/{ShopScreen-CZdXE7dM.cjs.map → ShopScreen-CnfBzMUM.cjs.map} +1 -1
- package/dist/{ShopScreen-DdAmK5yn.mjs → ShopScreen-F8cg64iD.mjs} +2 -2
- package/dist/{ShopScreen-DdAmK5yn.mjs.map → ShopScreen-F8cg64iD.mjs.map} +1 -1
- package/dist/{ShopScreen-xfPTLG5b.cjs → ShopScreen-VkI0tl3J.cjs} +2 -2
- package/dist/{SpacerWidget-D3yx57vH.mjs → SpacerWidget-C-Kpjntb.mjs} +2 -2
- package/dist/{SpacerWidget-D3yx57vH.mjs.map → SpacerWidget-C-Kpjntb.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-DKihggHx.cjs → SubscriptionsScreen-6Xp62ubF.cjs} +1 -1
- package/dist/{SubscriptionsScreen-Cjd2aGeW.mjs → SubscriptionsScreen-CaDhBQSX.mjs} +48 -48
- package/dist/{SubscriptionsScreen-Cjd2aGeW.mjs.map → SubscriptionsScreen-CaDhBQSX.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-DLLDU_aU.cjs → SubscriptionsScreen-YL-1_nFd.cjs} +47 -47
- package/dist/{SubscriptionsScreen-DLLDU_aU.cjs.map → SubscriptionsScreen-YL-1_nFd.cjs.map} +1 -1
- package/dist/{TableWidget-DCZDRb0V.mjs → TableWidget-CSB_j9wx.mjs} +2 -2
- package/dist/{TableWidget-DCZDRb0V.mjs.map → TableWidget-CSB_j9wx.mjs.map} +1 -1
- package/dist/{TextWidget-CmuHRU-g.mjs → TextWidget-CPucLu4s.mjs} +2 -2
- package/dist/{TextWidget-CmuHRU-g.mjs.map → TextWidget-CPucLu4s.mjs.map} +1 -1
- package/dist/{ToDoWidget-CXhlO0BY.mjs → ToDoWidget-Czmpoimp.mjs} +2 -2
- package/dist/{ToDoWidget-CXhlO0BY.mjs.map → ToDoWidget-Czmpoimp.mjs.map} +1 -1
- package/dist/{UpgradeScreen-DZ6uZpeX.mjs → UpgradeScreen-u3UxUd3B.mjs} +2 -2
- package/dist/{UpgradeScreen-DZ6uZpeX.mjs.map → UpgradeScreen-u3UxUd3B.mjs.map} +1 -1
- package/dist/{VideoWidget-DlnwYXlo.mjs → VideoWidget-DNhWLnbP.mjs} +2 -2
- package/dist/{VideoWidget-DlnwYXlo.mjs.map → VideoWidget-DNhWLnbP.mjs.map} +1 -1
- package/dist/{es-XDcP51O8.mjs → es-i72IyPYD.mjs} +2 -2
- package/dist/{es-XDcP51O8.mjs.map → es-i72IyPYD.mjs.map} +1 -1
- package/dist/index.cjs +19 -19
- package/dist/index.mjs +60 -60
- package/dist/{portal_tenant_content-C1R1xxDP.cjs → portal_tenant_content-BnrwKhyK.cjs} +9 -7
- package/dist/portal_tenant_content-BnrwKhyK.cjs.map +1 -0
- package/dist/{portal_tenant_content-DPLnrtOG.mjs → portal_tenant_content-CcKZMB9E.mjs} +9 -7
- package/dist/portal_tenant_content-CcKZMB9E.mjs.map +1 -0
- package/package.json +19 -19
- package/styles/globals.css +0 -222
- package/dist/MessagingScreen-B4vUvkRg.mjs +0 -47
- package/dist/OrdersScreen-CFfrQG4i.mjs.map +0 -1
- package/dist/OrdersScreen-CS1xA9q5.cjs.map +0 -1
- package/dist/OrdersScreen-DoopejMR.mjs +0 -45
- package/dist/ProfileScreen-BCR3FU5g.cjs.map +0 -1
- package/dist/ProfileScreen-CefqZr-Q.mjs.map +0 -1
- package/dist/ProfileScreen-wj0KTaQF.mjs +0 -47
- package/dist/ShareablesScreen-DE2k5f6X.mjs.map +0 -1
- package/dist/ShareablesScreen-WUM3kwwU.cjs.map +0 -1
- package/dist/ShopScreen-BKMR1rdM.mjs +0 -46
- package/dist/portal_tenant_content-C1R1xxDP.cjs.map +0 -1
- package/dist/portal_tenant_content-DPLnrtOG.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointsWidget-4tTrD6UA.mjs","names":[],"sources":["../../widgets/src/hooks/use-points-ledger.preview.ts","../../widgets/src/hooks/use-points-ledger.ts","../../widgets/src/widgets/PointsWidget.tsx"],"sourcesContent":["import type { PointsData } from \"@fluid-app/portal-core/widgets-api-types\";\n\nconst now = new Date();\n\nfunction daysAgo(days: number): string {\n return new Date(now.getTime() - days * 86_400_000).toISOString();\n}\n\nexport const PREVIEW_DATA: PointsData = {\n balance: 25,\n entries: [\n {\n id: 1,\n description: \"Purchase March 3rd\",\n amount: 20,\n createdAt: daysAgo(3),\n },\n {\n id: 2,\n description: \"Referral Bonus\",\n amount: 50,\n createdAt: daysAgo(14),\n },\n {\n id: 3,\n description: \"Points Redemption\",\n amount: -75,\n createdAt: daysAgo(60),\n },\n {\n id: 4,\n description: \"Welcome Reward\",\n amount: 30,\n createdAt: daysAgo(90),\n },\n ],\n};\n","import { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useWidgetsApi } from \"@fluid-app/portal-core/widgets-api-context\";\nimport { useWidgetPreviewContext } from \"@fluid-app/portal-react/data-sources/preview-context\";\nimport { useDataSourceRegistryConfig } from \"@fluid-app/portal-react/data-sources/registry-context\";\nimport { PREVIEW_DATA } from \"./use-points-ledger.preview\";\nimport type { PointsData } from \"@fluid-app/portal-core/widgets-api-types\";\n\nexport type {\n PointsData,\n PointsEntry,\n} from \"@fluid-app/portal-core/widgets-api-types\";\n\nexport const POINTS_LEDGER_QUERY_KEY = \"points-ledger\" as const;\n\nexport function usePointsLedger(): UseQueryResult<PointsData, Error> {\n const widgetsApi = useWidgetsApi();\n const { isPreview } = useWidgetPreviewContext();\n const registryConfig = useDataSourceRegistryConfig();\n const { baseUrl } = registryConfig;\n const customerId = registryConfig.variables?.customer_id;\n\n // Contract: the BFF adapter (portal app, composite factory spreads BFF over\n // legacy) ignores customerId and infers the customer from the JWT, so the\n // portal renders this widget with no registry-variable plumbing. The legacy\n // adapter (fluid-admin) builds /v202506/customers/{customerId}/points_ledgers\n // and MUST receive a real id; that consumer always supplies one via registry\n // variables, so empty string never reaches the legacy URL in practice. If a\n // future caller wires this hook to a legacy-only adapter, configure\n // registry variables.customer_id at the provider — otherwise the request\n // would 404 on /customers//points_ledgers.\n return useQuery({\n queryKey: [\n \"portal-widget-use\",\n POINTS_LEDGER_QUERY_KEY,\n isPreview ? \"preview\" : baseUrl,\n customerId ?? null,\n ] as const,\n queryFn: ({ signal }) =>\n widgetsApi.fetchPointsLedger(customerId ?? \"\", signal),\n enabled: !isPreview,\n ...(isPreview && { placeholderData: PREVIEW_DATA }),\n });\n}\n","import { useId, useState, type ComponentProps } from \"react\";\nimport type React from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n BorderWidthOptions,\n ColorOptions,\n FontSizeOptions,\n PaddingOptions,\n} from \"@fluid-app/portal-core/types\";\nimport type { WidgetPropertySchema } from \"@fluid-app/portal-core/registries\";\nimport {\n getBorderRadiusField,\n getBorderWidthField,\n getBorderColorField,\n getColorField,\n getFontSizeField,\n getPaddingField,\n borderWidthClasses,\n borderColorClasses,\n} from \"../core/fields\";\nimport { usePointsLedger, type PointsEntry } from \"../hooks/use-points-ledger\";\nimport { ErrorState } from \"../components/error-state\";\nimport { ChevronDown, Coins } from \"lucide-react\";\n\nconst formatRelativeTime = (dateString: string): string => {\n const now = new Date();\n const date = new Date(dateString);\n const diffMs = now.getTime() - date.getTime();\n const diffDays = Math.floor(diffMs / 86_400_000);\n\n if (diffDays < 1) return \"Today\";\n if (diffDays === 1) return \"1 day ago\";\n if (diffDays < 7) return `${diffDays} days ago`;\n if (diffDays < 14) return \"1 week ago\";\n if (diffDays < 30) return `${Math.floor(diffDays / 7)} weeks ago`;\n if (diffDays < 60) return \"1 month ago\";\n return `${Math.floor(diffDays / 30)} months ago`;\n};\n\nconst formatBalance = (balance: number): string => {\n return balance.toLocaleString(\"en-US\");\n};\n\ntype PointsWidgetProps = ComponentProps<\"div\"> & {\n // Title\n titleEnabled?: boolean;\n title?: string;\n titleFontSize?: FontSizeOptions;\n titleColor?: ColorOptions;\n\n // Balance\n balanceColor?: ColorOptions;\n\n // History\n historyEnabled?: boolean;\n historyTitle?: string;\n\n // Styling\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n borderWidth?: BorderWidthOptions;\n borderColor?: ColorOptions;\n};\n\nfunction PointsEntryRow({\n entry,\n textColor,\n accentColor,\n}: {\n entry: PointsEntry;\n textColor: ColorOptions;\n accentColor: ColorOptions;\n}) {\n const sign = entry.amount >= 0 ? \"+\" : \"-\";\n return (\n <div className=\"flex w-full items-center gap-3\">\n <div className=\"min-w-0 flex-1\">\n <p className={`text-sm text-${textColor} truncate`}>\n {entry.description}\n </p>\n <p className={`text-[10px] text-${textColor} leading-tight opacity-70`}>\n {formatRelativeTime(entry.createdAt)}\n </p>\n </div>\n <div className={`bg-${accentColor}/20 shrink-0 rounded-md px-1.5`}>\n <span className={`text-xs font-medium text-${accentColor} opacity-70`}>\n {sign}\n {Math.abs(entry.amount).toLocaleString(\"en-US\")}pts\n </span>\n </div>\n </div>\n );\n}\n\nexport function PointsWidget({\n // Title\n titleEnabled = true,\n title = \"Points\",\n titleFontSize = \"md\",\n titleColor = \"foreground\",\n\n // Balance\n balanceColor = \"primary\",\n\n // History\n historyEnabled = true,\n historyTitle = \"History\",\n\n // Styling\n background = { type: \"solid\", color: \"background\" },\n textColor = \"foreground\",\n accentColor = \"primary\",\n padding = 4,\n borderRadius = \"md\",\n borderWidth = \"none\",\n borderColor = \"muted\",\n\n className,\n ...props\n}: PointsWidgetProps): React.JSX.Element {\n const [historyOpen, setHistoryOpen] = useState(false);\n const historyPanelId = useId();\n\n const backgroundColor = background.color || \"background\";\n const backgroundImage =\n (background.resource?.image_url || background.resource?.imageUrl) &&\n background.type === \"image\"\n ? `url(${background.resource.image_url || background.resource.imageUrl})`\n : \"none\";\n\n const { data, isLoading, isError } = usePointsLedger();\n\n return (\n <div\n className={`@container overflow-hidden rounded-${borderRadius} bg-${backgroundColor} ${borderWidthClasses[borderWidth]} ${borderWidth !== \"none\" ? borderColorClasses[borderColor] : \"\"} ${className ?? \"\"}`}\n style={{ backgroundImage }}\n {...props}\n >\n <div className={`p-${padding} flex flex-col gap-2.5`}>\n {/* Header: Title + Balance */}\n {titleEnabled && (\n <h2\n className={`text-${titleFontSize} font-header font-bold text-${titleColor}`}\n >\n {title}\n </h2>\n )}\n {!isLoading && data && (\n <span\n className={`text-3xl font-semibold text-${balanceColor} font-header leading-snug`}\n >\n {formatBalance(data.balance)}\n </span>\n )}\n\n {/* Loading */}\n {isLoading ? (\n <div className=\"flex min-h-[60px] items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-2 border-current border-t-transparent\" />\n </div>\n ) : isError ? (\n <ErrorState />\n ) : historyEnabled && (!data || data.entries.length === 0) ? (\n /* Empty state — only shown when history is enabled but no entries */\n <div className=\"flex min-h-[60px] flex-col items-center justify-center gap-2\">\n <Coins className={`size-10 text-${textColor} opacity-30`} />\n <p className={`text-sm font-semibold text-${textColor} opacity-50`}>\n No Points Activity\n </p>\n </div>\n ) : historyEnabled && data && data.entries.length > 0 ? (\n /* History dropdown */\n <div className=\"flex flex-col gap-2\">\n {/* Dropdown toggle */}\n <button\n type=\"button\"\n aria-expanded={historyOpen}\n aria-controls={historyPanelId}\n onClick={() => setHistoryOpen((prev) => !prev)}\n className={`flex w-full items-center text-xs font-semibold text-${textColor} cursor-pointer`}\n >\n <span className=\"flex-1 text-left\">{historyTitle}</span>\n <ChevronDown\n className={`size-4 transition-transform duration-200 ${historyOpen ? \"rotate-180\" : \"\"}`}\n />\n </button>\n <div className={`bg-${textColor}/20 h-px w-full`} />\n\n {/* Collapsible entries */}\n <div\n id={historyPanelId}\n className={`flex flex-col gap-3 ${!historyOpen ? \"hidden\" : \"\"}`}\n >\n {data.entries.map((entry) => (\n <PointsEntryRow\n key={entry.id}\n entry={entry}\n textColor={textColor}\n accentColor={accentColor}\n />\n ))}\n </div>\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\nexport const pointsWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"PointsWidget\",\n displayName: \"Points\",\n fields: [\n // Title group\n {\n key: \"titleEnabled\",\n label: \"Show Title\",\n type: \"boolean\",\n description: \"Toggle title visibility\",\n defaultValue: true,\n\n group: \"Title\",\n },\n {\n key: \"title\",\n label: \"Title\",\n type: \"text\",\n description: \"Title text displayed above the balance\",\n defaultValue: \"Points\",\n\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n },\n getFontSizeField({\n key: \"titleFontSize\",\n label: \"Title Font Size\",\n description: \"Font size for the title\",\n defaultValue: \"md\",\n\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n getColorField({\n key: \"titleColor\",\n label: \"Title Color\",\n description: \"Color for the title\",\n defaultValue: \"foreground\",\n\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n\n // Balance group\n getColorField({\n key: \"balanceColor\",\n label: \"Balance Color\",\n description: \"Color for the points balance number\",\n defaultValue: \"primary\",\n\n group: \"Balance\",\n }),\n\n // History group\n {\n key: \"historyEnabled\",\n label: \"Show History\",\n type: \"boolean\",\n description: \"Show a collapsible history dropdown below the balance\",\n defaultValue: true,\n\n group: \"History\",\n },\n {\n key: \"historyTitle\",\n label: \"History Title\",\n type: \"text\",\n description: \"Title for the history dropdown\",\n defaultValue: \"History\",\n\n group: \"History\",\n requiresKeyToBeTrue: \"historyEnabled\",\n },\n\n // Design group\n {\n type: \"background\",\n key: \"background\",\n label: \"Background\",\n description: \"Background for the widget\",\n defaultValue: \"background\",\n\n group: \"Design\",\n },\n getColorField({\n key: \"textColor\",\n label: \"Text Color\",\n description: \"Default text color\",\n defaultValue: \"foreground\",\n\n group: \"Design\",\n }),\n getColorField({\n key: \"accentColor\",\n label: \"Accent Color\",\n description: \"Color for points badges and highlights\",\n defaultValue: \"primary\",\n\n group: \"Design\",\n }),\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n\n group: \"Design\",\n },\n getPaddingField({\n key: \"padding\",\n label: \"Padding\",\n description: \"Widget padding\",\n defaultValue: 4,\n\n group: \"Design\",\n }),\n getBorderRadiusField({\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Widget border radius\",\n defaultValue: \"md\",\n\n group: \"Design\",\n }),\n getBorderWidthField({\n key: \"borderWidth\",\n label: \"Border Width\",\n description: \"Widget border width\",\n defaultValue: \"none\",\n\n group: \"Design\",\n }),\n getBorderColorField({\n key: \"borderColor\",\n label: \"Border Color\",\n description: \"Widget border color\",\n defaultValue: \"muted\",\n\n group: \"Design\",\n }),\n ],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;AAEA,MAAM,sBAAM,IAAI,MAAM;AAEtB,SAAS,QAAQ,MAAsB;AACrC,yBAAO,IAAI,KAAK,IAAI,SAAS,GAAG,OAAO,MAAW,EAAC,aAAa;;AAGlE,MAAa,eAA2B;CACtC,SAAS;CACT,SAAS;EACP;GACE,IAAI;GACJ,aAAa;GACb,QAAQ;GACR,WAAW,QAAQ,EAAE;GACtB;EACD;GACE,IAAI;GACJ,aAAa;GACb,QAAQ;GACR,WAAW,QAAQ,GAAG;GACvB;EACD;GACE,IAAI;GACJ,aAAa;GACb,QAAQ;GACR,WAAW,QAAQ,GAAG;GACvB;EACD;GACE,IAAI;GACJ,aAAa;GACb,QAAQ;GACR,WAAW,QAAQ,GAAG;GACvB;EACF;CACF;;;ACxBD,MAAa,0BAA0B;AAEvC,SAAgB,kBAAqD;CACnE,MAAM,aAAa,eAAe;CAClC,MAAM,EAAE,cAAc,yBAAyB;CAC/C,MAAM,iBAAiB,6BAA6B;CACpD,MAAM,EAAE,YAAY;CACpB,MAAM,aAAa,eAAe,WAAW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a;GACb,cAAc;GAEd,OAAO;GACP,qBAAqB;GACtB;EAGD;GACE,MAAM;GACN,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR;EACD,cAAc;GACZ,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR,CAAC;EACF,cAAc;GACZ,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,MAAM;GACN,OAAO;GAEP,OAAO;GACR;EACD,gBAAgB;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR,CAAC;EACF,qBAAqB;GACnB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR,CAAC;EACF,oBAAoB;GAClB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR,CAAC;EACF,oBAAoB;GAClB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR,CAAC;EACH;CACF"}
|
|
1
|
+
{"version":3,"file":"PointsWidget-D0TPHzoh.mjs","names":[],"sources":["../../widgets/src/hooks/use-points-ledger.preview.ts","../../widgets/src/hooks/use-points-ledger.ts","../../widgets/src/widgets/PointsWidget.tsx"],"sourcesContent":["import type { PointsData } from \"@fluid-app/portal-core/widgets-api-types\";\n\nconst now = new Date();\n\nfunction daysAgo(days: number): string {\n return new Date(now.getTime() - days * 86_400_000).toISOString();\n}\n\nexport const PREVIEW_DATA: PointsData = {\n balance: 25,\n entries: [\n {\n id: 1,\n description: \"Purchase March 3rd\",\n amount: 20,\n createdAt: daysAgo(3),\n },\n {\n id: 2,\n description: \"Referral Bonus\",\n amount: 50,\n createdAt: daysAgo(14),\n },\n {\n id: 3,\n description: \"Points Redemption\",\n amount: -75,\n createdAt: daysAgo(60),\n },\n {\n id: 4,\n description: \"Welcome Reward\",\n amount: 30,\n createdAt: daysAgo(90),\n },\n ],\n};\n","import { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useWidgetsApi } from \"@fluid-app/portal-core/widgets-api-context\";\nimport { useWidgetPreviewContext } from \"@fluid-app/portal-react/data-sources/preview-context\";\nimport { useDataSourceRegistryConfig } from \"@fluid-app/portal-react/data-sources/registry-context\";\nimport { PREVIEW_DATA } from \"./use-points-ledger.preview\";\nimport type { PointsData } from \"@fluid-app/portal-core/widgets-api-types\";\n\nexport type {\n PointsData,\n PointsEntry,\n} from \"@fluid-app/portal-core/widgets-api-types\";\n\nexport const POINTS_LEDGER_QUERY_KEY = \"points-ledger\" as const;\n\nexport function usePointsLedger(): UseQueryResult<PointsData, Error> {\n const widgetsApi = useWidgetsApi();\n const { isPreview } = useWidgetPreviewContext();\n const registryConfig = useDataSourceRegistryConfig();\n const { baseUrl } = registryConfig;\n const customerId = registryConfig.variables?.customer_id;\n\n // Contract: the BFF adapter (portal app, composite factory spreads BFF over\n // legacy) ignores customerId and infers the customer from the JWT, so the\n // portal renders this widget with no registry-variable plumbing. The legacy\n // adapter (fluid-admin) builds /v202506/customers/{customerId}/points_ledgers\n // and MUST receive a real id; that consumer always supplies one via registry\n // variables, so empty string never reaches the legacy URL in practice. If a\n // future caller wires this hook to a legacy-only adapter, configure\n // registry variables.customer_id at the provider — otherwise the request\n // would 404 on /customers//points_ledgers.\n return useQuery({\n queryKey: [\n \"portal-widget-use\",\n POINTS_LEDGER_QUERY_KEY,\n isPreview ? \"preview\" : baseUrl,\n customerId ?? null,\n ] as const,\n queryFn: ({ signal }) =>\n widgetsApi.fetchPointsLedger(customerId ?? \"\", signal),\n enabled: !isPreview,\n ...(isPreview && { placeholderData: PREVIEW_DATA }),\n });\n}\n","import { useId, useState, type ComponentProps } from \"react\";\nimport type React from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n BorderWidthOptions,\n ColorOptions,\n FontSizeOptions,\n PaddingOptions,\n} from \"@fluid-app/portal-core/types\";\nimport type { WidgetPropertySchema } from \"@fluid-app/portal-core/registries\";\nimport {\n getBorderRadiusField,\n getBorderWidthField,\n getBorderColorField,\n getColorField,\n getFontSizeField,\n getPaddingField,\n borderWidthClasses,\n borderColorClasses,\n} from \"../core/fields\";\nimport { usePointsLedger, type PointsEntry } from \"../hooks/use-points-ledger\";\nimport { ErrorState } from \"../components/error-state\";\nimport { ChevronDown, Coins } from \"lucide-react\";\n\nconst formatRelativeTime = (dateString: string): string => {\n const now = new Date();\n const date = new Date(dateString);\n const diffMs = now.getTime() - date.getTime();\n const diffDays = Math.floor(diffMs / 86_400_000);\n\n if (diffDays < 1) return \"Today\";\n if (diffDays === 1) return \"1 day ago\";\n if (diffDays < 7) return `${diffDays} days ago`;\n if (diffDays < 14) return \"1 week ago\";\n if (diffDays < 30) return `${Math.floor(diffDays / 7)} weeks ago`;\n if (diffDays < 60) return \"1 month ago\";\n return `${Math.floor(diffDays / 30)} months ago`;\n};\n\nconst formatBalance = (balance: number): string => {\n return balance.toLocaleString(\"en-US\");\n};\n\ntype PointsWidgetProps = ComponentProps<\"div\"> & {\n // Title\n titleEnabled?: boolean;\n title?: string;\n titleFontSize?: FontSizeOptions;\n titleColor?: ColorOptions;\n\n // Balance\n balanceColor?: ColorOptions;\n\n // History\n historyEnabled?: boolean;\n historyTitle?: string;\n\n // Styling\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n borderWidth?: BorderWidthOptions;\n borderColor?: ColorOptions;\n};\n\nfunction PointsEntryRow({\n entry,\n textColor,\n accentColor,\n}: {\n entry: PointsEntry;\n textColor: ColorOptions;\n accentColor: ColorOptions;\n}) {\n const sign = entry.amount >= 0 ? \"+\" : \"-\";\n return (\n <div className=\"flex w-full items-center gap-3\">\n <div className=\"min-w-0 flex-1\">\n <p className={`text-sm text-${textColor} truncate`}>\n {entry.description}\n </p>\n <p className={`text-[10px] text-${textColor} leading-tight opacity-70`}>\n {formatRelativeTime(entry.createdAt)}\n </p>\n </div>\n <div className={`bg-${accentColor}/20 shrink-0 rounded-md px-1.5`}>\n <span className={`text-xs font-medium text-${accentColor} opacity-70`}>\n {sign}\n {Math.abs(entry.amount).toLocaleString(\"en-US\")}pts\n </span>\n </div>\n </div>\n );\n}\n\nexport function PointsWidget({\n // Title\n titleEnabled = true,\n title = \"Points\",\n titleFontSize = \"md\",\n titleColor = \"foreground\",\n\n // Balance\n balanceColor = \"primary\",\n\n // History\n historyEnabled = true,\n historyTitle = \"History\",\n\n // Styling\n background = { type: \"solid\", color: \"background\" },\n textColor = \"foreground\",\n accentColor = \"primary\",\n padding = 4,\n borderRadius = \"md\",\n borderWidth = \"none\",\n borderColor = \"muted\",\n\n className,\n ...props\n}: PointsWidgetProps): React.JSX.Element {\n const [historyOpen, setHistoryOpen] = useState(false);\n const historyPanelId = useId();\n\n const backgroundColor = background.color || \"background\";\n const backgroundImage =\n (background.resource?.image_url || background.resource?.imageUrl) &&\n background.type === \"image\"\n ? `url(${background.resource.image_url || background.resource.imageUrl})`\n : \"none\";\n\n const { data, isLoading, isError } = usePointsLedger();\n\n return (\n <div\n className={`@container overflow-hidden rounded-${borderRadius} bg-${backgroundColor} ${borderWidthClasses[borderWidth]} ${borderWidth !== \"none\" ? borderColorClasses[borderColor] : \"\"} ${className ?? \"\"}`}\n style={{ backgroundImage }}\n {...props}\n >\n <div className={`p-${padding} flex flex-col gap-2.5`}>\n {/* Header: Title + Balance */}\n {titleEnabled && (\n <h2\n className={`text-${titleFontSize} font-header font-bold text-${titleColor}`}\n >\n {title}\n </h2>\n )}\n {!isLoading && data && (\n <span\n className={`text-3xl font-semibold text-${balanceColor} font-header leading-snug`}\n >\n {formatBalance(data.balance)}\n </span>\n )}\n\n {/* Loading */}\n {isLoading ? (\n <div className=\"flex min-h-[60px] items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-2 border-current border-t-transparent\" />\n </div>\n ) : isError ? (\n <ErrorState />\n ) : historyEnabled && (!data || data.entries.length === 0) ? (\n /* Empty state — only shown when history is enabled but no entries */\n <div className=\"flex min-h-[60px] flex-col items-center justify-center gap-2\">\n <Coins className={`size-10 text-${textColor} opacity-30`} />\n <p className={`text-sm font-semibold text-${textColor} opacity-50`}>\n No Points Activity\n </p>\n </div>\n ) : historyEnabled && data && data.entries.length > 0 ? (\n /* History dropdown */\n <div className=\"flex flex-col gap-2\">\n {/* Dropdown toggle */}\n <button\n type=\"button\"\n aria-expanded={historyOpen}\n aria-controls={historyPanelId}\n onClick={() => setHistoryOpen((prev) => !prev)}\n className={`flex w-full items-center text-xs font-semibold text-${textColor} cursor-pointer`}\n >\n <span className=\"flex-1 text-left\">{historyTitle}</span>\n <ChevronDown\n className={`size-4 transition-transform duration-200 ${historyOpen ? \"rotate-180\" : \"\"}`}\n />\n </button>\n <div className={`bg-${textColor}/20 h-px w-full`} />\n\n {/* Collapsible entries */}\n <div\n id={historyPanelId}\n className={`flex flex-col gap-3 ${!historyOpen ? \"hidden\" : \"\"}`}\n >\n {data.entries.map((entry) => (\n <PointsEntryRow\n key={entry.id}\n entry={entry}\n textColor={textColor}\n accentColor={accentColor}\n />\n ))}\n </div>\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\nexport const pointsWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"PointsWidget\",\n displayName: \"Points\",\n fields: [\n // Title group\n {\n key: \"titleEnabled\",\n label: \"Show Title\",\n type: \"boolean\",\n description: \"Toggle title visibility\",\n defaultValue: true,\n\n group: \"Title\",\n },\n {\n key: \"title\",\n label: \"Title\",\n type: \"text\",\n description: \"Title text displayed above the balance\",\n defaultValue: \"Points\",\n\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n },\n getFontSizeField({\n key: \"titleFontSize\",\n label: \"Title Font Size\",\n description: \"Font size for the title\",\n defaultValue: \"md\",\n\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n getColorField({\n key: \"titleColor\",\n label: \"Title Color\",\n description: \"Color for the title\",\n defaultValue: \"foreground\",\n\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n\n // Balance group\n getColorField({\n key: \"balanceColor\",\n label: \"Balance Color\",\n description: \"Color for the points balance number\",\n defaultValue: \"primary\",\n\n group: \"Balance\",\n }),\n\n // History group\n {\n key: \"historyEnabled\",\n label: \"Show History\",\n type: \"boolean\",\n description: \"Show a collapsible history dropdown below the balance\",\n defaultValue: true,\n\n group: \"History\",\n },\n {\n key: \"historyTitle\",\n label: \"History Title\",\n type: \"text\",\n description: \"Title for the history dropdown\",\n defaultValue: \"History\",\n\n group: \"History\",\n requiresKeyToBeTrue: \"historyEnabled\",\n },\n\n // Design group\n {\n type: \"background\",\n key: \"background\",\n label: \"Background\",\n description: \"Background for the widget\",\n defaultValue: \"background\",\n\n group: \"Design\",\n },\n getColorField({\n key: \"textColor\",\n label: \"Text Color\",\n description: \"Default text color\",\n defaultValue: \"foreground\",\n\n group: \"Design\",\n }),\n getColorField({\n key: \"accentColor\",\n label: \"Accent Color\",\n description: \"Color for points badges and highlights\",\n defaultValue: \"primary\",\n\n group: \"Design\",\n }),\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n\n group: \"Design\",\n },\n getPaddingField({\n key: \"padding\",\n label: \"Padding\",\n description: \"Widget padding\",\n defaultValue: 4,\n\n group: \"Design\",\n }),\n getBorderRadiusField({\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Widget border radius\",\n defaultValue: \"md\",\n\n group: \"Design\",\n }),\n getBorderWidthField({\n key: \"borderWidth\",\n label: \"Border Width\",\n description: \"Widget border width\",\n defaultValue: \"none\",\n\n group: \"Design\",\n }),\n getBorderColorField({\n key: \"borderColor\",\n label: \"Border Color\",\n description: \"Widget border color\",\n defaultValue: \"muted\",\n\n group: \"Design\",\n }),\n ],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;AAEA,MAAM,sBAAM,IAAI,MAAM;AAEtB,SA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Ac;GAEd,OAAO;GACR,CAAC;EACH;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as useLanguagesApi, n as useFluidContext } from "./FluidProvider-
|
|
1
|
+
import { R as useLanguagesApi, n as useFluidContext } from "./FluidProvider-C00Px_ej.mjs";
|
|
2
2
|
import { j as useAccountApi } from "./portal_tenant-l4a-eX2B.mjs";
|
|
3
3
|
import { i as usePayApi } from "./api-context-3GmfqvIB.mjs";
|
|
4
4
|
import { n as useCountriesApi } from "./countries-api-context-CMh13cfX.mjs";
|
|
@@ -35,39 +35,39 @@ function ProfileLayout(props) {
|
|
|
35
35
|
return /* @__PURE__ */ jsx("div", {
|
|
36
36
|
className: "relative",
|
|
37
37
|
children: /* @__PURE__ */ jsxs("div", {
|
|
38
|
-
className: "
|
|
38
|
+
className: "relative mx-auto max-w-4xl px-5 pt-8 pb-20 md:px-8",
|
|
39
39
|
children: [
|
|
40
40
|
/* @__PURE__ */ jsxs("section", {
|
|
41
41
|
className: "flex items-center gap-3.5",
|
|
42
42
|
children: [
|
|
43
43
|
/* @__PURE__ */ jsx("div", {
|
|
44
|
-
className: "
|
|
44
|
+
className: "relative size-12 shrink-0 overflow-hidden rounded-full ring-1 ring-black/5 md:size-13",
|
|
45
45
|
children: account.avatar_url ? /* @__PURE__ */ jsx("img", {
|
|
46
46
|
src: account.avatar_url,
|
|
47
47
|
alt: "",
|
|
48
48
|
className: "h-full w-full object-cover"
|
|
49
49
|
}) : /* @__PURE__ */ jsx("div", {
|
|
50
|
-
className: "bg-
|
|
50
|
+
className: "bg-primary text-primary-foreground flex h-full w-full items-center justify-center text-lg font-semibold",
|
|
51
51
|
children: heroDisplay.charAt(0).toUpperCase()
|
|
52
52
|
})
|
|
53
53
|
}),
|
|
54
54
|
/* @__PURE__ */ jsxs("div", {
|
|
55
55
|
className: "min-w-0 flex-1",
|
|
56
56
|
children: [/* @__PURE__ */ jsx("h1", {
|
|
57
|
-
className: "text-
|
|
57
|
+
className: "text-foreground truncate text-xl font-bold tracking-tight md:text-2xl",
|
|
58
58
|
children: heroDisplay
|
|
59
59
|
}), /* @__PURE__ */ jsx("p", {
|
|
60
|
-
className: "text-
|
|
60
|
+
className: "text-muted-foreground mt-0.5 truncate text-sm",
|
|
61
61
|
children: account.email
|
|
62
62
|
})]
|
|
63
63
|
}),
|
|
64
64
|
/* @__PURE__ */ jsx("div", {
|
|
65
65
|
className: "flex shrink-0 items-center gap-2",
|
|
66
66
|
children: rewardsEnabled && /* @__PURE__ */ jsxs("div", {
|
|
67
|
-
className: "ring-
|
|
67
|
+
className: "ring-border text-foreground inline-flex items-center gap-1.5 rounded-md bg-transparent px-2.5 py-1 text-xs font-semibold ring-1",
|
|
68
68
|
children: [
|
|
69
69
|
/* @__PURE__ */ jsx(Sparkles, {
|
|
70
|
-
className: "text-
|
|
70
|
+
className: "text-primary size-3",
|
|
71
71
|
strokeWidth: 2.25
|
|
72
72
|
}),
|
|
73
73
|
(pointsBalance ?? 0).toLocaleString(),
|
|
@@ -87,7 +87,7 @@ function ProfileLayout(props) {
|
|
|
87
87
|
})
|
|
88
88
|
}),
|
|
89
89
|
/* @__PURE__ */ jsxs("div", {
|
|
90
|
-
className: "ring-
|
|
90
|
+
className: "ring-border mt-2.5 overflow-hidden rounded-2xl bg-transparent ring-1",
|
|
91
91
|
children: [
|
|
92
92
|
/* @__PURE__ */ jsx(FieldRow, {
|
|
93
93
|
icon: User,
|
|
@@ -126,33 +126,33 @@ function ProfileLayout(props) {
|
|
|
126
126
|
rewardsEnabled && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SectionHeader, {
|
|
127
127
|
title: t("points_history"),
|
|
128
128
|
action: /* @__PURE__ */ jsx("span", {
|
|
129
|
-
className: "text-
|
|
129
|
+
className: "text-muted-foreground/75 text-xs",
|
|
130
130
|
children: t("pts_available", { count: String((pointsBalance ?? 0).toLocaleString()) })
|
|
131
131
|
})
|
|
132
132
|
}), ledger.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
133
|
-
className: "ring-
|
|
133
|
+
className: "ring-border mt-2.5 overflow-hidden rounded-2xl bg-transparent ring-1",
|
|
134
134
|
children: [ledgerPreview.map((entry, i) => /* @__PURE__ */ jsx(PointsLedgerRow, {
|
|
135
135
|
entry,
|
|
136
136
|
isLast: !hasMoreLedger && i === ledgerPreview.length - 1
|
|
137
137
|
}, entry.id)), hasMoreLedger && /* @__PURE__ */ jsx("button", {
|
|
138
138
|
type: "button",
|
|
139
139
|
onClick: () => setIsPointsHistoryOpen(true),
|
|
140
|
-
className: "text-
|
|
140
|
+
className: "text-foreground hover:bg-muted flex w-full items-center justify-center gap-1 px-4 py-3 text-xs font-bold transition-colors",
|
|
141
141
|
children: t("see_all_transactions", { count: ledger.length })
|
|
142
142
|
})]
|
|
143
143
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
144
|
-
className: "ring-dashed ring-
|
|
144
|
+
className: "ring-dashed ring-border mt-2.5 flex flex-col items-center justify-center gap-1 rounded-2xl bg-transparent px-4 py-8 text-center ring-1",
|
|
145
145
|
children: [
|
|
146
146
|
/* @__PURE__ */ jsx(Sparkles, {
|
|
147
|
-
className: "text-
|
|
147
|
+
className: "text-muted-foreground/75 size-5",
|
|
148
148
|
strokeWidth: 1.75
|
|
149
149
|
}),
|
|
150
150
|
/* @__PURE__ */ jsx("div", {
|
|
151
|
-
className: "text-
|
|
151
|
+
className: "text-foreground text-sm font-bold",
|
|
152
152
|
children: t("no_points_yet")
|
|
153
153
|
}),
|
|
154
154
|
/* @__PURE__ */ jsx("div", {
|
|
155
|
-
className: "text-
|
|
155
|
+
className: "text-muted-foreground text-xs",
|
|
156
156
|
children: t("earn_points_hint")
|
|
157
157
|
})
|
|
158
158
|
]
|
|
@@ -166,10 +166,10 @@ function ProfileLayout(props) {
|
|
|
166
166
|
}) : void 0
|
|
167
167
|
}),
|
|
168
168
|
/* @__PURE__ */ jsxs("div", {
|
|
169
|
-
className: "ring-
|
|
169
|
+
className: "ring-border mt-2.5 flex items-center gap-3 rounded-2xl bg-transparent p-3.5 ring-1",
|
|
170
170
|
children: [
|
|
171
171
|
/* @__PURE__ */ jsx("div", {
|
|
172
|
-
className: "
|
|
172
|
+
className: "bg-muted text-foreground flex size-11 shrink-0 items-center justify-center rounded-full",
|
|
173
173
|
children: /* @__PURE__ */ jsx(Link2, {
|
|
174
174
|
className: "size-[18px]",
|
|
175
175
|
strokeWidth: 2
|
|
@@ -178,10 +178,10 @@ function ProfileLayout(props) {
|
|
|
178
178
|
/* @__PURE__ */ jsxs("div", {
|
|
179
179
|
className: "min-w-0 flex-1",
|
|
180
180
|
children: [/* @__PURE__ */ jsx("div", {
|
|
181
|
-
className: "text-
|
|
181
|
+
className: "text-muted-foreground/75 text-xs font-bold tracking-widest uppercase",
|
|
182
182
|
children: t("public_link")
|
|
183
183
|
}), /* @__PURE__ */ jsx("div", {
|
|
184
|
-
className: "text-
|
|
184
|
+
className: "text-foreground mt-0.5 truncate font-mono text-sm font-semibold",
|
|
185
185
|
children: mySiteDisplayUrl || t("set_your_mysite_link")
|
|
186
186
|
})]
|
|
187
187
|
}),
|
|
@@ -189,7 +189,7 @@ function ProfileLayout(props) {
|
|
|
189
189
|
type: "button",
|
|
190
190
|
onClick: onCopyMySiteLink,
|
|
191
191
|
disabled: !mySiteDisplayUrl,
|
|
192
|
-
className: "ring-
|
|
192
|
+
className: "ring-border text-foreground hover:bg-muted inline-flex items-center gap-1 rounded-md bg-transparent px-3 py-1.5 text-xs font-bold ring-1 transition-all disabled:cursor-not-allowed disabled:opacity-40",
|
|
193
193
|
children: [/* @__PURE__ */ jsx(Copy, {
|
|
194
194
|
className: "size-3",
|
|
195
195
|
strokeWidth: 2.25
|
|
@@ -209,12 +209,12 @@ function ProfileLayout(props) {
|
|
|
209
209
|
/* @__PURE__ */ jsx(SectionHeader, {
|
|
210
210
|
title: t("social_media"),
|
|
211
211
|
action: /* @__PURE__ */ jsx("span", {
|
|
212
|
-
className: "text-
|
|
212
|
+
className: "text-muted-foreground/75 text-xs",
|
|
213
213
|
children: t("connected_count", { count: connectedSocialCount })
|
|
214
214
|
})
|
|
215
215
|
}),
|
|
216
216
|
/* @__PURE__ */ jsx("div", {
|
|
217
|
-
className: "ring-
|
|
217
|
+
className: "ring-border mt-2.5 overflow-hidden rounded-2xl bg-transparent ring-1",
|
|
218
218
|
children: SOCIAL_ENTRIES.map((entry, i) => /* @__PURE__ */ jsx(SocialRow, {
|
|
219
219
|
entry,
|
|
220
220
|
handle: socialLinks[entry.key] ?? "",
|
|
@@ -228,7 +228,7 @@ function ProfileLayout(props) {
|
|
|
228
228
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
229
229
|
className: "max-w-md md:max-w-lg",
|
|
230
230
|
children: [/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("points_history") }) }), /* @__PURE__ */ jsx("div", {
|
|
231
|
-
className: "ring-
|
|
231
|
+
className: "ring-border max-h-[60vh] overflow-y-auto rounded-2xl bg-transparent ring-1",
|
|
232
232
|
children: ledger.map((entry, i) => /* @__PURE__ */ jsx(PointsLedgerRow, {
|
|
233
233
|
entry,
|
|
234
234
|
isLast: i === ledger.length - 1
|
|
@@ -237,26 +237,26 @@ function ProfileLayout(props) {
|
|
|
237
237
|
})
|
|
238
238
|
}),
|
|
239
239
|
onSignOut && /* @__PURE__ */ jsxs("div", {
|
|
240
|
-
className: "ring-
|
|
240
|
+
className: "ring-border mt-8 flex flex-wrap items-center justify-between gap-3 rounded-2xl bg-transparent p-3.5 ring-1",
|
|
241
241
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
242
242
|
className: "flex items-center gap-3",
|
|
243
243
|
children: [/* @__PURE__ */ jsx("div", {
|
|
244
|
-
className: "bg-
|
|
244
|
+
className: "bg-destructive/10 flex size-9 items-center justify-center rounded-md",
|
|
245
245
|
children: /* @__PURE__ */ jsx(LogOut, {
|
|
246
|
-
className: "text-
|
|
246
|
+
className: "text-destructive size-4",
|
|
247
247
|
strokeWidth: 2.25
|
|
248
248
|
})
|
|
249
249
|
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
250
|
-
className: "text-
|
|
250
|
+
className: "text-foreground text-sm font-bold",
|
|
251
251
|
children: t("sign_out")
|
|
252
252
|
}), /* @__PURE__ */ jsx("div", {
|
|
253
|
-
className: "text-
|
|
253
|
+
className: "text-muted-foreground text-xs",
|
|
254
254
|
children: t("sign_out_description")
|
|
255
255
|
})] })]
|
|
256
256
|
}), /* @__PURE__ */ jsx("button", {
|
|
257
257
|
type: "button",
|
|
258
258
|
onClick: onSignOut,
|
|
259
|
-
className: "bg-
|
|
259
|
+
className: "bg-destructive/15 text-destructive hover:bg-destructive/25 rounded-md px-4 py-2 text-xs font-bold transition-colors",
|
|
260
260
|
children: t("sign_out")
|
|
261
261
|
})]
|
|
262
262
|
})
|
|
@@ -268,7 +268,7 @@ function SectionHeader({ title, action }) {
|
|
|
268
268
|
return /* @__PURE__ */ jsxs("div", {
|
|
269
269
|
className: "mt-8 flex items-end justify-between",
|
|
270
270
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
271
|
-
className: "text-
|
|
271
|
+
className: "text-foreground text-base font-bold tracking-tight",
|
|
272
272
|
children: title
|
|
273
273
|
}), action ?? null]
|
|
274
274
|
});
|
|
@@ -278,7 +278,7 @@ function PillButton({ onClick, icon: Icon, label, disabled }) {
|
|
|
278
278
|
type: "button",
|
|
279
279
|
onClick,
|
|
280
280
|
disabled,
|
|
281
|
-
className: "ring-
|
|
281
|
+
className: "ring-border text-foreground hover:bg-muted inline-flex items-center gap-1 rounded-md bg-transparent px-3 py-1.5 text-xs font-bold ring-1 transition-all disabled:cursor-not-allowed disabled:opacity-40",
|
|
282
282
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
283
283
|
className: "size-3",
|
|
284
284
|
strokeWidth: 2.25
|
|
@@ -290,33 +290,33 @@ function PointsLedgerRow({ entry, isLast }) {
|
|
|
290
290
|
const isCredit = entry.amount >= 0;
|
|
291
291
|
const sign = isCredit ? "+" : "−";
|
|
292
292
|
const magnitude = Math.abs(entry.amount).toLocaleString();
|
|
293
|
-
const amountColor = isCredit ? "text-emerald-600" : "text-
|
|
293
|
+
const amountColor = isCredit ? "text-emerald-600" : "text-destructive";
|
|
294
294
|
const sourceName = entry.metadata?.source?.name?.trim();
|
|
295
295
|
const transactionType = entry.metadata?.transaction_type;
|
|
296
296
|
const label = sourceName || (transactionType ? transactionType.charAt(0).toUpperCase() + transactionType.slice(1) : isCredit ? t("points_awarded") : t("points_redeemed"));
|
|
297
297
|
const dateLabel = formatLedgerDate(entry.created_at);
|
|
298
298
|
return /* @__PURE__ */ jsxs("div", {
|
|
299
|
-
className: `flex items-center gap-3 px-4 py-3.5 ${isLast ? "" : "border-
|
|
299
|
+
className: `flex items-center gap-3 px-4 py-3.5 ${isLast ? "" : "border-border border-b"}`,
|
|
300
300
|
children: [
|
|
301
301
|
/* @__PURE__ */ jsx("div", {
|
|
302
|
-
className: "bg-
|
|
302
|
+
className: "bg-muted flex size-9 shrink-0 items-center justify-center rounded-full",
|
|
303
303
|
children: /* @__PURE__ */ jsx(Sparkles, {
|
|
304
|
-
className: `size-4 ${isCredit ? "text-
|
|
304
|
+
className: `size-4 ${isCredit ? "text-primary" : "text-muted-foreground"}`,
|
|
305
305
|
strokeWidth: 2
|
|
306
306
|
})
|
|
307
307
|
}),
|
|
308
308
|
/* @__PURE__ */ jsxs("div", {
|
|
309
309
|
className: "min-w-0 flex-1",
|
|
310
310
|
children: [/* @__PURE__ */ jsx("div", {
|
|
311
|
-
className: "text-
|
|
311
|
+
className: "text-foreground truncate text-sm font-medium",
|
|
312
312
|
children: label
|
|
313
313
|
}), /* @__PURE__ */ jsx("div", {
|
|
314
|
-
className: "text-
|
|
314
|
+
className: "text-muted-foreground text-xs",
|
|
315
315
|
children: dateLabel
|
|
316
316
|
})]
|
|
317
317
|
}),
|
|
318
318
|
/* @__PURE__ */ jsxs("div", {
|
|
319
|
-
className: `
|
|
319
|
+
className: `shrink-0 font-mono text-sm font-bold tabular-nums ${amountColor}`,
|
|
320
320
|
children: [sign, magnitude]
|
|
321
321
|
})
|
|
322
322
|
]
|
|
@@ -336,9 +336,9 @@ function formatLedgerDate(iso) {
|
|
|
336
336
|
function FieldRow({ icon: Icon, label, value, placeholder, isLast, multiline }) {
|
|
337
337
|
const display = value || placeholder || "";
|
|
338
338
|
return /* @__PURE__ */ jsxs("div", {
|
|
339
|
-
className: `flex gap-3 px-4 py-3.5 ${multiline ? "items-start" : "items-center"} ${isLast ? "" : "border-
|
|
339
|
+
className: `flex gap-3 px-4 py-3.5 ${multiline ? "items-start" : "items-center"} ${isLast ? "" : "border-border border-b"}`,
|
|
340
340
|
children: [/* @__PURE__ */ jsx("div", {
|
|
341
|
-
className: "bg-
|
|
341
|
+
className: "bg-muted text-muted-foreground flex size-9 shrink-0 items-center justify-center rounded-full",
|
|
342
342
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
343
343
|
className: "size-4",
|
|
344
344
|
strokeWidth: 2
|
|
@@ -346,10 +346,10 @@ function FieldRow({ icon: Icon, label, value, placeholder, isLast, multiline })
|
|
|
346
346
|
}), /* @__PURE__ */ jsxs("div", {
|
|
347
347
|
className: "min-w-0 flex-1",
|
|
348
348
|
children: [/* @__PURE__ */ jsx("div", {
|
|
349
|
-
className: "text-
|
|
349
|
+
className: "text-muted-foreground/75 text-xs font-bold tracking-widest uppercase",
|
|
350
350
|
children: label
|
|
351
351
|
}), /* @__PURE__ */ jsx("div", {
|
|
352
|
-
className: `mt-0.5 ${multiline ? "whitespace-pre-line" : "truncate"} text-
|
|
352
|
+
className: `mt-0.5 ${multiline ? "whitespace-pre-line" : "truncate"} text-sm font-medium ${!value && Boolean(placeholder) ? "text-muted-foreground/55" : "text-foreground"}`,
|
|
353
353
|
children: display
|
|
354
354
|
})]
|
|
355
355
|
})]
|
|
@@ -396,13 +396,13 @@ function PaymentCardVisual({ method, onClick }) {
|
|
|
396
396
|
/* @__PURE__ */ jsxs("div", {
|
|
397
397
|
className: "relative flex items-start justify-between",
|
|
398
398
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
399
|
-
className: "text-
|
|
399
|
+
className: "text-background/50 text-xs font-semibold tracking-widest uppercase",
|
|
400
400
|
children: brandLabel
|
|
401
401
|
}), /* @__PURE__ */ jsx("div", {
|
|
402
|
-
className: "text-
|
|
402
|
+
className: "text-background mt-1 font-mono text-xl font-bold tracking-wider",
|
|
403
403
|
children: last4
|
|
404
404
|
})] }), method.default && /* @__PURE__ */ jsx("span", {
|
|
405
|
-
className: "
|
|
405
|
+
className: "bg-background/10 text-background/80 rounded-md px-2 py-0.5 text-xs font-bold tracking-wider uppercase",
|
|
406
406
|
children: t("default")
|
|
407
407
|
})]
|
|
408
408
|
}),
|
|
@@ -412,22 +412,22 @@ function PaymentCardVisual({ method, onClick }) {
|
|
|
412
412
|
/* @__PURE__ */ jsxs("div", {
|
|
413
413
|
className: "min-w-0 flex-1",
|
|
414
414
|
children: [/* @__PURE__ */ jsx("div", {
|
|
415
|
-
className: "text-
|
|
415
|
+
className: "text-background/40 text-xs font-semibold tracking-widest uppercase",
|
|
416
416
|
children: t("cardholder")
|
|
417
417
|
}), /* @__PURE__ */ jsx("div", {
|
|
418
|
-
className: "text-
|
|
418
|
+
className: "text-background truncate text-xs font-semibold",
|
|
419
419
|
children: holder || " "
|
|
420
420
|
})]
|
|
421
421
|
}),
|
|
422
422
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
423
|
-
className: "text-
|
|
423
|
+
className: "text-background/40 text-xs font-semibold tracking-widest uppercase",
|
|
424
424
|
children: t("card_expires")
|
|
425
425
|
}), /* @__PURE__ */ jsx("div", {
|
|
426
|
-
className: "text-
|
|
426
|
+
className: "text-background font-mono text-xs font-semibold",
|
|
427
427
|
children: exp
|
|
428
428
|
})] }),
|
|
429
429
|
/* @__PURE__ */ jsx("div", {
|
|
430
|
-
className: `
|
|
430
|
+
className: `shrink-0 rounded px-1.5 py-0.5 text-xs font-bold tracking-wider text-white ${badgeBg}`,
|
|
431
431
|
children: badge
|
|
432
432
|
})
|
|
433
433
|
]
|
|
@@ -440,21 +440,21 @@ function AddPaymentTile({ onClick }) {
|
|
|
440
440
|
return /* @__PURE__ */ jsxs("button", {
|
|
441
441
|
type: "button",
|
|
442
442
|
onClick,
|
|
443
|
-
className: "group ring-dashed ring-
|
|
443
|
+
className: "group ring-dashed ring-border text-muted-foreground hover:bg-background hover:text-foreground flex aspect-[1.586/1] flex-col items-center justify-center gap-1.5 rounded-xl bg-transparent ring-1 transition-colors",
|
|
444
444
|
children: [
|
|
445
445
|
/* @__PURE__ */ jsx("div", {
|
|
446
|
-
className: "ring-
|
|
446
|
+
className: "ring-border flex size-9 items-center justify-center rounded-full bg-transparent ring-1",
|
|
447
447
|
children: /* @__PURE__ */ jsx(Plus, {
|
|
448
448
|
className: "size-4",
|
|
449
449
|
strokeWidth: 2.25
|
|
450
450
|
})
|
|
451
451
|
}),
|
|
452
452
|
/* @__PURE__ */ jsx("div", {
|
|
453
|
-
className: "text-
|
|
453
|
+
className: "text-foreground text-xs font-bold",
|
|
454
454
|
children: t("add_payment_method")
|
|
455
455
|
}),
|
|
456
456
|
/* @__PURE__ */ jsx("div", {
|
|
457
|
-
className: "text-
|
|
457
|
+
className: "text-muted-foreground/75 text-xs",
|
|
458
458
|
children: t("accepted_cards")
|
|
459
459
|
})
|
|
460
460
|
]
|
|
@@ -469,7 +469,7 @@ function AddressCard({ address, onEdit, onDelete }) {
|
|
|
469
469
|
address.postal_code
|
|
470
470
|
].filter(Boolean).join(", ");
|
|
471
471
|
return /* @__PURE__ */ jsxs("div", {
|
|
472
|
-
className: "ring-
|
|
472
|
+
className: "ring-border hover:bg-muted focus-within:ring-foreground/40 relative flex flex-col rounded-2xl bg-transparent ring-1 transition-all duration-200 focus-within:ring-2 hover:ring-2",
|
|
473
473
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
474
474
|
type: "button",
|
|
475
475
|
onClick: onEdit,
|
|
@@ -479,27 +479,27 @@ function AddressCard({ address, onEdit, onDelete }) {
|
|
|
479
479
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
480
480
|
className: "flex items-center gap-2",
|
|
481
481
|
children: [/* @__PURE__ */ jsx("div", {
|
|
482
|
-
className: "bg-
|
|
482
|
+
className: "bg-muted flex size-8 items-center justify-center rounded-full",
|
|
483
483
|
children: /* @__PURE__ */ jsx(MapPin, {
|
|
484
|
-
className: "text-
|
|
484
|
+
className: "text-muted-foreground size-4",
|
|
485
485
|
strokeWidth: 2
|
|
486
486
|
})
|
|
487
487
|
}), /* @__PURE__ */ jsx("div", {
|
|
488
|
-
className: "text-
|
|
488
|
+
className: "text-foreground text-sm font-bold",
|
|
489
489
|
children: label
|
|
490
490
|
})]
|
|
491
491
|
}), address.default && /* @__PURE__ */ jsx("span", {
|
|
492
|
-
className: "bg-
|
|
492
|
+
className: "bg-primary text-primary-foreground rounded-md px-2 py-0.5 text-xs font-bold tracking-wider uppercase",
|
|
493
493
|
children: t("default")
|
|
494
494
|
})]
|
|
495
495
|
}), /* @__PURE__ */ jsxs("div", {
|
|
496
|
-
className: "text-
|
|
496
|
+
className: "text-foreground mt-3 space-y-0.5 text-sm leading-snug",
|
|
497
497
|
children: [
|
|
498
498
|
address.address1 && /* @__PURE__ */ jsx("div", { children: address.address1 }),
|
|
499
499
|
address.address2 && /* @__PURE__ */ jsx("div", { children: address.address2 }),
|
|
500
500
|
cityLine && /* @__PURE__ */ jsx("div", { children: cityLine }),
|
|
501
501
|
address.country_code && /* @__PURE__ */ jsx("div", {
|
|
502
|
-
className: "text-
|
|
502
|
+
className: "text-muted-foreground",
|
|
503
503
|
children: address.country_code
|
|
504
504
|
})
|
|
505
505
|
]
|
|
@@ -520,15 +520,15 @@ function AddAddressTile({ onClick }) {
|
|
|
520
520
|
return /* @__PURE__ */ jsxs("button", {
|
|
521
521
|
type: "button",
|
|
522
522
|
onClick,
|
|
523
|
-
className: "group ring-dashed ring-
|
|
523
|
+
className: "group ring-dashed ring-border text-muted-foreground hover:bg-background hover:text-foreground flex min-h-37 flex-col items-center justify-center gap-1.5 rounded-2xl bg-transparent ring-1 transition-colors",
|
|
524
524
|
children: [/* @__PURE__ */ jsx("div", {
|
|
525
|
-
className: "ring-
|
|
525
|
+
className: "ring-border flex size-9 items-center justify-center rounded-full bg-transparent ring-1",
|
|
526
526
|
children: /* @__PURE__ */ jsx(Plus, {
|
|
527
527
|
className: "size-4",
|
|
528
528
|
strokeWidth: 2.25
|
|
529
529
|
})
|
|
530
530
|
}), /* @__PURE__ */ jsx("div", {
|
|
531
|
-
className: "text-
|
|
531
|
+
className: "text-foreground text-sm font-bold",
|
|
532
532
|
children: t("add_an_address")
|
|
533
533
|
})]
|
|
534
534
|
});
|
|
@@ -581,10 +581,10 @@ function SocialRow({ entry, handle, isLast, onConnect }) {
|
|
|
581
581
|
const { t } = useProfileTranslation();
|
|
582
582
|
const Icon = entry.icon;
|
|
583
583
|
return /* @__PURE__ */ jsxs("div", {
|
|
584
|
-
className: `flex items-center gap-3 px-4 py-3.5 ${isLast ? "" : "border-
|
|
584
|
+
className: `flex items-center gap-3 px-4 py-3.5 ${isLast ? "" : "border-border border-b"}`,
|
|
585
585
|
children: [
|
|
586
586
|
/* @__PURE__ */ jsx("div", {
|
|
587
|
-
className: "bg-
|
|
587
|
+
className: "bg-muted text-foreground flex size-9 shrink-0 items-center justify-center rounded-full",
|
|
588
588
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
589
589
|
className: "size-4",
|
|
590
590
|
strokeWidth: 2
|
|
@@ -593,10 +593,10 @@ function SocialRow({ entry, handle, isLast, onConnect }) {
|
|
|
593
593
|
/* @__PURE__ */ jsxs("div", {
|
|
594
594
|
className: "min-w-0 flex-1",
|
|
595
595
|
children: [/* @__PURE__ */ jsx("div", {
|
|
596
|
-
className: "text-
|
|
596
|
+
className: "text-foreground text-sm font-bold",
|
|
597
597
|
children: entry.label
|
|
598
598
|
}), /* @__PURE__ */ jsx("div", {
|
|
599
|
-
className: `text-
|
|
599
|
+
className: `truncate text-xs ${handle ? "text-muted-foreground" : "text-muted-foreground/55"}`,
|
|
600
600
|
children: handle || entry.placeholder
|
|
601
601
|
})]
|
|
602
602
|
}),
|
|
@@ -1253,4 +1253,4 @@ const profileScreenPropertySchema = {
|
|
|
1253
1253
|
//#endregion
|
|
1254
1254
|
export { profileScreenPropertySchema as n, ProfileScreen as t };
|
|
1255
1255
|
|
|
1256
|
-
//# sourceMappingURL=ProfileScreen-
|
|
1256
|
+
//# sourceMappingURL=ProfileScreen-8hi-vFLY.mjs.map
|