@fonderie/vue-admin-screens 1.4.0 → 1.5.0
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/index.cjs +137 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +142 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1755,16 +1755,22 @@ function useSubscriptionIndex(client) {
|
|
|
1755
1755
|
// src/screens/SubscriberBilling.ts
|
|
1756
1756
|
var import_vue_admin10 = require("@fonderie/vue-admin");
|
|
1757
1757
|
var import_vue13 = require("vue");
|
|
1758
|
-
var
|
|
1759
|
-
name: "
|
|
1758
|
+
var SubscriberBillingInner = (0, import_vue13.defineComponent)({
|
|
1759
|
+
name: "FonderieSubscriberBillingInner",
|
|
1760
1760
|
props: {
|
|
1761
1761
|
client: { type: Object, required: true },
|
|
1762
1762
|
subscriberType: { type: String, required: true },
|
|
1763
|
-
subscriberId: { type: String, required: true }
|
|
1763
|
+
subscriberId: { type: String, required: true },
|
|
1764
|
+
currency: { type: String, default: "" }
|
|
1764
1765
|
},
|
|
1765
|
-
|
|
1766
|
+
emits: { "change-currency": (_currency) => true },
|
|
1767
|
+
setup(props, { emit }) {
|
|
1766
1768
|
const subscriber = (0, import_vue13.computed)(() => ({ type: props.subscriberType, id: props.subscriberId }));
|
|
1767
|
-
const { subscription, wallet, ledger, hasMoreLedger, isLoading, error, loadMoreLedger, grant } = (0, import_vue_admin10.useAdminSubscriber)(props.client, subscriber, {
|
|
1769
|
+
const { subscription, wallet, ledger, hasMoreLedger, isLoading, error, loadMoreLedger, grant } = (0, import_vue_admin10.useAdminSubscriber)(props.client, subscriber, {
|
|
1770
|
+
limit: 20,
|
|
1771
|
+
...props.currency ? { currency: props.currency } : {}
|
|
1772
|
+
});
|
|
1773
|
+
const currencyDraft = (0, import_vue13.ref)(props.currency);
|
|
1768
1774
|
const amount = (0, import_vue13.ref)("");
|
|
1769
1775
|
const note = (0, import_vue13.ref)("");
|
|
1770
1776
|
const granted = (0, import_vue13.ref)(null);
|
|
@@ -1805,7 +1811,43 @@ var SubscriberBilling = (0, import_vue13.defineComponent)({
|
|
|
1805
1811
|
) : null
|
|
1806
1812
|
]),
|
|
1807
1813
|
(0, import_vue13.h)("div", { style: styles.card }, [
|
|
1808
|
-
(0, import_vue13.h)(
|
|
1814
|
+
(0, import_vue13.h)(
|
|
1815
|
+
"div",
|
|
1816
|
+
{
|
|
1817
|
+
style: {
|
|
1818
|
+
display: "flex",
|
|
1819
|
+
justifyContent: "space-between",
|
|
1820
|
+
alignItems: "center",
|
|
1821
|
+
gap: "8px"
|
|
1822
|
+
}
|
|
1823
|
+
},
|
|
1824
|
+
[
|
|
1825
|
+
(0, import_vue13.h)("div", { style: styles.statLabel }, "Credits"),
|
|
1826
|
+
(0, import_vue13.h)(
|
|
1827
|
+
"form",
|
|
1828
|
+
{
|
|
1829
|
+
style: { display: "flex", gap: "4px" },
|
|
1830
|
+
onSubmit: (e) => {
|
|
1831
|
+
e.preventDefault();
|
|
1832
|
+
emit("change-currency", currencyDraft.value.trim().toUpperCase());
|
|
1833
|
+
}
|
|
1834
|
+
},
|
|
1835
|
+
[
|
|
1836
|
+
(0, import_vue13.h)("input", {
|
|
1837
|
+
value: currencyDraft.value,
|
|
1838
|
+
onInput: (e) => {
|
|
1839
|
+
currencyDraft.value = e.target.value;
|
|
1840
|
+
},
|
|
1841
|
+
placeholder: w?.currency ?? "currency",
|
|
1842
|
+
maxlength: 8,
|
|
1843
|
+
style: { ...styles.input, height: "26px", width: "84px", fontSize: "12px" },
|
|
1844
|
+
"aria-label": "Wallet currency",
|
|
1845
|
+
title: "Show the wallet in another currency"
|
|
1846
|
+
})
|
|
1847
|
+
]
|
|
1848
|
+
)
|
|
1849
|
+
]
|
|
1850
|
+
),
|
|
1809
1851
|
...w ? [
|
|
1810
1852
|
(0, import_vue13.h)("div", { style: styles.statValue }, [
|
|
1811
1853
|
`${w.balance} `,
|
|
@@ -1902,6 +1944,27 @@ var SubscriberBilling = (0, import_vue13.defineComponent)({
|
|
|
1902
1944
|
};
|
|
1903
1945
|
}
|
|
1904
1946
|
});
|
|
1947
|
+
var SubscriberBilling = (0, import_vue13.defineComponent)({
|
|
1948
|
+
name: "FonderieSubscriberBilling",
|
|
1949
|
+
props: {
|
|
1950
|
+
client: { type: Object, required: true },
|
|
1951
|
+
subscriberType: { type: String, required: true },
|
|
1952
|
+
subscriberId: { type: String, required: true }
|
|
1953
|
+
},
|
|
1954
|
+
setup(props) {
|
|
1955
|
+
const currency = (0, import_vue13.ref)("");
|
|
1956
|
+
return () => (0, import_vue13.h)(SubscriberBillingInner, {
|
|
1957
|
+
key: `${props.subscriberType}:${props.subscriberId}:${currency.value}`,
|
|
1958
|
+
client: props.client,
|
|
1959
|
+
subscriberType: props.subscriberType,
|
|
1960
|
+
subscriberId: props.subscriberId,
|
|
1961
|
+
currency: currency.value,
|
|
1962
|
+
"onChange-currency": (c) => {
|
|
1963
|
+
currency.value = c;
|
|
1964
|
+
}
|
|
1965
|
+
});
|
|
1966
|
+
}
|
|
1967
|
+
});
|
|
1905
1968
|
|
|
1906
1969
|
// src/screens/UsersScreen.ts
|
|
1907
1970
|
var UsersScreen = (0, import_vue14.defineComponent)({
|
|
@@ -2431,7 +2494,7 @@ var AuditScreen = (0, import_vue17.defineComponent)({
|
|
|
2431
2494
|
pageSize: { type: Number, default: 50 }
|
|
2432
2495
|
},
|
|
2433
2496
|
setup(props) {
|
|
2434
|
-
const draft = (0, import_vue17.ref)({ workspaceId: "", type: "", actorId: "" });
|
|
2497
|
+
const draft = (0, import_vue17.ref)({ workspaceId: "", type: "", actorId: "", from: "", to: "" });
|
|
2435
2498
|
const query = (0, import_vue17.ref)({ limit: props.pageSize });
|
|
2436
2499
|
const { events, hasMore, isLoading, error, refresh, loadMore } = (0, import_vue_admin14.useAdminAudit)(
|
|
2437
2500
|
props.client,
|
|
@@ -2460,7 +2523,10 @@ var AuditScreen = (0, import_vue17.defineComponent)({
|
|
|
2460
2523
|
limit: props.pageSize,
|
|
2461
2524
|
...d.workspaceId.trim() ? { workspaceId: d.workspaceId.trim() } : {},
|
|
2462
2525
|
...d.type.trim() ? { type: d.type.trim() } : {},
|
|
2463
|
-
...d.actorId.trim() ? { actorId: d.actorId.trim() } : {}
|
|
2526
|
+
...d.actorId.trim() ? { actorId: d.actorId.trim() } : {},
|
|
2527
|
+
// Dates are whole days in the operator's time zone: "to" includes that day.
|
|
2528
|
+
...d.from ? { from: /* @__PURE__ */ new Date(`${d.from}T00:00:00`) } : {},
|
|
2529
|
+
...d.to ? { to: /* @__PURE__ */ new Date(`${d.to}T23:59:59.999`) } : {}
|
|
2464
2530
|
};
|
|
2465
2531
|
}
|
|
2466
2532
|
},
|
|
@@ -2468,6 +2534,16 @@ var AuditScreen = (0, import_vue17.defineComponent)({
|
|
|
2468
2534
|
field("workspaceId", "workspace id (all if empty)"),
|
|
2469
2535
|
field("type", "event type"),
|
|
2470
2536
|
field("actorId", "actor id"),
|
|
2537
|
+
...["from", "to"].map(
|
|
2538
|
+
(k) => (0, import_vue17.h)("input", {
|
|
2539
|
+
type: "date",
|
|
2540
|
+
value: draft.value[k],
|
|
2541
|
+
onInput: (e) => draft.value = { ...draft.value, [k]: e.target.value },
|
|
2542
|
+
style: styles.input,
|
|
2543
|
+
"aria-label": k === "from" ? "From date" : "To date",
|
|
2544
|
+
title: k === "from" ? "From (inclusive)" : "To (inclusive)"
|
|
2545
|
+
})
|
|
2546
|
+
),
|
|
2471
2547
|
(0, import_vue17.h)(
|
|
2472
2548
|
"button",
|
|
2473
2549
|
{ type: "submit", style: styles.buttonPrimary, disabled: isLoading.value },
|
|
@@ -2573,7 +2649,10 @@ var AdminShell = (0, import_vue18.defineComponent)({
|
|
|
2573
2649
|
// shows the Operators page.
|
|
2574
2650
|
operators: { type: Boolean, default: false },
|
|
2575
2651
|
// The signed-in operator's email, when a person (not a token) is signed in.
|
|
2576
|
-
currentOperator: { type: String, default: void 0 }
|
|
2652
|
+
currentOperator: { type: String, default: void 0 },
|
|
2653
|
+
// Where the app serves GET /config/public — marks public keys on the
|
|
2654
|
+
// Config page and previews exactly what frontends receive.
|
|
2655
|
+
publicConfigUrl: { type: String, default: void 0 }
|
|
2577
2656
|
},
|
|
2578
2657
|
// `footer` slot: pinned to the bottom of the sidebar — session controls
|
|
2579
2658
|
// (theme, sign out). The React shell takes the same thing as a `footer` prop.
|
|
@@ -2652,43 +2731,83 @@ var AdminShell = (0, import_vue18.defineComponent)({
|
|
|
2652
2731
|
const cc = props.configClient;
|
|
2653
2732
|
if (!cc) return missing("Pass a ConfigAdminClient to manage config and secrets here.");
|
|
2654
2733
|
const e = editing.value;
|
|
2655
|
-
if (e && e.kind
|
|
2734
|
+
if (e && (e.kind === "config" || e.kind === "secret")) {
|
|
2735
|
+
const env = e.environment ?? props.environment;
|
|
2656
2736
|
return [
|
|
2657
2737
|
back("Config & secrets"),
|
|
2658
2738
|
(0, import_vue18.h)(import_vue_config_admin_screens.ConfigEditorScreen, {
|
|
2739
|
+
key: `${e.kind}:${e.key}:${e.environment ?? ""}`,
|
|
2659
2740
|
client: cc,
|
|
2660
2741
|
kind: e.kind,
|
|
2661
2742
|
configKey: e.key,
|
|
2662
|
-
...
|
|
2663
|
-
|
|
2743
|
+
...env !== void 0 ? { environment: env } : {},
|
|
2744
|
+
...e.environments ? { environments: e.environments } : {},
|
|
2745
|
+
onSaved: () => editing.value = null,
|
|
2746
|
+
onDeleted: () => editing.value = null
|
|
2664
2747
|
})
|
|
2665
2748
|
];
|
|
2749
|
+
}
|
|
2750
|
+
const create = (kind) => (c2) => editing.value = {
|
|
2751
|
+
kind,
|
|
2752
|
+
key: "",
|
|
2753
|
+
environments: c2.environments,
|
|
2754
|
+
...c2.environment ? { environment: c2.environment } : {}
|
|
2755
|
+
};
|
|
2666
2756
|
return (0, import_vue18.h)(import_vue_config_admin_screens.ConfigListScreen, {
|
|
2667
2757
|
client: cc,
|
|
2668
2758
|
...props.environment !== void 0 ? { environment: props.environment } : {},
|
|
2669
|
-
|
|
2670
|
-
"onSelect-
|
|
2759
|
+
...props.publicConfigUrl ? { publicConfigUrl: props.publicConfigUrl } : {},
|
|
2760
|
+
"onSelect-config": (key, environment) => editing.value = { kind: "config", key, environment },
|
|
2761
|
+
"onSelect-secret": (key, environment) => editing.value = { kind: "secret", key, environment },
|
|
2671
2762
|
allowCreate: true,
|
|
2672
|
-
"onCreate-config": (
|
|
2673
|
-
"onCreate-secret": (
|
|
2763
|
+
"onCreate-config": create("config"),
|
|
2764
|
+
"onCreate-secret": create("secret")
|
|
2674
2765
|
});
|
|
2675
2766
|
}
|
|
2676
2767
|
case "templates": {
|
|
2677
2768
|
const kc = props.courierClient;
|
|
2678
2769
|
if (!kc) return missing("Pass a CourierAdminClient to manage templates here.");
|
|
2679
2770
|
const e = editing.value;
|
|
2771
|
+
if (e?.kind === "template-new")
|
|
2772
|
+
return [
|
|
2773
|
+
back("Templates"),
|
|
2774
|
+
(0, import_vue18.h)(import_vue_courier_admin_screens.TemplateCreateScreen, {
|
|
2775
|
+
client: kc,
|
|
2776
|
+
...e.type ? { type: e.type } : {},
|
|
2777
|
+
...e.locales ? { locales: e.locales } : {},
|
|
2778
|
+
onCreated: (c2) => editing.value = {
|
|
2779
|
+
kind: "template",
|
|
2780
|
+
type: c2.type,
|
|
2781
|
+
locale: c2.locale,
|
|
2782
|
+
system: false
|
|
2783
|
+
}
|
|
2784
|
+
})
|
|
2785
|
+
];
|
|
2680
2786
|
if (e?.kind === "template")
|
|
2681
2787
|
return [
|
|
2682
2788
|
back("Templates"),
|
|
2683
2789
|
(0, import_vue18.h)(import_vue_courier_admin_screens.TemplateEditorScreen, {
|
|
2790
|
+
key: `${e.type}:${e.locale ?? ""}`,
|
|
2684
2791
|
client: kc,
|
|
2685
2792
|
type: e.type,
|
|
2686
|
-
|
|
2793
|
+
locale: e.locale,
|
|
2794
|
+
system: e.system,
|
|
2795
|
+
allowAddLocale: true,
|
|
2796
|
+
onSaved: () => editing.value = null,
|
|
2797
|
+
onDeleted: () => editing.value = null,
|
|
2798
|
+
"onAdd-locale": (type) => editing.value = { kind: "template-new", type }
|
|
2687
2799
|
})
|
|
2688
2800
|
];
|
|
2689
2801
|
return (0, import_vue18.h)(import_vue_courier_admin_screens.TemplateListScreen, {
|
|
2690
2802
|
client: kc,
|
|
2691
|
-
|
|
2803
|
+
allowCreate: true,
|
|
2804
|
+
"onSelect-template": (t2) => editing.value = {
|
|
2805
|
+
kind: "template",
|
|
2806
|
+
type: t2.type,
|
|
2807
|
+
locale: t2.locale ?? null,
|
|
2808
|
+
system: t2.system === true
|
|
2809
|
+
},
|
|
2810
|
+
"onCreate-template": (c2) => editing.value = { kind: "template-new", locales: c2.locales }
|
|
2692
2811
|
});
|
|
2693
2812
|
}
|
|
2694
2813
|
}
|