@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.d.cts CHANGED
@@ -52,6 +52,10 @@ declare const AdminShell: vue.DefineComponent<vue.ExtractPropTypes<{
52
52
  type: StringConstructor;
53
53
  default: undefined;
54
54
  };
55
+ publicConfigUrl: {
56
+ type: StringConstructor;
57
+ default: undefined;
58
+ };
55
59
  }>, () => VNode<vue.RendererNode, vue.RendererElement, {
56
60
  [key: string]: any;
57
61
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
@@ -105,6 +109,10 @@ declare const AdminShell: vue.DefineComponent<vue.ExtractPropTypes<{
105
109
  type: StringConstructor;
106
110
  default: undefined;
107
111
  };
112
+ publicConfigUrl: {
113
+ type: StringConstructor;
114
+ default: undefined;
115
+ };
108
116
  }>> & Readonly<{
109
117
  onNavigate?: (_page: AdminPage) => any;
110
118
  }>, {
@@ -119,6 +127,7 @@ declare const AdminShell: vue.DefineComponent<vue.ExtractPropTypes<{
119
127
  appName: string;
120
128
  envLabel: string;
121
129
  currentOperator: string;
130
+ publicConfigUrl: string;
122
131
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
123
132
 
124
133
  declare const AttentionScreen: vue.DefineComponent<vue.ExtractPropTypes<{
package/dist/index.d.ts CHANGED
@@ -52,6 +52,10 @@ declare const AdminShell: vue.DefineComponent<vue.ExtractPropTypes<{
52
52
  type: StringConstructor;
53
53
  default: undefined;
54
54
  };
55
+ publicConfigUrl: {
56
+ type: StringConstructor;
57
+ default: undefined;
58
+ };
55
59
  }>, () => VNode<vue.RendererNode, vue.RendererElement, {
56
60
  [key: string]: any;
57
61
  }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
@@ -105,6 +109,10 @@ declare const AdminShell: vue.DefineComponent<vue.ExtractPropTypes<{
105
109
  type: StringConstructor;
106
110
  default: undefined;
107
111
  };
112
+ publicConfigUrl: {
113
+ type: StringConstructor;
114
+ default: undefined;
115
+ };
108
116
  }>> & Readonly<{
109
117
  onNavigate?: (_page: AdminPage) => any;
110
118
  }>, {
@@ -119,6 +127,7 @@ declare const AdminShell: vue.DefineComponent<vue.ExtractPropTypes<{
119
127
  appName: string;
120
128
  envLabel: string;
121
129
  currentOperator: string;
130
+ publicConfigUrl: string;
122
131
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
123
132
 
124
133
  declare const AttentionScreen: vue.DefineComponent<vue.ExtractPropTypes<{
package/dist/index.js CHANGED
@@ -1,6 +1,10 @@
1
1
  // src/screens/AdminShell.ts
2
2
  import { ConfigEditorScreen, ConfigListScreen } from "@fonderie/vue-config-admin-screens";
3
- import { TemplateEditorScreen, TemplateListScreen } from "@fonderie/vue-courier-admin-screens";
3
+ import {
4
+ TemplateCreateScreen,
5
+ TemplateEditorScreen,
6
+ TemplateListScreen
7
+ } from "@fonderie/vue-courier-admin-screens";
4
8
  import { computed as computed3, defineComponent as defineComponent15, h as h17, onBeforeUnmount, onMounted, ref as ref9 } from "vue";
5
9
 
6
10
  // src/styles.ts
@@ -1720,16 +1724,22 @@ function useSubscriptionIndex(client) {
1720
1724
  // src/screens/SubscriberBilling.ts
1721
1725
  import { useAdminSubscriber } from "@fonderie/vue-admin";
1722
1726
  import { computed, defineComponent as defineComponent10, h as h12, ref as ref5 } from "vue";
1723
- var SubscriberBilling = defineComponent10({
1724
- name: "FonderieSubscriberBilling",
1727
+ var SubscriberBillingInner = defineComponent10({
1728
+ name: "FonderieSubscriberBillingInner",
1725
1729
  props: {
1726
1730
  client: { type: Object, required: true },
1727
1731
  subscriberType: { type: String, required: true },
1728
- subscriberId: { type: String, required: true }
1732
+ subscriberId: { type: String, required: true },
1733
+ currency: { type: String, default: "" }
1729
1734
  },
1730
- setup(props) {
1735
+ emits: { "change-currency": (_currency) => true },
1736
+ setup(props, { emit }) {
1731
1737
  const subscriber = computed(() => ({ type: props.subscriberType, id: props.subscriberId }));
1732
- const { subscription, wallet, ledger, hasMoreLedger, isLoading, error, loadMoreLedger, grant } = useAdminSubscriber(props.client, subscriber, { limit: 20 });
1738
+ const { subscription, wallet, ledger, hasMoreLedger, isLoading, error, loadMoreLedger, grant } = useAdminSubscriber(props.client, subscriber, {
1739
+ limit: 20,
1740
+ ...props.currency ? { currency: props.currency } : {}
1741
+ });
1742
+ const currencyDraft = ref5(props.currency);
1733
1743
  const amount = ref5("");
1734
1744
  const note = ref5("");
1735
1745
  const granted = ref5(null);
@@ -1770,7 +1780,43 @@ var SubscriberBilling = defineComponent10({
1770
1780
  ) : null
1771
1781
  ]),
1772
1782
  h12("div", { style: styles.card }, [
1773
- h12("div", { style: styles.statLabel }, "Credits"),
1783
+ h12(
1784
+ "div",
1785
+ {
1786
+ style: {
1787
+ display: "flex",
1788
+ justifyContent: "space-between",
1789
+ alignItems: "center",
1790
+ gap: "8px"
1791
+ }
1792
+ },
1793
+ [
1794
+ h12("div", { style: styles.statLabel }, "Credits"),
1795
+ h12(
1796
+ "form",
1797
+ {
1798
+ style: { display: "flex", gap: "4px" },
1799
+ onSubmit: (e) => {
1800
+ e.preventDefault();
1801
+ emit("change-currency", currencyDraft.value.trim().toUpperCase());
1802
+ }
1803
+ },
1804
+ [
1805
+ h12("input", {
1806
+ value: currencyDraft.value,
1807
+ onInput: (e) => {
1808
+ currencyDraft.value = e.target.value;
1809
+ },
1810
+ placeholder: w?.currency ?? "currency",
1811
+ maxlength: 8,
1812
+ style: { ...styles.input, height: "26px", width: "84px", fontSize: "12px" },
1813
+ "aria-label": "Wallet currency",
1814
+ title: "Show the wallet in another currency"
1815
+ })
1816
+ ]
1817
+ )
1818
+ ]
1819
+ ),
1774
1820
  ...w ? [
1775
1821
  h12("div", { style: styles.statValue }, [
1776
1822
  `${w.balance} `,
@@ -1867,6 +1913,27 @@ var SubscriberBilling = defineComponent10({
1867
1913
  };
1868
1914
  }
1869
1915
  });
1916
+ var SubscriberBilling = defineComponent10({
1917
+ name: "FonderieSubscriberBilling",
1918
+ props: {
1919
+ client: { type: Object, required: true },
1920
+ subscriberType: { type: String, required: true },
1921
+ subscriberId: { type: String, required: true }
1922
+ },
1923
+ setup(props) {
1924
+ const currency = ref5("");
1925
+ return () => h12(SubscriberBillingInner, {
1926
+ key: `${props.subscriberType}:${props.subscriberId}:${currency.value}`,
1927
+ client: props.client,
1928
+ subscriberType: props.subscriberType,
1929
+ subscriberId: props.subscriberId,
1930
+ currency: currency.value,
1931
+ "onChange-currency": (c) => {
1932
+ currency.value = c;
1933
+ }
1934
+ });
1935
+ }
1936
+ });
1870
1937
 
1871
1938
  // src/screens/UsersScreen.ts
1872
1939
  var UsersScreen = defineComponent11({
@@ -2396,7 +2463,7 @@ var AuditScreen = defineComponent14({
2396
2463
  pageSize: { type: Number, default: 50 }
2397
2464
  },
2398
2465
  setup(props) {
2399
- const draft = ref8({ workspaceId: "", type: "", actorId: "" });
2466
+ const draft = ref8({ workspaceId: "", type: "", actorId: "", from: "", to: "" });
2400
2467
  const query = ref8({ limit: props.pageSize });
2401
2468
  const { events, hasMore, isLoading, error, refresh, loadMore } = useAdminAudit(
2402
2469
  props.client,
@@ -2425,7 +2492,10 @@ var AuditScreen = defineComponent14({
2425
2492
  limit: props.pageSize,
2426
2493
  ...d.workspaceId.trim() ? { workspaceId: d.workspaceId.trim() } : {},
2427
2494
  ...d.type.trim() ? { type: d.type.trim() } : {},
2428
- ...d.actorId.trim() ? { actorId: d.actorId.trim() } : {}
2495
+ ...d.actorId.trim() ? { actorId: d.actorId.trim() } : {},
2496
+ // Dates are whole days in the operator's time zone: "to" includes that day.
2497
+ ...d.from ? { from: /* @__PURE__ */ new Date(`${d.from}T00:00:00`) } : {},
2498
+ ...d.to ? { to: /* @__PURE__ */ new Date(`${d.to}T23:59:59.999`) } : {}
2429
2499
  };
2430
2500
  }
2431
2501
  },
@@ -2433,6 +2503,16 @@ var AuditScreen = defineComponent14({
2433
2503
  field("workspaceId", "workspace id (all if empty)"),
2434
2504
  field("type", "event type"),
2435
2505
  field("actorId", "actor id"),
2506
+ ...["from", "to"].map(
2507
+ (k) => h16("input", {
2508
+ type: "date",
2509
+ value: draft.value[k],
2510
+ onInput: (e) => draft.value = { ...draft.value, [k]: e.target.value },
2511
+ style: styles.input,
2512
+ "aria-label": k === "from" ? "From date" : "To date",
2513
+ title: k === "from" ? "From (inclusive)" : "To (inclusive)"
2514
+ })
2515
+ ),
2436
2516
  h16(
2437
2517
  "button",
2438
2518
  { type: "submit", style: styles.buttonPrimary, disabled: isLoading.value },
@@ -2538,7 +2618,10 @@ var AdminShell = defineComponent15({
2538
2618
  // shows the Operators page.
2539
2619
  operators: { type: Boolean, default: false },
2540
2620
  // The signed-in operator's email, when a person (not a token) is signed in.
2541
- currentOperator: { type: String, default: void 0 }
2621
+ currentOperator: { type: String, default: void 0 },
2622
+ // Where the app serves GET /config/public — marks public keys on the
2623
+ // Config page and previews exactly what frontends receive.
2624
+ publicConfigUrl: { type: String, default: void 0 }
2542
2625
  },
2543
2626
  // `footer` slot: pinned to the bottom of the sidebar — session controls
2544
2627
  // (theme, sign out). The React shell takes the same thing as a `footer` prop.
@@ -2617,43 +2700,83 @@ var AdminShell = defineComponent15({
2617
2700
  const cc = props.configClient;
2618
2701
  if (!cc) return missing("Pass a ConfigAdminClient to manage config and secrets here.");
2619
2702
  const e = editing.value;
2620
- if (e && e.kind !== "template")
2703
+ if (e && (e.kind === "config" || e.kind === "secret")) {
2704
+ const env = e.environment ?? props.environment;
2621
2705
  return [
2622
2706
  back("Config & secrets"),
2623
2707
  h17(ConfigEditorScreen, {
2708
+ key: `${e.kind}:${e.key}:${e.environment ?? ""}`,
2624
2709
  client: cc,
2625
2710
  kind: e.kind,
2626
2711
  configKey: e.key,
2627
- ...props.environment !== void 0 ? { environment: props.environment } : {},
2628
- onSaved: () => editing.value = null
2712
+ ...env !== void 0 ? { environment: env } : {},
2713
+ ...e.environments ? { environments: e.environments } : {},
2714
+ onSaved: () => editing.value = null,
2715
+ onDeleted: () => editing.value = null
2629
2716
  })
2630
2717
  ];
2718
+ }
2719
+ const create = (kind) => (c2) => editing.value = {
2720
+ kind,
2721
+ key: "",
2722
+ environments: c2.environments,
2723
+ ...c2.environment ? { environment: c2.environment } : {}
2724
+ };
2631
2725
  return h17(ConfigListScreen, {
2632
2726
  client: cc,
2633
2727
  ...props.environment !== void 0 ? { environment: props.environment } : {},
2634
- "onSelect-config": (key) => editing.value = { kind: "config", key },
2635
- "onSelect-secret": (key) => editing.value = { kind: "secret", key },
2728
+ ...props.publicConfigUrl ? { publicConfigUrl: props.publicConfigUrl } : {},
2729
+ "onSelect-config": (key, environment) => editing.value = { kind: "config", key, environment },
2730
+ "onSelect-secret": (key, environment) => editing.value = { kind: "secret", key, environment },
2636
2731
  allowCreate: true,
2637
- "onCreate-config": () => editing.value = { kind: "config", key: "" },
2638
- "onCreate-secret": () => editing.value = { kind: "secret", key: "" }
2732
+ "onCreate-config": create("config"),
2733
+ "onCreate-secret": create("secret")
2639
2734
  });
2640
2735
  }
2641
2736
  case "templates": {
2642
2737
  const kc = props.courierClient;
2643
2738
  if (!kc) return missing("Pass a CourierAdminClient to manage templates here.");
2644
2739
  const e = editing.value;
2740
+ if (e?.kind === "template-new")
2741
+ return [
2742
+ back("Templates"),
2743
+ h17(TemplateCreateScreen, {
2744
+ client: kc,
2745
+ ...e.type ? { type: e.type } : {},
2746
+ ...e.locales ? { locales: e.locales } : {},
2747
+ onCreated: (c2) => editing.value = {
2748
+ kind: "template",
2749
+ type: c2.type,
2750
+ locale: c2.locale,
2751
+ system: false
2752
+ }
2753
+ })
2754
+ ];
2645
2755
  if (e?.kind === "template")
2646
2756
  return [
2647
2757
  back("Templates"),
2648
2758
  h17(TemplateEditorScreen, {
2759
+ key: `${e.type}:${e.locale ?? ""}`,
2649
2760
  client: kc,
2650
2761
  type: e.type,
2651
- onSaved: () => editing.value = null
2762
+ locale: e.locale,
2763
+ system: e.system,
2764
+ allowAddLocale: true,
2765
+ onSaved: () => editing.value = null,
2766
+ onDeleted: () => editing.value = null,
2767
+ "onAdd-locale": (type) => editing.value = { kind: "template-new", type }
2652
2768
  })
2653
2769
  ];
2654
2770
  return h17(TemplateListScreen, {
2655
2771
  client: kc,
2656
- "onSelect-template": (t2) => editing.value = { kind: "template", type: t2.type }
2772
+ allowCreate: true,
2773
+ "onSelect-template": (t2) => editing.value = {
2774
+ kind: "template",
2775
+ type: t2.type,
2776
+ locale: t2.locale ?? null,
2777
+ system: t2.system === true
2778
+ },
2779
+ "onCreate-template": (c2) => editing.value = { kind: "template-new", locales: c2.locales }
2657
2780
  });
2658
2781
  }
2659
2782
  }