@burdenoff/microfe-billing 2026.526.1 → 2026.528.1
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/billing/BillingAdminRoutes.js +1 -1
- package/dist/billing/BillingAdminRoutes.js.map +1 -1
- package/dist/billing/BillingUserRoutes.js +1 -1
- package/dist/billing/BillingUserRoutes.js.map +1 -1
- package/dist/billing/modules/addons/components/FloatingCartDrawer.js +15 -8
- package/dist/billing/modules/addons/components/FloatingCartDrawer.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +13 -6
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonCreatePage.js +1 -1
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonDetailPage.js +8 -4
- package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js +3 -2
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +44 -23
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsListPage.js +60 -31
- package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +9 -9
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +8 -8
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +16 -10
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +24 -16
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +5 -1
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js +46 -29
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/TransactionsPage.js +34 -22
- package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
- package/dist/billing/modules/checkout/components/BillingAccountSelector.js +10 -10
- package/dist/billing/modules/checkout/components/BillingAccountSelector.js.map +1 -1
- package/dist/billing/modules/checkout/components/CreditsAmountInput.js +3 -3
- package/dist/billing/modules/checkout/components/CreditsAmountInput.js.map +1 -1
- package/dist/billing/modules/checkout/components/NativeCheckoutView.js +7 -0
- package/dist/billing/modules/checkout/components/NativeCheckoutView.js.map +1 -1
- package/dist/billing/modules/checkout/components/OrderSummary.js +13 -13
- package/dist/billing/modules/checkout/components/OrderSummary.js.map +1 -1
- package/dist/billing/modules/checkout/components/PromoCodeInput.js +5 -5
- package/dist/billing/modules/checkout/components/PromoCodeInput.js.map +1 -1
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.js +5 -5
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.js.map +1 -1
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.js +4 -4
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.js.map +1 -1
- package/dist/billing/modules/checkout/components/StripePaymentForm.js +11 -11
- package/dist/billing/modules/checkout/components/StripePaymentForm.js.map +1 -1
- package/dist/billing/modules/checkout/components/SubscriptionSelector.js +3 -3
- package/dist/billing/modules/checkout/components/SubscriptionSelector.js.map +1 -1
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.js +8 -8
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.js.map +1 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +61 -52
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js +22 -15
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +30 -21
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +9 -8
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +11 -8
- package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +1 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +22 -17
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +15 -8
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +17 -11
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.js +15 -11
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.js.map +1 -1
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js +21 -17
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js.map +1 -1
- package/dist/billing/modules/dashboard/components/BillingAccountCard.js +14 -11
- package/dist/billing/modules/dashboard/components/BillingAccountCard.js.map +1 -1
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js +32 -26
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.js +14 -10
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.js.map +1 -1
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.js +18 -11
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.js.map +1 -1
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +44 -32
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +35 -26
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +15 -15
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +11 -11
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +5 -5
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +9 -4
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +1 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanDetailPage.js +13 -8
- package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js +3 -2
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js +14 -7
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansListPage.js +23 -9
- package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaPage.js +11 -7
- package/dist/billing/modules/quota/pages/QuotaPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +3 -3
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +6 -2
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +5 -4
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +26 -12
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/SettingsPage.js +356 -349
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +157 -123
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.js +13 -8
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +15 -7
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +30 -20
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +25 -16
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +50 -34
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/dist/billing/shared/components/AccessDenied.js +2 -2
- package/dist/billing/shared/components/AccessDenied.js.map +1 -1
- package/dist/billing/shared/components/ActorIdentity.js +67 -0
- package/dist/billing/shared/components/ActorIdentity.js.map +1 -0
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.js +6 -2
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.js.map +1 -1
- package/dist/billing/shared/components/EmptyState.js +7 -21
- package/dist/billing/shared/components/EmptyState.js.map +1 -1
- package/dist/billing/shared/components/PageHeader.js +7 -19
- package/dist/billing/shared/components/PageHeader.js.map +1 -1
- package/dist/billing/shared/components/ServerError.js +5 -4
- package/dist/billing/shared/components/ServerError.js.map +1 -1
- package/dist/billing/shared/components/index.js +1 -0
- package/dist/billing/shared/hooks/index.js +1 -0
- package/dist/billing/shared/hooks/useActorProfiles.js +113 -0
- package/dist/billing/shared/hooks/useActorProfiles.js.map +1 -0
- package/package.json +2 -2
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import { jsx as e
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { PageHeader as t } from "@burdenoff/fe-libs/chrome";
|
|
2
3
|
//#region src/billing/shared/components/PageHeader.tsx
|
|
3
|
-
var n = ({ title: n, description: r, actions: i, icon: a }) => /* @__PURE__ */ t
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
className: "mt-1 text-muted-foreground",
|
|
9
|
-
children: a
|
|
10
|
-
}), /* @__PURE__ */ t("div", { children: [/* @__PURE__ */ e("h1", {
|
|
11
|
-
className: "text-2xl font-bold text-foreground",
|
|
12
|
-
children: n
|
|
13
|
-
}), r && /* @__PURE__ */ e("p", {
|
|
14
|
-
className: "text-sm text-muted-foreground mt-1",
|
|
15
|
-
children: r
|
|
16
|
-
})] })]
|
|
17
|
-
}), i && /* @__PURE__ */ e("div", {
|
|
18
|
-
className: "flex items-center gap-2",
|
|
19
|
-
children: i
|
|
20
|
-
})]
|
|
4
|
+
var n = ({ title: n, description: r, actions: i, icon: a }) => /* @__PURE__ */ e(t, {
|
|
5
|
+
title: n,
|
|
6
|
+
description: r,
|
|
7
|
+
actions: i,
|
|
8
|
+
icon: a
|
|
21
9
|
});
|
|
22
10
|
//#endregion
|
|
23
11
|
export { n as PageHeader };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeader.js","names":[],"sources":["../../../../src/billing/shared/components/PageHeader.tsx"],"sourcesContent":["/**\n * Shared Page Header Component\n *
|
|
1
|
+
{"version":3,"file":"PageHeader.js","names":[],"sources":["../../../../src/billing/shared/components/PageHeader.tsx"],"sourcesContent":["/**\n * Shared Page Header Component\n *\n * Local wrapper around `PageHeader` from `@burdenoff/fe-libs/chrome`.\n * Routes all billing page headers through the canonical primitive so they\n * inherit responsive layout, breadcrumb support, and one-primary-action\n * styling from the design system.\n */\n\nimport type { FC, ReactNode } from 'react';\nimport { PageHeader as CanonicalPageHeader } from '@burdenoff/fe-libs/chrome';\n\ninterface PageHeaderProps {\n title: string;\n description?: string;\n actions?: ReactNode;\n icon?: ReactNode;\n}\n\nexport const PageHeader: FC<PageHeaderProps> = ({ title, description, actions, icon }) => {\n return (\n <CanonicalPageHeader title={title} description={description} actions={actions} icon={icon} />\n );\n};\n"],"mappings":";;;AAmBA,IAAa,KAAmC,EAAE,UAAO,gBAAa,YAAS,cAE3E,kBAAC,GAAD;CAA4B;CAAoB;CAAsB;CAAe;CAAQ,CAAA"}
|
|
@@ -13,9 +13,9 @@ var i = ({ title: i, message: a, onRetry: o, showRetry: s = !0 }) => {
|
|
|
13
13
|
className: "text-center space-y-4 max-w-md",
|
|
14
14
|
children: [
|
|
15
15
|
/* @__PURE__ */ t("div", {
|
|
16
|
-
className: `
|
|
16
|
+
className: `size-16 mx-auto rounded-full ${f.bg} flex items-center justify-center`,
|
|
17
17
|
children: /* @__PURE__ */ t("svg", {
|
|
18
|
-
className: `
|
|
18
|
+
className: `size-8 ${f.icon}`,
|
|
19
19
|
fill: "none",
|
|
20
20
|
viewBox: "0 0 24 24",
|
|
21
21
|
stroke: "currentColor",
|
|
@@ -37,7 +37,7 @@ var i = ({ title: i, message: a, onRetry: o, showRetry: s = !0 }) => {
|
|
|
37
37
|
}),
|
|
38
38
|
/* @__PURE__ */ n("div", {
|
|
39
39
|
className: `inline-flex items-center gap-2 px-3 py-1.5 ${f.bg} rounded-full`,
|
|
40
|
-
children: [/* @__PURE__ */ t("span", { className: `
|
|
40
|
+
children: [/* @__PURE__ */ t("span", { className: `size-2 rounded-full ${f.dot} animate-pulse` }), /* @__PURE__ */ t("span", {
|
|
41
41
|
className: `text-xs font-medium ${f.text}`,
|
|
42
42
|
children: l("billing.serverError.statusOffline", "Server Status: Offline")
|
|
43
43
|
})]
|
|
@@ -45,10 +45,11 @@ var i = ({ title: i, message: a, onRetry: o, showRetry: s = !0 }) => {
|
|
|
45
45
|
s && o && /* @__PURE__ */ t("div", {
|
|
46
46
|
className: "pt-2",
|
|
47
47
|
children: /* @__PURE__ */ n("button", {
|
|
48
|
+
type: "button",
|
|
48
49
|
onClick: o,
|
|
49
50
|
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",
|
|
50
51
|
children: [/* @__PURE__ */ t("svg", {
|
|
51
|
-
className: "
|
|
52
|
+
className: "size-4",
|
|
52
53
|
fill: "none",
|
|
53
54
|
viewBox: "0 0 24 24",
|
|
54
55
|
stroke: "currentColor",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerError.js","names":[],"sources":["../../../../src/billing/shared/components/ServerError.tsx"],"sourcesContent":["/**\n * Shared Server Error Component\n * Displays when backend server is unavailable or returns 500 errors\n */\n\nimport type { FC } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { statusTokens } from '../utils/tokens';\n\ninterface ServerErrorProps {\n title?: string;\n message?: string;\n onRetry?: () => void;\n showRetry?: boolean;\n}\n\nexport const ServerError: FC<ServerErrorProps> = ({\n title,\n message,\n onRetry,\n showRetry = true,\n}) => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n\n const displayTitle = title ?? tr('billing.serverError.title', 'Server Unavailable');\n const displayMessage =\n message ??\n tr(\n 'billing.serverError.message',\n \"We're having trouble connecting to the server. Please try again later.\"\n );\n const errorTokens = statusTokens.error;\n\n return (\n <div className=\"flex items-center justify-center h-full min-h-[400px]\">\n <div className=\"text-center space-y-4 max-w-md\">\n {/* Server Icon */}\n <div\n className={`
|
|
1
|
+
{"version":3,"file":"ServerError.js","names":[],"sources":["../../../../src/billing/shared/components/ServerError.tsx"],"sourcesContent":["/**\n * Shared Server Error Component\n * Displays when backend server is unavailable or returns 500 errors\n */\n\nimport type { FC } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { statusTokens } from '../utils/tokens';\n\ninterface ServerErrorProps {\n title?: string;\n message?: string;\n onRetry?: () => void;\n showRetry?: boolean;\n}\n\nexport const ServerError: FC<ServerErrorProps> = ({\n title,\n message,\n onRetry,\n showRetry = true,\n}) => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n\n const displayTitle = title ?? tr('billing.serverError.title', 'Server Unavailable');\n const displayMessage =\n message ??\n tr(\n 'billing.serverError.message',\n \"We're having trouble connecting to the server. Please try again later.\"\n );\n const errorTokens = statusTokens.error;\n\n return (\n <div className=\"flex items-center justify-center h-full min-h-[400px]\">\n <div className=\"text-center space-y-4 max-w-md\">\n {/* Server Icon */}\n <div\n className={`size-16 mx-auto rounded-full ${errorTokens.bg} flex items-center justify-center`}\n >\n <svg\n className={`size-8 ${errorTokens.icon}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M5.25 14.25h13.5m-13.5 0a3 3 0 01-3-3m3 3a3 3 0 100 6h13.5a3 3 0 100-6m-16.5-3a3 3 0 013-3h13.5a3 3 0 013 3m-19.5 0a4.5 4.5 0 01.9-2.7L5.737 5.1a3.375 3.375 0 012.7-1.35h7.126c1.062 0 2.062.5 2.7 1.35l2.587 3.45a4.5 4.5 0 01.9 2.7m0 0a3 3 0 01-3 3m0 3h.008v.008h-.008v-.008zm0-6h.008v.008h-.008v-.008zm-3 6h.008v.008h-.008v-.008zm0-6h.008v.008h-.008v-.008z\"\n />\n </svg>\n </div>\n\n {/* Error Title */}\n <h2 className=\"text-xl font-semibold text-foreground\">{displayTitle}</h2>\n\n {/* Error Message */}\n <p className=\"text-sm text-muted-foreground\">{displayMessage}</p>\n\n {/* Status Indicator */}\n <div\n className={`inline-flex items-center gap-2 px-3 py-1.5 ${errorTokens.bg} rounded-full`}\n >\n <span className={`size-2 rounded-full ${errorTokens.dot} animate-pulse`} />\n <span className={`text-xs font-medium ${errorTokens.text}`}>\n {tr('billing.serverError.statusOffline', 'Server Status: Offline')}\n </span>\n </div>\n\n {/* Retry Button */}\n {showRetry && onRetry && (\n <div className=\"pt-2\">\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2\"\n >\n <svg\n className=\"size-4\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99\"\n />\n </svg>\n {tr('billing.serverError.tryAgain', 'Try Again')}\n </button>\n </div>\n )}\n\n {/* Additional Help */}\n <p className=\"text-xs text-muted-foreground pt-4\">\n {tr(\n 'billing.serverError.persistHelp',\n 'If this issue persists, please contact support or check the system status page.'\n )}\n </p>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;AAgBA,IAAa,KAAqC,EAChD,UACA,YACA,YACA,eAAY,SACR;CACJ,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAA6B;EACpD,IAAM,IAAa,EAAE,EAAI;AACzB,SAAO,MAAe,IAAM,IAAW;IAGnC,IAAe,KAAS,EAAG,6BAA6B,qBAAqB,EAC7E,IACJ,KACA,EACE,+BACA,yEACD,EACG,IAAc,EAAa;AAEjC,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;GAAK,WAAU;aAAf;IAEE,kBAAC,OAAD;KACE,WAAW,gCAAgC,EAAY,GAAG;eAE1D,kBAAC,OAAD;MACE,WAAW,UAAU,EAAY;MACjC,MAAK;MACL,SAAQ;MACR,QAAO;MACP,aAAa;gBAEb,kBAAC,QAAD;OACE,eAAc;OACd,gBAAe;OACf,GAAE;OACF,CAAA;MACE,CAAA;KACF,CAAA;IAGN,kBAAC,MAAD;KAAI,WAAU;eAAyC;KAAkB,CAAA;IAGzE,kBAAC,KAAD;KAAG,WAAU;eAAiC;KAAmB,CAAA;IAGjE,kBAAC,OAAD;KACE,WAAW,8CAA8C,EAAY,GAAG;eAD1E,CAGE,kBAAC,QAAD,EAAM,WAAW,uBAAuB,EAAY,IAAI,iBAAmB,CAAA,EAC3E,kBAAC,QAAD;MAAM,WAAW,uBAAuB,EAAY;gBACjD,EAAG,qCAAqC,yBAAyB;MAC7D,CAAA,CACH;;IAGL,KAAa,KACZ,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,WAAU;gBAHZ,CAKE,kBAAC,OAAD;OACE,WAAU;OACV,MAAK;OACL,SAAQ;OACR,QAAO;OACP,aAAa;iBAEb,kBAAC,QAAD;QACE,eAAc;QACd,gBAAe;QACf,GAAE;QACF,CAAA;OACE,CAAA,EACL,EAAG,gCAAgC,YAAY,CACzC;;KACL,CAAA;IAIR,kBAAC,KAAD;KAAG,WAAU;eACV,EACC,mCACA,kFACD;KACC,CAAA;IACA;;EACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./useActorProfiles.js";
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useBilling as e } from "../../providers/BillingProvider.js";
|
|
2
|
+
import { directBillingGraphqlRequest as t } from "../utils/directBillingGraphql.js";
|
|
3
|
+
import "../utils/index.js";
|
|
4
|
+
import { useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
5
|
+
//#region src/billing/shared/hooks/useActorProfiles.ts
|
|
6
|
+
var o = "\n query ActorProfileUser($id: ID!) {\n user(id: $id) {\n id\n email\n firstName\n lastName\n name\n username\n avatar\n }\n }\n";
|
|
7
|
+
function s(e) {
|
|
8
|
+
return e.length <= 12 ? e : `${e.slice(0, 8)}…${e.slice(-4)}`;
|
|
9
|
+
}
|
|
10
|
+
function c(e) {
|
|
11
|
+
switch (e.toLowerCase()) {
|
|
12
|
+
case "user": return "User";
|
|
13
|
+
case "app": return "App";
|
|
14
|
+
case "service": return "Service";
|
|
15
|
+
case "super_admin": return "Super Admin";
|
|
16
|
+
default: return e.split("_").map((e) => e.charAt(0) + e.slice(1).toLowerCase()).join(" ");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function l(e) {
|
|
20
|
+
return {
|
|
21
|
+
actorId: e.actorId,
|
|
22
|
+
actorType: e.actorType,
|
|
23
|
+
displayName: e.actorType.toLowerCase() === "user" ? `User ${s(e.actorId)}` : c(e.actorType),
|
|
24
|
+
secondaryLabel: s(e.actorId),
|
|
25
|
+
resolved: !1
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
var u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = 300 * 1e3, p = /* @__PURE__ */ new Map();
|
|
29
|
+
function m(e) {
|
|
30
|
+
let t = p.get(e);
|
|
31
|
+
if (!t || t < Date.now()) {
|
|
32
|
+
u.delete(e), p.delete(e);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
return u.get(e);
|
|
36
|
+
}
|
|
37
|
+
function h(e) {
|
|
38
|
+
u.set(e.actorId, e), p.set(e.actorId, Date.now() + f);
|
|
39
|
+
}
|
|
40
|
+
function g(c) {
|
|
41
|
+
let { authToken: u, apiGatewayUrl: f, orgId: p } = e(), [g, _] = a(() => {
|
|
42
|
+
let e = {};
|
|
43
|
+
for (let t of c) {
|
|
44
|
+
let n = m(t.actorId);
|
|
45
|
+
e[t.actorId] = n ?? l(t);
|
|
46
|
+
}
|
|
47
|
+
return e;
|
|
48
|
+
}), v = r(() => c.map((e) => `${e.actorId}|${e.actorType}`).sort().join(","), [c]), y = i(void 0);
|
|
49
|
+
return n(() => {
|
|
50
|
+
let e = !1;
|
|
51
|
+
y.current = u;
|
|
52
|
+
async function n(e) {
|
|
53
|
+
let n = m(e.actorId);
|
|
54
|
+
if (n?.resolved) return n;
|
|
55
|
+
if (e.actorType.toLowerCase() !== "user") {
|
|
56
|
+
let t = l(e);
|
|
57
|
+
return h(t), t;
|
|
58
|
+
}
|
|
59
|
+
let r = e.actorId, i = d.get(r);
|
|
60
|
+
if (i) return i;
|
|
61
|
+
let a = (async () => {
|
|
62
|
+
try {
|
|
63
|
+
let n = await t({
|
|
64
|
+
apiGatewayUrl: f,
|
|
65
|
+
authToken: u,
|
|
66
|
+
orgId: p,
|
|
67
|
+
query: o,
|
|
68
|
+
variables: { id: e.actorId }
|
|
69
|
+
});
|
|
70
|
+
if (!n.user) {
|
|
71
|
+
let t = l(e);
|
|
72
|
+
return h(t), t;
|
|
73
|
+
}
|
|
74
|
+
let r = n.user, i = r.name?.trim() || [r.firstName, r.lastName].filter(Boolean).join(" ").trim() || r.username?.trim() || r.email?.trim() || `User ${s(e.actorId)}`, a = {
|
|
75
|
+
actorId: e.actorId,
|
|
76
|
+
actorType: e.actorType,
|
|
77
|
+
displayName: i,
|
|
78
|
+
secondaryLabel: r.email ?? s(e.actorId),
|
|
79
|
+
email: r.email ?? void 0,
|
|
80
|
+
avatarUrl: r.avatar ?? void 0,
|
|
81
|
+
resolved: !0
|
|
82
|
+
};
|
|
83
|
+
return h(a), a;
|
|
84
|
+
} catch {
|
|
85
|
+
return l(e);
|
|
86
|
+
} finally {
|
|
87
|
+
d.delete(r);
|
|
88
|
+
}
|
|
89
|
+
})();
|
|
90
|
+
return d.set(r, a), a;
|
|
91
|
+
}
|
|
92
|
+
async function r() {
|
|
93
|
+
let t = await Promise.all(c.map(n));
|
|
94
|
+
e || _((e) => {
|
|
95
|
+
let n = { ...e };
|
|
96
|
+
for (let e of t) n[e.actorId] = e;
|
|
97
|
+
return n;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return r(), () => {
|
|
101
|
+
e = !0;
|
|
102
|
+
};
|
|
103
|
+
}, [
|
|
104
|
+
v,
|
|
105
|
+
u,
|
|
106
|
+
f,
|
|
107
|
+
p
|
|
108
|
+
]), g;
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { g as useActorProfiles };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=useActorProfiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActorProfiles.js","names":[],"sources":["../../../../src/billing/shared/hooks/useActorProfiles.ts"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\nimport { useBilling } from '../../providers/BillingProvider';\nimport { directBillingGraphqlRequest } from '../utils';\n\nexport interface ActorProfile {\n actorId: string;\n actorType: string;\n displayName: string;\n secondaryLabel: string;\n email?: string;\n avatarUrl?: string;\n resolved: boolean;\n}\n\nexport type ActorProfileMap = Record<string, ActorProfile>;\n\ninterface ActorInput {\n actorId: string;\n actorType: string;\n}\n\nconst USER_QUERY = `\n query ActorProfileUser($id: ID!) {\n user(id: $id) {\n id\n email\n firstName\n lastName\n name\n username\n avatar\n }\n }\n`;\n\ninterface UserResponse {\n user: {\n id: string;\n email?: string | null;\n firstName?: string | null;\n lastName?: string | null;\n name?: string | null;\n username?: string | null;\n avatar?: string | null;\n } | null;\n}\n\nfunction shortId(actorId: string): string {\n if (actorId.length <= 12) return actorId;\n return `${actorId.slice(0, 8)}…${actorId.slice(-4)}`;\n}\n\nfunction humanizeType(actorType: string): string {\n switch (actorType.toLowerCase()) {\n case 'user':\n return 'User';\n case 'app':\n return 'App';\n case 'service':\n return 'Service';\n case 'super_admin':\n return 'Super Admin';\n default:\n return actorType\n .split('_')\n .map((segment) => segment.charAt(0) + segment.slice(1).toLowerCase())\n .join(' ');\n }\n}\n\nfunction buildFallback(actor: ActorInput): ActorProfile {\n return {\n actorId: actor.actorId,\n actorType: actor.actorType,\n displayName:\n actor.actorType.toLowerCase() === 'user'\n ? `User ${shortId(actor.actorId)}`\n : humanizeType(actor.actorType),\n secondaryLabel: shortId(actor.actorId),\n resolved: false,\n };\n}\n\nconst cache = new Map<string, ActorProfile>();\nconst inflight = new Map<string, Promise<ActorProfile>>();\nconst CACHE_TTL_MS = 5 * 60 * 1000;\nconst cacheExpiresAt = new Map<string, number>();\n\nfunction cacheGet(actorId: string): ActorProfile | undefined {\n const expiresAt = cacheExpiresAt.get(actorId);\n if (!expiresAt || expiresAt < Date.now()) {\n cache.delete(actorId);\n cacheExpiresAt.delete(actorId);\n return undefined;\n }\n return cache.get(actorId);\n}\n\nfunction cacheSet(profile: ActorProfile): void {\n cache.set(profile.actorId, profile);\n cacheExpiresAt.set(profile.actorId, Date.now() + CACHE_TTL_MS);\n}\n\nexport function useActorProfiles(actors: ActorInput[]): ActorProfileMap {\n const { authToken, apiGatewayUrl, orgId } = useBilling();\n const [profileMap, setProfileMap] = useState<ActorProfileMap>(() => {\n const initial: ActorProfileMap = {};\n for (const actor of actors) {\n const cached = cacheGet(actor.actorId);\n initial[actor.actorId] = cached ?? buildFallback(actor);\n }\n return initial;\n });\n\n const actorsKey = useMemo(\n () =>\n actors\n .map((a) => `${a.actorId}|${a.actorType}`)\n .sort()\n .join(','),\n [actors]\n );\n const lastTokenRef = useRef<string | undefined>(undefined);\n\n useEffect(() => {\n let cancelled = false;\n lastTokenRef.current = authToken;\n\n async function loadOne(actor: ActorInput): Promise<ActorProfile> {\n const cached = cacheGet(actor.actorId);\n if (cached?.resolved) return cached;\n\n if (actor.actorType.toLowerCase() !== 'user') {\n const profile = buildFallback(actor);\n cacheSet(profile);\n return profile;\n }\n\n const key = actor.actorId;\n const existing = inflight.get(key);\n if (existing) return existing;\n\n const promise = (async () => {\n try {\n const data = await directBillingGraphqlRequest<UserResponse>({\n apiGatewayUrl,\n authToken,\n orgId,\n query: USER_QUERY,\n variables: { id: actor.actorId },\n });\n if (!data.user) {\n const profile = buildFallback(actor);\n cacheSet(profile);\n return profile;\n }\n const u = data.user;\n const displayName =\n u.name?.trim() ||\n [u.firstName, u.lastName].filter(Boolean).join(' ').trim() ||\n u.username?.trim() ||\n u.email?.trim() ||\n `User ${shortId(actor.actorId)}`;\n const profile: ActorProfile = {\n actorId: actor.actorId,\n actorType: actor.actorType,\n displayName,\n secondaryLabel: u.email ?? shortId(actor.actorId),\n email: u.email ?? undefined,\n avatarUrl: u.avatar ?? undefined,\n resolved: true,\n };\n cacheSet(profile);\n return profile;\n } catch {\n const profile = buildFallback(actor);\n return profile;\n } finally {\n inflight.delete(key);\n }\n })();\n inflight.set(key, promise);\n return promise;\n }\n\n async function run() {\n const results = await Promise.all(actors.map(loadOne));\n if (cancelled) return;\n setProfileMap((prev) => {\n const next: ActorProfileMap = { ...prev };\n for (const profile of results) {\n next[profile.actorId] = profile;\n }\n return next;\n });\n }\n\n void run();\n return () => {\n cancelled = true;\n };\n }, [actorsKey, authToken, apiGatewayUrl, orgId]); // eslint-disable-line react-hooks/exhaustive-deps\n\n return profileMap;\n}\n"],"mappings":";;;;;AAqBA,IAAM,IAAa;AA0BnB,SAAS,EAAQ,GAAyB;AAExC,QADI,EAAQ,UAAU,KAAW,IAC1B,GAAG,EAAQ,MAAM,GAAG,EAAE,CAAC,GAAG,EAAQ,MAAM,GAAG;;AAGpD,SAAS,EAAa,GAA2B;AAC/C,SAAQ,EAAU,aAAa,EAA/B;EACE,KAAK,OACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,UACH,QAAO;EACT,KAAK,cACH,QAAO;EACT,QACE,QAAO,EACJ,MAAM,IAAI,CACV,KAAK,MAAY,EAAQ,OAAO,EAAE,GAAG,EAAQ,MAAM,EAAE,CAAC,aAAa,CAAC,CACpE,KA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AAW;EAAe;EAAM,CAAC,EAEzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/microfe-billing",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.528.1",
|
|
4
4
|
"description": "Billing microfrontend for Burdenoff products",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@apollo/client": "^4.1.4",
|
|
46
|
-
"@burdenoff/fe-libs": "2026.
|
|
46
|
+
"@burdenoff/fe-libs": "2026.528.2",
|
|
47
47
|
"@tanstack/react-query": "^5.90.16",
|
|
48
48
|
"clsx": "^2.1.1",
|
|
49
49
|
"graphql": "^16.10.0",
|