@fonderie/vue-admin-screens 0.5.0 → 0.6.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 +125 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +132 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -588,19 +588,30 @@ var import_vue_admin8 = require("@fonderie/vue-admin");
|
|
|
588
588
|
var import_vue9 = require("vue");
|
|
589
589
|
var UsersScreen = (0, import_vue9.defineComponent)({
|
|
590
590
|
name: "FonderieUsersScreen",
|
|
591
|
-
props: {
|
|
591
|
+
props: {
|
|
592
|
+
client: { type: Object, required: true },
|
|
593
|
+
pageSize: { type: Number, default: 50 }
|
|
594
|
+
},
|
|
592
595
|
setup(props) {
|
|
593
596
|
const input = (0, import_vue9.ref)("");
|
|
594
597
|
const email = (0, import_vue9.ref)("");
|
|
598
|
+
const selectedId = (0, import_vue9.ref)("");
|
|
599
|
+
const list = (0, import_vue_admin8.useAdminUsers)(props.client, { limit: props.pageSize });
|
|
595
600
|
const { user, isLoading, error, suspend, unsuspend, revokeSessions } = (0, import_vue_admin8.useAdminUser)(
|
|
596
601
|
props.client,
|
|
597
|
-
{ email }
|
|
602
|
+
{ email, id: selectedId }
|
|
598
603
|
);
|
|
599
604
|
const userId = (0, import_vue9.computed)(() => user.value?.id ?? null);
|
|
600
605
|
const sessions = (0, import_vue_admin8.useAdminUserSessions)(props.client, userId);
|
|
601
606
|
const history = (0, import_vue_admin8.useAdminLoginHistory)(props.client, userId, { limit: 20 });
|
|
607
|
+
const showList = (0, import_vue9.computed)(() => !email.value && !selectedId.value);
|
|
602
608
|
const yesNo = (v) => (0, import_vue9.h)("span", { style: v ? styles.ok : styles.muted }, v ? "yes" : "no");
|
|
603
609
|
const row = (k, v) => (0, import_vue9.h)("tr", [td(k), td(v)]);
|
|
610
|
+
const clear = () => {
|
|
611
|
+
email.value = "";
|
|
612
|
+
selectedId.value = "";
|
|
613
|
+
input.value = "";
|
|
614
|
+
};
|
|
604
615
|
return () => {
|
|
605
616
|
const u = user.value;
|
|
606
617
|
return (0, import_vue9.h)("div", { style: styles.container }, [
|
|
@@ -611,6 +622,7 @@ var UsersScreen = (0, import_vue9.defineComponent)({
|
|
|
611
622
|
style: styles.toolbar,
|
|
612
623
|
onSubmit: (e) => {
|
|
613
624
|
e.preventDefault();
|
|
625
|
+
selectedId.value = "";
|
|
614
626
|
email.value = input.value.trim();
|
|
615
627
|
}
|
|
616
628
|
},
|
|
@@ -627,9 +639,48 @@ var UsersScreen = (0, import_vue9.defineComponent)({
|
|
|
627
639
|
"button",
|
|
628
640
|
{ type: "submit", style: styles.button, disabled: isLoading.value },
|
|
629
641
|
"Look up"
|
|
630
|
-
)
|
|
642
|
+
),
|
|
643
|
+
showList.value ? refreshButton("Refresh", list.isLoading.value, () => void list.refresh()) : refreshButton("\u2190 All users", false, clear)
|
|
631
644
|
]
|
|
632
645
|
),
|
|
646
|
+
showList.value ? (0, import_vue9.h)("div", [
|
|
647
|
+
list.error.value ? (0, import_vue9.h)("p", { style: styles.error, role: "alert" }, list.error.value.explanation) : null,
|
|
648
|
+
list.users.value.length === 0 && !list.isLoading.value ? (0, import_vue9.h)("p", { style: styles.muted }, "No users yet.") : table(
|
|
649
|
+
["Email", "Name", "Created", "Status"],
|
|
650
|
+
list.users.value.map(
|
|
651
|
+
(u2) => (0, import_vue9.h)("tr", { key: u2.id }, [
|
|
652
|
+
td(
|
|
653
|
+
(0, import_vue9.h)(
|
|
654
|
+
"button",
|
|
655
|
+
{
|
|
656
|
+
type: "button",
|
|
657
|
+
style: { ...styles.navItem, padding: 0 },
|
|
658
|
+
onClick: () => selectedId.value = u2.id
|
|
659
|
+
},
|
|
660
|
+
u2.email
|
|
661
|
+
)
|
|
662
|
+
),
|
|
663
|
+
td(
|
|
664
|
+
`${u2.firstName ?? ""} ${u2.lastName ?? ""}`.trim() || (0, import_vue9.h)("span", { style: styles.muted }, "\u2014")
|
|
665
|
+
),
|
|
666
|
+
td(new Date(u2.createdAt).toLocaleDateString()),
|
|
667
|
+
td(
|
|
668
|
+
u2.suspended ? (0, import_vue9.h)("span", { style: styles.badge }, "suspended") : u2.deletedAt ? (0, import_vue9.h)("span", { style: styles.badge }, "deleted") : (0, import_vue9.h)("span", { style: styles.muted }, "active")
|
|
669
|
+
)
|
|
670
|
+
])
|
|
671
|
+
)
|
|
672
|
+
),
|
|
673
|
+
list.isLoading.value ? (0, import_vue9.h)("p", { style: styles.status }, "Loading\u2026") : null,
|
|
674
|
+
list.hasMore.value && !list.isLoading.value ? (0, import_vue9.h)(
|
|
675
|
+
"button",
|
|
676
|
+
{
|
|
677
|
+
type: "button",
|
|
678
|
+
style: { ...styles.button, marginTop: "8px" },
|
|
679
|
+
onClick: () => void list.loadMore()
|
|
680
|
+
},
|
|
681
|
+
"Load more"
|
|
682
|
+
) : null
|
|
683
|
+
]) : null,
|
|
633
684
|
error.value ? (0, import_vue9.h)(
|
|
634
685
|
"p",
|
|
635
686
|
{ style: styles.error, role: "alert" },
|
|
@@ -792,12 +843,22 @@ var import_vue_admin10 = require("@fonderie/vue-admin");
|
|
|
792
843
|
var import_vue11 = require("vue");
|
|
793
844
|
var SubscriberScreen = (0, import_vue11.defineComponent)({
|
|
794
845
|
name: "FonderieSubscriberScreen",
|
|
795
|
-
props: {
|
|
846
|
+
props: {
|
|
847
|
+
client: { type: Object, required: true },
|
|
848
|
+
pageSize: { type: Number, default: 50 }
|
|
849
|
+
},
|
|
796
850
|
setup(props) {
|
|
797
851
|
const type = (0, import_vue11.ref)("user");
|
|
798
852
|
const idInput = (0, import_vue11.ref)("");
|
|
799
853
|
const subscriber = (0, import_vue11.ref)(null);
|
|
854
|
+
const list = (0, import_vue_admin10.useAdminSubscribers)(props.client, { limit: props.pageSize });
|
|
800
855
|
const { subscription, wallet, ledger, hasMoreLedger, isLoading, error, loadMoreLedger, grant } = (0, import_vue_admin10.useAdminSubscriber)(props.client, subscriber, { limit: 20 });
|
|
856
|
+
const open = (t, id) => {
|
|
857
|
+
granted.value = null;
|
|
858
|
+
type.value = t;
|
|
859
|
+
idInput.value = id;
|
|
860
|
+
subscriber.value = { type: t, id };
|
|
861
|
+
};
|
|
801
862
|
const amount = (0, import_vue11.ref)("");
|
|
802
863
|
const note = (0, import_vue11.ref)("");
|
|
803
864
|
const granted = (0, import_vue11.ref)(null);
|
|
@@ -842,9 +903,69 @@ var SubscriberScreen = (0, import_vue11.defineComponent)({
|
|
|
842
903
|
"button",
|
|
843
904
|
{ type: "submit", style: styles.button, disabled: isLoading.value },
|
|
844
905
|
"Look up"
|
|
906
|
+
),
|
|
907
|
+
subscriber.value ? (0, import_vue11.h)(
|
|
908
|
+
"button",
|
|
909
|
+
{
|
|
910
|
+
type: "button",
|
|
911
|
+
style: styles.button,
|
|
912
|
+
onClick: () => {
|
|
913
|
+
subscriber.value = null;
|
|
914
|
+
idInput.value = "";
|
|
915
|
+
granted.value = null;
|
|
916
|
+
}
|
|
917
|
+
},
|
|
918
|
+
"\u2190 All subscribers"
|
|
919
|
+
) : (0, import_vue11.h)(
|
|
920
|
+
"button",
|
|
921
|
+
{
|
|
922
|
+
type: "button",
|
|
923
|
+
style: styles.button,
|
|
924
|
+
disabled: list.isLoading.value,
|
|
925
|
+
onClick: () => void list.refresh()
|
|
926
|
+
},
|
|
927
|
+
"Refresh"
|
|
845
928
|
)
|
|
846
929
|
]
|
|
847
930
|
),
|
|
931
|
+
!subscriber.value ? (0, import_vue11.h)("div", [
|
|
932
|
+
list.error.value ? (0, import_vue11.h)("p", { style: styles.error, role: "alert" }, list.error.value.explanation) : null,
|
|
933
|
+
list.subscriptions.value.length === 0 && !list.isLoading.value ? (0, import_vue11.h)("p", { style: styles.muted }, "No subscribers yet.") : table(
|
|
934
|
+
["Subscriber", "Plan", "Status", "Renews"],
|
|
935
|
+
list.subscriptions.value.map(
|
|
936
|
+
(sub) => (0, import_vue11.h)("tr", { key: sub.id }, [
|
|
937
|
+
td(
|
|
938
|
+
(0, import_vue11.h)(
|
|
939
|
+
"button",
|
|
940
|
+
{
|
|
941
|
+
type: "button",
|
|
942
|
+
style: { ...styles.navItem, padding: 0, ...styles.mono },
|
|
943
|
+
onClick: () => open(sub.subscriberType, sub.subscriberId)
|
|
944
|
+
},
|
|
945
|
+
`${sub.subscriberType}/${sub.subscriberId}`
|
|
946
|
+
)
|
|
947
|
+
),
|
|
948
|
+
td(`${sub.plan} \xB7 ${sub.interval}`),
|
|
949
|
+
td(
|
|
950
|
+
sub.cancelAtPeriodEnd ? [sub.status, " ", (0, import_vue11.h)("span", { style: styles.badge }, "cancels")] : sub.status
|
|
951
|
+
),
|
|
952
|
+
td(
|
|
953
|
+
sub.currentPeriodEnd ? new Date(sub.currentPeriodEnd).toLocaleDateString() : (0, import_vue11.h)("span", { style: styles.muted }, "\u2014")
|
|
954
|
+
)
|
|
955
|
+
])
|
|
956
|
+
)
|
|
957
|
+
),
|
|
958
|
+
list.isLoading.value ? (0, import_vue11.h)("p", { style: styles.status }, "Loading\u2026") : null,
|
|
959
|
+
list.hasMore.value && !list.isLoading.value ? (0, import_vue11.h)(
|
|
960
|
+
"button",
|
|
961
|
+
{
|
|
962
|
+
type: "button",
|
|
963
|
+
style: { ...styles.button, marginTop: "8px" },
|
|
964
|
+
onClick: () => void list.loadMore()
|
|
965
|
+
},
|
|
966
|
+
"Load more"
|
|
967
|
+
) : null
|
|
968
|
+
]) : null,
|
|
848
969
|
error.value ? (0, import_vue11.h)("p", { style: styles.error, role: "alert" }, error.value.explanation) : null,
|
|
849
970
|
subscriber.value && !isLoading.value ? [
|
|
850
971
|
(0, import_vue11.h)("h2", { style: styles.subtitle }, "Subscription"),
|