@fluid-app/portal-sdk 0.1.329 → 0.1.331
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/{AddressAutocompleteInput-leBDp2QP.mjs → AddressAutocompleteInput-B4QUyriE.mjs} +2 -2
- package/dist/{AddressAutocompleteInput-leBDp2QP.mjs.map → AddressAutocompleteInput-B4QUyriE.mjs.map} +1 -1
- package/dist/{AddressAutocompleteInput-OeoCHhht.cjs → AddressAutocompleteInput-BXV2YUSW.cjs} +2 -2
- package/dist/{AddressAutocompleteInput-OeoCHhht.cjs.map → AddressAutocompleteInput-BXV2YUSW.cjs.map} +1 -1
- package/dist/{FluidProvider-CBDJKNe2.mjs → FluidProvider-BE1Hdi2t.mjs} +18 -31
- package/dist/{FluidProvider-CBDJKNe2.mjs.map → FluidProvider-BE1Hdi2t.mjs.map} +1 -1
- package/dist/{FluidProvider-B3i7W5r6.cjs → FluidProvider-oJ9T5vGw.cjs} +18 -31
- package/dist/{FluidProvider-B3i7W5r6.cjs.map → FluidProvider-oJ9T5vGw.cjs.map} +1 -1
- package/dist/{MessagingScreen-DzO47icg.cjs → MessagingScreen-B75EKbAg.cjs} +4 -4
- package/dist/{MessagingScreen-8gH4_8Qn.cjs → MessagingScreen-BY9mQUbs.cjs} +2 -2
- package/dist/{MessagingScreen-8gH4_8Qn.cjs.map → MessagingScreen-BY9mQUbs.cjs.map} +1 -1
- package/dist/{MessagingScreen-Cvj6VEFX.mjs → MessagingScreen-C_HMSI4y.mjs} +4 -4
- package/dist/{MessagingScreen-hXzE3QsO.mjs → MessagingScreen-Cp2JuwAz.mjs} +2 -2
- package/dist/{MessagingScreen-hXzE3QsO.mjs.map → MessagingScreen-Cp2JuwAz.mjs.map} +1 -1
- package/dist/{NestedWidget-4_u-kg10.cjs → NestedWidget-CM_j40H1.cjs} +1 -1
- package/dist/{NestedWidget-C8Kf_ohj.mjs → NestedWidget-D7e-UXsd.mjs} +2 -2
- package/dist/NestedWidget-D7e-UXsd.mjs.map +1 -0
- package/dist/{NestedWidget-C0A3Yh-L.cjs → NestedWidget-DHJ8FtNT.cjs} +2 -2
- package/dist/NestedWidget-DHJ8FtNT.cjs.map +1 -0
- package/dist/{OrdersScreen-DOKioXA1.mjs → OrdersScreen-BXzEBvpn.mjs} +2 -2
- package/dist/{OrdersScreen-DOKioXA1.mjs.map → OrdersScreen-BXzEBvpn.mjs.map} +1 -1
- package/dist/{OrdersScreen-vzsgsT2m.mjs → OrdersScreen-BxxoGTX0.mjs} +4 -4
- package/dist/{OrdersScreen-Cx1OY3MV.cjs → OrdersScreen-CvH7V42n.cjs} +2 -2
- package/dist/{OrdersScreen-Cx1OY3MV.cjs.map → OrdersScreen-CvH7V42n.cjs.map} +1 -1
- package/dist/{OrdersScreen-D9DSeLdd.cjs → OrdersScreen-wBNs-9sk.cjs} +4 -4
- package/dist/{PointsWidget-BTteH_l8.cjs → PointsWidget-Bgq6UN10.cjs} +52 -46
- package/dist/PointsWidget-Bgq6UN10.cjs.map +1 -0
- package/dist/{PointsWidget-BylUmQaD.mjs → PointsWidget-DapuzCqJ.mjs} +52 -46
- package/dist/PointsWidget-DapuzCqJ.mjs.map +1 -0
- package/dist/{ProfileScreen-8qR5Arcn.mjs → ProfileScreen-BI2TvtW5.mjs} +3 -3
- package/dist/{ProfileScreen-8qR5Arcn.mjs.map → ProfileScreen-BI2TvtW5.mjs.map} +1 -1
- package/dist/{ProfileScreen-DnHX27eN.cjs → ProfileScreen-BQXaOOBf.cjs} +5 -5
- package/dist/{ProfileScreen-a6QvOC34.cjs → ProfileScreen-BpXh5uBC.cjs} +3 -3
- package/dist/{ProfileScreen-a6QvOC34.cjs.map → ProfileScreen-BpXh5uBC.cjs.map} +1 -1
- package/dist/{ProfileScreen-BtG3QUQv.mjs → ProfileScreen-D8uAA9tj.mjs} +5 -5
- package/dist/{ShopScreen-CFp1repr.cjs → ShopScreen-BxL2gs2V.cjs} +2 -2
- package/dist/{ShopScreen-CFp1repr.cjs.map → ShopScreen-BxL2gs2V.cjs.map} +1 -1
- package/dist/{ShopScreen-CTV4VXIA.cjs → ShopScreen-DZYg6avN.cjs} +4 -4
- package/dist/{ShopScreen-CzGIP7Ph.mjs → ShopScreen-QqBNmROr.mjs} +4 -4
- package/dist/{ShopScreen-CwAk1xnj.mjs → ShopScreen-RJlL_JAo.mjs} +2 -2
- package/dist/{ShopScreen-CwAk1xnj.mjs.map → ShopScreen-RJlL_JAo.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-m_Twvgig.mjs → SubscriptionsScreen-B8MGpndR.mjs} +3 -3
- package/dist/{SubscriptionsScreen-m_Twvgig.mjs.map → SubscriptionsScreen-B8MGpndR.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-E0xol7Ss.cjs → SubscriptionsScreen-Blcd3Mik.cjs} +3 -3
- package/dist/{SubscriptionsScreen-E0xol7Ss.cjs.map → SubscriptionsScreen-Blcd3Mik.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-DDtRahaJ.cjs → SubscriptionsScreen-C5DlcNX5.cjs} +5 -5
- package/dist/{SubscriptionsScreen-DCk0ncIA.mjs → SubscriptionsScreen-bM2HM5SD.mjs} +5 -5
- package/dist/index.cjs +19 -19
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +19 -19
- package/package.json +14 -14
- package/dist/NestedWidget-C0A3Yh-L.cjs.map +0 -1
- package/dist/NestedWidget-C8Kf_ohj.mjs.map +0 -1
- package/dist/PointsWidget-BTteH_l8.cjs.map +0 -1
- package/dist/PointsWidget-BylUmQaD.mjs.map +0 -1
|
@@ -17,27 +17,31 @@ const PREVIEW_DATA = {
|
|
|
17
17
|
entries: [
|
|
18
18
|
{
|
|
19
19
|
id: 1,
|
|
20
|
-
description: "Purchase March 3rd",
|
|
21
20
|
amount: 20,
|
|
22
|
-
createdAt: daysAgo(3)
|
|
21
|
+
createdAt: daysAgo(3),
|
|
22
|
+
transactionType: "new_order",
|
|
23
|
+
hasSource: true
|
|
23
24
|
},
|
|
24
25
|
{
|
|
25
26
|
id: 2,
|
|
26
|
-
description: "Referral Bonus",
|
|
27
27
|
amount: 50,
|
|
28
|
-
createdAt: daysAgo(14)
|
|
28
|
+
createdAt: daysAgo(14),
|
|
29
|
+
transactionType: "referral_bonus",
|
|
30
|
+
hasSource: true
|
|
29
31
|
},
|
|
30
32
|
{
|
|
31
33
|
id: 3,
|
|
32
|
-
description: "Points Redemption",
|
|
33
34
|
amount: -75,
|
|
34
|
-
createdAt: daysAgo(60)
|
|
35
|
+
createdAt: daysAgo(60),
|
|
36
|
+
transactionType: null,
|
|
37
|
+
hasSource: true
|
|
35
38
|
},
|
|
36
39
|
{
|
|
37
40
|
id: 4,
|
|
38
|
-
description: "Welcome Reward",
|
|
39
41
|
amount: 30,
|
|
40
|
-
createdAt: daysAgo(90)
|
|
42
|
+
createdAt: daysAgo(90),
|
|
43
|
+
transactionType: "welcome_reward",
|
|
44
|
+
hasSource: true
|
|
41
45
|
}
|
|
42
46
|
]
|
|
43
47
|
};
|
|
@@ -68,45 +72,45 @@ var PointsWidget_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
68
72
|
PointsWidget: () => PointsWidget,
|
|
69
73
|
pointsWidgetPropertySchema: () => pointsWidgetPropertySchema
|
|
70
74
|
});
|
|
71
|
-
const formatRelativeTime = (dateString) => {
|
|
72
|
-
const now = /* @__PURE__ */ new Date();
|
|
73
|
-
const date = new Date(dateString);
|
|
74
|
-
const diffMs = now.getTime() - date.getTime();
|
|
75
|
-
const diffDays = Math.floor(diffMs / 864e5);
|
|
76
|
-
if (diffDays < 1) return "Today";
|
|
77
|
-
if (diffDays === 1) return "1 day ago";
|
|
78
|
-
if (diffDays < 7) return `${diffDays} days ago`;
|
|
79
|
-
if (diffDays < 14) return "1 week ago";
|
|
80
|
-
if (diffDays < 30) return `${Math.floor(diffDays / 7)} weeks ago`;
|
|
81
|
-
if (diffDays < 60) return "1 month ago";
|
|
82
|
-
return `${Math.floor(diffDays / 30)} months ago`;
|
|
83
|
-
};
|
|
84
75
|
const formatBalance = (balance) => {
|
|
85
76
|
return balance.toLocaleString("en-US");
|
|
86
77
|
};
|
|
87
|
-
function
|
|
88
|
-
|
|
78
|
+
function formatTransactionType(entry) {
|
|
79
|
+
if (entry.transactionType) return entry.transactionType.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
80
|
+
if (entry.hasSource) return entry.amount > 0 ? "Points Awarded" : "Points Redeemed";
|
|
81
|
+
return "Transaction";
|
|
82
|
+
}
|
|
83
|
+
function formatEntryDate(dateString) {
|
|
84
|
+
if (!dateString) return "";
|
|
85
|
+
return new Date(dateString).toLocaleDateString(void 0, {
|
|
86
|
+
month: "short",
|
|
87
|
+
day: "numeric",
|
|
88
|
+
year: "numeric"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function PointsEntryRow({ entry, isLast, textColor, accentColor, backgroundColor }) {
|
|
92
|
+
const isPositive = entry.amount >= 0;
|
|
93
|
+
const prefix = isPositive ? "+" : "";
|
|
89
94
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
90
|
-
className: "flex
|
|
95
|
+
className: "flex flex-row items-stretch gap-3",
|
|
91
96
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
92
|
-
className: "
|
|
93
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
className:
|
|
98
|
-
children:
|
|
97
|
+
className: "relative flex w-2 flex-col items-center",
|
|
98
|
+
children: [!isLast && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `bg-${textColor}/40 absolute top-3 -bottom-3 left-1/2 w-px -translate-x-1/2` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `border-${textColor}/60 bg-${backgroundColor} relative mt-3 h-2 w-2 shrink-0 rounded-full border` })]
|
|
99
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
100
|
+
className: "flex flex-1 flex-row items-start justify-between py-1.5",
|
|
101
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
102
|
+
className: "flex min-w-0 flex-col",
|
|
103
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
104
|
+
className: `text-sm font-medium text-${textColor} truncate`,
|
|
105
|
+
children: formatTransactionType(entry)
|
|
106
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
107
|
+
className: `text-sm text-${textColor} opacity-70`,
|
|
108
|
+
children: formatEntryDate(entry.createdAt)
|
|
109
|
+
})]
|
|
110
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
111
|
+
className: `text-sm font-medium ${isPositive ? `text-${accentColor}` : "text-destructive"}`,
|
|
112
|
+
children: [prefix, entry.amount.toLocaleString("en-US")]
|
|
99
113
|
})]
|
|
100
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
101
|
-
className: `bg-${accentColor}/20 shrink-0 rounded-md px-1.5`,
|
|
102
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
103
|
-
className: `text-xs font-medium text-${accentColor} opacity-70`,
|
|
104
|
-
children: [
|
|
105
|
-
sign,
|
|
106
|
-
Math.abs(entry.amount).toLocaleString("en-US"),
|
|
107
|
-
"pts"
|
|
108
|
-
]
|
|
109
|
-
})
|
|
110
114
|
})]
|
|
111
115
|
});
|
|
112
116
|
}
|
|
@@ -160,11 +164,13 @@ function PointsWidget({ titleEnabled = true, title = "Points", titleFontSize = "
|
|
|
160
164
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `bg-${textColor}/20 h-px w-full` }),
|
|
161
165
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
162
166
|
id: historyPanelId,
|
|
163
|
-
className: `flex flex-col
|
|
164
|
-
children: data.entries.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PointsEntryRow, {
|
|
167
|
+
className: `flex flex-col ${!historyOpen ? "hidden" : ""}`,
|
|
168
|
+
children: data.entries.map((entry, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PointsEntryRow, {
|
|
165
169
|
entry,
|
|
170
|
+
isLast: index === data.entries.length - 1,
|
|
166
171
|
textColor,
|
|
167
|
-
accentColor
|
|
172
|
+
accentColor,
|
|
173
|
+
backgroundColor
|
|
168
174
|
}, entry.id))
|
|
169
175
|
})
|
|
170
176
|
]
|
|
@@ -252,7 +258,7 @@ const pointsWidgetPropertySchema = {
|
|
|
252
258
|
require_registries.getColorField({
|
|
253
259
|
key: "accentColor",
|
|
254
260
|
label: "Accent Color",
|
|
255
|
-
description: "Color for points
|
|
261
|
+
description: "Color for positive points amounts",
|
|
256
262
|
defaultValue: "primary",
|
|
257
263
|
group: "Design"
|
|
258
264
|
}),
|
|
@@ -312,4 +318,4 @@ Object.defineProperty(exports, "pointsWidgetPropertySchema", {
|
|
|
312
318
|
}
|
|
313
319
|
});
|
|
314
320
|
|
|
315
|
-
//# sourceMappingURL=PointsWidget-
|
|
321
|
+
//# sourceMappingURL=PointsWidget-Bgq6UN10.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointsWidget-Bgq6UN10.cjs","names":["useWidgetsApi","useWidgetPreviewContext","useDataSourceRegistryConfig","borderWidthClasses","borderColorClasses","ErrorState","Coins","ChevronDown","getFontSizeField","getColorField","getPaddingField","getBorderRadiusField","getBorderWidthField","getBorderColorField"],"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 amount: 20,\n createdAt: daysAgo(3),\n transactionType: \"new_order\",\n hasSource: true,\n },\n {\n id: 2,\n amount: 50,\n createdAt: daysAgo(14),\n transactionType: \"referral_bonus\",\n hasSource: true,\n },\n {\n id: 3,\n amount: -75,\n createdAt: daysAgo(60),\n transactionType: null,\n hasSource: true,\n },\n {\n id: 4,\n amount: 30,\n createdAt: daysAgo(90),\n transactionType: \"welcome_reward\",\n hasSource: true,\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 formatBalance = (balance: number): string => {\n return balance.toLocaleString(\"en-US\");\n};\n\nfunction formatTransactionType(entry: PointsEntry): string {\n if (entry.transactionType) {\n return entry.transactionType\n .split(\"_\")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n }\n if (entry.hasSource) {\n return entry.amount > 0 ? \"Points Awarded\" : \"Points Redeemed\";\n }\n return \"Transaction\";\n}\n\nfunction formatEntryDate(dateString: string): string {\n if (!dateString) return \"\";\n const date = new Date(dateString);\n return date.toLocaleDateString(undefined, {\n month: \"short\",\n day: \"numeric\",\n year: \"numeric\",\n });\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 isLast,\n textColor,\n accentColor,\n backgroundColor,\n}: {\n entry: PointsEntry;\n isLast: boolean;\n textColor: ColorOptions;\n accentColor: ColorOptions;\n backgroundColor: ColorOptions;\n}) {\n const isPositive = entry.amount >= 0;\n const prefix = isPositive ? \"+\" : \"\";\n return (\n <div className=\"flex flex-row items-stretch gap-3\">\n <div className=\"relative flex w-2 flex-col items-center\">\n {!isLast && (\n <div\n className={`bg-${textColor}/40 absolute top-3 -bottom-3 left-1/2 w-px -translate-x-1/2`}\n />\n )}\n <div\n className={`border-${textColor}/60 bg-${backgroundColor} relative mt-3 h-2 w-2 shrink-0 rounded-full border`}\n />\n </div>\n <div className=\"flex flex-1 flex-row items-start justify-between py-1.5\">\n <div className=\"flex min-w-0 flex-col\">\n <div className={`text-sm font-medium text-${textColor} truncate`}>\n {formatTransactionType(entry)}\n </div>\n <div className={`text-sm text-${textColor} opacity-70`}>\n {formatEntryDate(entry.createdAt)}\n </div>\n </div>\n <div\n className={`text-sm font-medium ${isPositive ? `text-${accentColor}` : \"text-destructive\"}`}\n >\n {prefix}\n {entry.amount.toLocaleString(\"en-US\")}\n </div>\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 ${!historyOpen ? \"hidden\" : \"\"}`}\n >\n {data.entries.map((entry, index) => (\n <PointsEntryRow\n key={entry.id}\n entry={entry}\n isLast={index === data.entries.length - 1}\n textColor={textColor}\n accentColor={accentColor}\n backgroundColor={backgroundColor}\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 positive points amounts\",\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,QAAQ;GACR,WAAW,QAAQ,EAAE;GACrB,iBAAiB;GACjB,WAAW;GACZ;EACD;GACE,IAAI;GACJ,QAAQ;GACR,WAAW,QAAQ,GAAG;GACtB,iBAAiB;GACjB,WAAW;GACZ;EACD;GACE,IAAI;GACJ,QAAQ;GACR,WAAW,QAAQ,GAAG;GACtB,iBAAiB;GACjB,WAAW;GACZ;EACD;GACE,IAAI;GACJ,QAAQ;GACR,WAAW,QAAQ,GAAG;GACtB,iBAAiB;GACjB,WAAW;GACZ;EACF;CACF;;;AC5BD,MAAa,0BAA0B;AAEvC,SAAgB,kBAAqD;CACnE,MAAM,aAAa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AC;EACF;GACE,KAAK;GACL,MAAM;GACN,OAAO;GAEP,OAAO;GACR;EACDC,mBAAAA,gBAAgB;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR,CAAC;EACFC,mBAAAA,qBAAqB;GACnB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR,CAAC;EACFC,mBAAAA,oBAAoB;GAClB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR,CAAC;EACFC,mBAAAA,oBAAoB;GAClB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GAEd,OAAO;GACR,CAAC;EACH;CACF"}
|
|
@@ -17,27 +17,31 @@ const PREVIEW_DATA = {
|
|
|
17
17
|
entries: [
|
|
18
18
|
{
|
|
19
19
|
id: 1,
|
|
20
|
-
description: "Purchase March 3rd",
|
|
21
20
|
amount: 20,
|
|
22
|
-
createdAt: daysAgo(3)
|
|
21
|
+
createdAt: daysAgo(3),
|
|
22
|
+
transactionType: "new_order",
|
|
23
|
+
hasSource: true
|
|
23
24
|
},
|
|
24
25
|
{
|
|
25
26
|
id: 2,
|
|
26
|
-
description: "Referral Bonus",
|
|
27
27
|
amount: 50,
|
|
28
|
-
createdAt: daysAgo(14)
|
|
28
|
+
createdAt: daysAgo(14),
|
|
29
|
+
transactionType: "referral_bonus",
|
|
30
|
+
hasSource: true
|
|
29
31
|
},
|
|
30
32
|
{
|
|
31
33
|
id: 3,
|
|
32
|
-
description: "Points Redemption",
|
|
33
34
|
amount: -75,
|
|
34
|
-
createdAt: daysAgo(60)
|
|
35
|
+
createdAt: daysAgo(60),
|
|
36
|
+
transactionType: null,
|
|
37
|
+
hasSource: true
|
|
35
38
|
},
|
|
36
39
|
{
|
|
37
40
|
id: 4,
|
|
38
|
-
description: "Welcome Reward",
|
|
39
41
|
amount: 30,
|
|
40
|
-
createdAt: daysAgo(90)
|
|
42
|
+
createdAt: daysAgo(90),
|
|
43
|
+
transactionType: "welcome_reward",
|
|
44
|
+
hasSource: true
|
|
41
45
|
}
|
|
42
46
|
]
|
|
43
47
|
};
|
|
@@ -68,45 +72,45 @@ var PointsWidget_exports = /* @__PURE__ */ __exportAll({
|
|
|
68
72
|
PointsWidget: () => PointsWidget,
|
|
69
73
|
pointsWidgetPropertySchema: () => pointsWidgetPropertySchema
|
|
70
74
|
});
|
|
71
|
-
const formatRelativeTime = (dateString) => {
|
|
72
|
-
const now = /* @__PURE__ */ new Date();
|
|
73
|
-
const date = new Date(dateString);
|
|
74
|
-
const diffMs = now.getTime() - date.getTime();
|
|
75
|
-
const diffDays = Math.floor(diffMs / 864e5);
|
|
76
|
-
if (diffDays < 1) return "Today";
|
|
77
|
-
if (diffDays === 1) return "1 day ago";
|
|
78
|
-
if (diffDays < 7) return `${diffDays} days ago`;
|
|
79
|
-
if (diffDays < 14) return "1 week ago";
|
|
80
|
-
if (diffDays < 30) return `${Math.floor(diffDays / 7)} weeks ago`;
|
|
81
|
-
if (diffDays < 60) return "1 month ago";
|
|
82
|
-
return `${Math.floor(diffDays / 30)} months ago`;
|
|
83
|
-
};
|
|
84
75
|
const formatBalance = (balance) => {
|
|
85
76
|
return balance.toLocaleString("en-US");
|
|
86
77
|
};
|
|
87
|
-
function
|
|
88
|
-
|
|
78
|
+
function formatTransactionType(entry) {
|
|
79
|
+
if (entry.transactionType) return entry.transactionType.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
80
|
+
if (entry.hasSource) return entry.amount > 0 ? "Points Awarded" : "Points Redeemed";
|
|
81
|
+
return "Transaction";
|
|
82
|
+
}
|
|
83
|
+
function formatEntryDate(dateString) {
|
|
84
|
+
if (!dateString) return "";
|
|
85
|
+
return new Date(dateString).toLocaleDateString(void 0, {
|
|
86
|
+
month: "short",
|
|
87
|
+
day: "numeric",
|
|
88
|
+
year: "numeric"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function PointsEntryRow({ entry, isLast, textColor, accentColor, backgroundColor }) {
|
|
92
|
+
const isPositive = entry.amount >= 0;
|
|
93
|
+
const prefix = isPositive ? "+" : "";
|
|
89
94
|
return /* @__PURE__ */ jsxs("div", {
|
|
90
|
-
className: "flex
|
|
95
|
+
className: "flex flex-row items-stretch gap-3",
|
|
91
96
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
92
|
-
className: "
|
|
93
|
-
children: [/* @__PURE__ */ jsx("
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
className:
|
|
98
|
-
children:
|
|
97
|
+
className: "relative flex w-2 flex-col items-center",
|
|
98
|
+
children: [!isLast && /* @__PURE__ */ jsx("div", { className: `bg-${textColor}/40 absolute top-3 -bottom-3 left-1/2 w-px -translate-x-1/2` }), /* @__PURE__ */ jsx("div", { className: `border-${textColor}/60 bg-${backgroundColor} relative mt-3 h-2 w-2 shrink-0 rounded-full border` })]
|
|
99
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
100
|
+
className: "flex flex-1 flex-row items-start justify-between py-1.5",
|
|
101
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
102
|
+
className: "flex min-w-0 flex-col",
|
|
103
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
104
|
+
className: `text-sm font-medium text-${textColor} truncate`,
|
|
105
|
+
children: formatTransactionType(entry)
|
|
106
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
107
|
+
className: `text-sm text-${textColor} opacity-70`,
|
|
108
|
+
children: formatEntryDate(entry.createdAt)
|
|
109
|
+
})]
|
|
110
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
111
|
+
className: `text-sm font-medium ${isPositive ? `text-${accentColor}` : "text-destructive"}`,
|
|
112
|
+
children: [prefix, entry.amount.toLocaleString("en-US")]
|
|
99
113
|
})]
|
|
100
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
101
|
-
className: `bg-${accentColor}/20 shrink-0 rounded-md px-1.5`,
|
|
102
|
-
children: /* @__PURE__ */ jsxs("span", {
|
|
103
|
-
className: `text-xs font-medium text-${accentColor} opacity-70`,
|
|
104
|
-
children: [
|
|
105
|
-
sign,
|
|
106
|
-
Math.abs(entry.amount).toLocaleString("en-US"),
|
|
107
|
-
"pts"
|
|
108
|
-
]
|
|
109
|
-
})
|
|
110
114
|
})]
|
|
111
115
|
});
|
|
112
116
|
}
|
|
@@ -160,11 +164,13 @@ function PointsWidget({ titleEnabled = true, title = "Points", titleFontSize = "
|
|
|
160
164
|
/* @__PURE__ */ jsx("div", { className: `bg-${textColor}/20 h-px w-full` }),
|
|
161
165
|
/* @__PURE__ */ jsx("div", {
|
|
162
166
|
id: historyPanelId,
|
|
163
|
-
className: `flex flex-col
|
|
164
|
-
children: data.entries.map((entry) => /* @__PURE__ */ jsx(PointsEntryRow, {
|
|
167
|
+
className: `flex flex-col ${!historyOpen ? "hidden" : ""}`,
|
|
168
|
+
children: data.entries.map((entry, index) => /* @__PURE__ */ jsx(PointsEntryRow, {
|
|
165
169
|
entry,
|
|
170
|
+
isLast: index === data.entries.length - 1,
|
|
166
171
|
textColor,
|
|
167
|
-
accentColor
|
|
172
|
+
accentColor,
|
|
173
|
+
backgroundColor
|
|
168
174
|
}, entry.id))
|
|
169
175
|
})
|
|
170
176
|
]
|
|
@@ -252,7 +258,7 @@ const pointsWidgetPropertySchema = {
|
|
|
252
258
|
getColorField({
|
|
253
259
|
key: "accentColor",
|
|
254
260
|
label: "Accent Color",
|
|
255
|
-
description: "Color for points
|
|
261
|
+
description: "Color for positive points amounts",
|
|
256
262
|
defaultValue: "primary",
|
|
257
263
|
group: "Design"
|
|
258
264
|
}),
|
|
@@ -295,4 +301,4 @@ const pointsWidgetPropertySchema = {
|
|
|
295
301
|
//#endregion
|
|
296
302
|
export { PointsWidget_exports as n, pointsWidgetPropertySchema as r, PointsWidget as t };
|
|
297
303
|
|
|
298
|
-
//# sourceMappingURL=PointsWidget-
|
|
304
|
+
//# sourceMappingURL=PointsWidget-DapuzCqJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointsWidget-DapuzCqJ.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 amount: 20,\n createdAt: daysAgo(3),\n transactionType: \"new_order\",\n hasSource: true,\n },\n {\n id: 2,\n amount: 50,\n createdAt: daysAgo(14),\n transactionType: \"referral_bonus\",\n hasSource: true,\n },\n {\n id: 3,\n amount: -75,\n createdAt: daysAgo(60),\n transactionType: null,\n hasSource: true,\n },\n {\n id: 4,\n amount: 30,\n createdAt: daysAgo(90),\n transactionType: \"welcome_reward\",\n hasSource: true,\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 formatBalance = (balance: number): string => {\n return balance.toLocaleString(\"en-US\");\n};\n\nfunction formatTransactionType(entry: PointsEntry): string {\n if (entry.transactionType) {\n return entry.transactionType\n .split(\"_\")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n }\n if (entry.hasSource) {\n return entry.amount > 0 ? \"Points Awarded\" : \"Points Redeemed\";\n }\n return \"Transaction\";\n}\n\nfunction formatEntryDate(dateString: string): string {\n if (!dateString) return \"\";\n const date = new Date(dateString);\n return date.toLocaleDateString(undefined, {\n month: \"short\",\n day: \"numeric\",\n year: \"numeric\",\n });\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 isLast,\n textColor,\n accentColor,\n backgroundColor,\n}: {\n entry: PointsEntry;\n isLast: boolean;\n textColor: ColorOptions;\n accentColor: ColorOptions;\n backgroundColor: ColorOptions;\n}) {\n const isPositive = entry.amount >= 0;\n const prefix = isPositive ? \"+\" : \"\";\n return (\n <div className=\"flex flex-row items-stretch gap-3\">\n <div className=\"relative flex w-2 flex-col items-center\">\n {!isLast && (\n <div\n className={`bg-${textColor}/40 absolute top-3 -bottom-3 left-1/2 w-px -translate-x-1/2`}\n />\n )}\n <div\n className={`border-${textColor}/60 bg-${backgroundColor} relative mt-3 h-2 w-2 shrink-0 rounded-full border`}\n />\n </div>\n <div className=\"flex flex-1 flex-row items-start justify-between py-1.5\">\n <div className=\"flex min-w-0 flex-col\">\n <div className={`text-sm font-medium text-${textColor} truncate`}>\n {formatTransactionType(entry)}\n </div>\n <div className={`text-sm text-${textColor} opacity-70`}>\n {formatEntryDate(entry.createdAt)}\n </div>\n </div>\n <div\n className={`text-sm font-medium ${isPositive ? `text-${accentColor}` : \"text-destructive\"}`}\n >\n {prefix}\n {entry.amount.toLocaleString(\"en-US\")}\n </div>\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 ${!historyOpen ? \"hidden\" : \"\"}`}\n >\n {data.entries.map((entry, index) => (\n <PointsEntryRow\n key={entry.id}\n entry={entry}\n isLast={index === data.entries.length - 1}\n textColor={textColor}\n accentColor={accentColor}\n backgroundColor={backgroundColor}\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 positive points amounts\",\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,QAAQ;GACR,WAAW,QAAQ,EAAE;GACrB,iBAAiB;GACjB,WAAW;GACZ;EACD;GACE,IAAI;GACJ,QAAQ;GACR,WAAW,QAAQ,GAAG;GACtB,iBAAiB;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
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { gt as useAccountApi } from "./PortalTenantClientProvider-CqW6ae2M.mjs";
|
|
2
|
-
import { B as useLanguagesApi, V as usePayApi, n as useFluidContext } from "./FluidProvider-
|
|
2
|
+
import { B as useLanguagesApi, V as usePayApi, n as useFluidContext } from "./FluidProvider-BE1Hdi2t.mjs";
|
|
3
3
|
import { n as useCountriesApi } from "./countries-api-context-DScC_39w.mjs";
|
|
4
4
|
import { On as useZodForm, Q as DialogContent, R as Label, X as Dialog, et as DialogFooter, f as fluidToast, fn as BreadcrumbList, it as DialogTitle, k as Input, ln as Breadcrumb, pn as BreadcrumbPage, tt as DialogHeader, un as BreadcrumbItem, wn as Button } from "./src-DC5QoBhR.mjs";
|
|
5
5
|
import { n as ScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-Dn12BZyj.mjs";
|
|
6
6
|
import { n as payKeys, r as storeKeys, t as accountKeys } from "./query-keys-BkMRwfNo.mjs";
|
|
7
7
|
import { t as useAccount } from "./use-account-BqNRv6m6.mjs";
|
|
8
|
-
import { a as AddressFormDialog, d as UserInfoDialog, f as ConfirmActionDialog, h as useProfileTranslation, i as CreditCardFormDialog, m as ProfileTranslationBridge, n as createFluidPayApiAdapter, o as EditPaymentMethodDialog, p as EllipsesDropdown, r as mapToFluidPayPaymentMethod, s as FluidPayCoreProvider, t as AddressAutocompleteInput } from "./AddressAutocompleteInput-
|
|
8
|
+
import { a as AddressFormDialog, d as UserInfoDialog, f as ConfirmActionDialog, h as useProfileTranslation, i as CreditCardFormDialog, m as ProfileTranslationBridge, n as createFluidPayApiAdapter, o as EditPaymentMethodDialog, p as EllipsesDropdown, r as mapToFluidPayPaymentMethod, s as FluidPayCoreProvider, t as AddressAutocompleteInput } from "./AddressAutocompleteInput-B4QUyriE.mjs";
|
|
9
9
|
import { f as usePortalUpdateSettings, s as usePortalMySiteProfile } from "./use-mysite-portal-DyB9666K.mjs";
|
|
10
10
|
import { useCallback, useMemo, useState } from "react";
|
|
11
11
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
@@ -1350,4 +1350,4 @@ const profileScreenPropertySchema = {
|
|
|
1350
1350
|
//#endregion
|
|
1351
1351
|
export { profileScreenPropertySchema as n, ProfileScreen as t };
|
|
1352
1352
|
|
|
1353
|
-
//# sourceMappingURL=ProfileScreen-
|
|
1353
|
+
//# sourceMappingURL=ProfileScreen-BI2TvtW5.mjs.map
|