@openrails/billing-ui 0.273.0 → 0.275.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/admin/components/customer-search.d.ts +5 -0
- package/dist/admin/components/missing-record.d.ts +6 -0
- package/dist/admin/components/status-badge.d.ts +1 -0
- package/dist/admin/context.d.ts +34 -2
- package/dist/admin/lib/api/endpoints.d.ts +4 -1
- package/dist/admin/lib/api/index.d.ts +3 -0
- package/dist/admin/lib/api/order-endpoints.d.ts +1 -0
- package/dist/admin/lib/api/types.d.ts +4 -12
- package/dist/admin/lib/capabilities.d.ts +4 -0
- package/dist/admin/lib/dialog-width.d.ts +4 -3
- package/dist/admin/lib/error-text.d.ts +4 -0
- package/dist/admin/lib/format.d.ts +5 -1
- package/dist/admin/lib/mutations.d.ts +6 -1
- package/dist/admin/lib/order-queries.d.ts +3 -0
- package/dist/admin/lib/queries.d.ts +6 -0
- package/dist/admin/lib/tile-grids.d.ts +6 -0
- package/dist/admin/messages.d.ts +102 -8
- package/dist/admin/pages/dashboard/lib.d.ts +1 -0
- package/dist/admin/pages/imports/shared.d.ts +1 -0
- package/dist/admin/pages/payments/index.d.ts +1 -2
- package/dist/admin/pages/subscriptions/change-subscription-dialog.d.ts +4 -7
- package/dist/admin/pages/subscriptions/index.d.ts +1 -2
- package/dist/admin/pages/subscriptions/subscription-change-options.d.ts +6 -15
- package/dist/admin-attempts-CP5CWyNR.js +419 -0
- package/dist/admin-attempts-CP5CWyNR.js.map +1 -0
- package/dist/{admin-auth-1aZIgXiS.js → admin-auth-DlIOmwPo.js} +2 -2
- package/dist/{admin-auth-1aZIgXiS.js.map → admin-auth-DlIOmwPo.js.map} +1 -1
- package/dist/{admin-badge-pgG6D9-a.js → admin-badge-DR_8AhdC.js} +2 -2
- package/dist/{admin-badge-pgG6D9-a.js.map → admin-badge-DR_8AhdC.js.map} +1 -1
- package/dist/{admin-button-CrcYk5r0.js → admin-button-DBzTD6By.js} +2 -2
- package/dist/{admin-button-CrcYk5r0.js.map → admin-button-DBzTD6By.js.map} +1 -1
- package/dist/{admin-capabilities-BDcZeHL_.js → admin-capabilities-CZdT1Pxe.js} +35 -14
- package/dist/admin-capabilities-CZdT1Pxe.js.map +1 -0
- package/dist/{admin-card-DvTMc5Se.js → admin-card-mZl4-s5d.js} +2 -2
- package/dist/{admin-card-DvTMc5Se.js.map → admin-card-mZl4-s5d.js.map} +1 -1
- package/dist/{admin-catalog-BlF5mnu4.js → admin-catalog-DpTjS0Yo.js} +298 -298
- package/dist/{admin-catalog-BlF5mnu4.js.map → admin-catalog-DpTjS0Yo.js.map} +1 -1
- package/dist/{admin-cursor-pager-CIb3Jw2F.js → admin-cursor-pager-C-KjCIy9.js} +6 -6
- package/dist/{admin-cursor-pager-CIb3Jw2F.js.map → admin-cursor-pager-C-KjCIy9.js.map} +1 -1
- package/dist/{admin-customers-EpfoWDh-.js → admin-customers-BE3N839X.js} +22 -21
- package/dist/{admin-customers-EpfoWDh-.js.map → admin-customers-BE3N839X.js.map} +1 -1
- package/dist/admin-dashboard-BxjkV15J.js +464 -0
- package/dist/admin-dashboard-BxjkV15J.js.map +1 -0
- package/dist/admin-data-table-D89AwWz_.js +107 -0
- package/dist/admin-data-table-D89AwWz_.js.map +1 -0
- package/dist/admin-detail-BKe9xqPd.js +338 -0
- package/dist/admin-detail-BKe9xqPd.js.map +1 -0
- package/dist/admin-detail-C8lD7U2t.js +699 -0
- package/dist/admin-detail-C8lD7U2t.js.map +1 -0
- package/dist/admin-detail-D6zD085K.js +354 -0
- package/dist/admin-detail-D6zD085K.js.map +1 -0
- package/dist/{admin-detail-3wFIDPNB.js → admin-detail-Ln56otK0.js} +83 -83
- package/dist/{admin-detail-3wFIDPNB.js.map → admin-detail-Ln56otK0.js.map} +1 -1
- package/dist/admin-detail-P-UnNvXJ.js +1357 -0
- package/dist/admin-detail-P-UnNvXJ.js.map +1 -0
- package/dist/{admin-dialog-BSRf9Zre.js → admin-dialog-Dn2FRJu4.js} +3 -3
- package/dist/{admin-dialog-BSRf9Zre.js.map → admin-dialog-Dn2FRJu4.js.map} +1 -1
- package/dist/admin-dialog-width-CC7QHT1p.js +6 -0
- package/dist/admin-dialog-width-CC7QHT1p.js.map +1 -0
- package/dist/{admin-dropdown-menu-D0E5rwmn.js → admin-dropdown-menu-DLUn6Uj3.js} +2 -2
- package/dist/{admin-dropdown-menu-D0E5rwmn.js.map → admin-dropdown-menu-DLUn6Uj3.js.map} +1 -1
- package/dist/{admin-dunning-B2zgtrOo.js → admin-dunning-COaHzrmN.js} +2 -2
- package/dist/{admin-dunning-B2zgtrOo.js.map → admin-dunning-COaHzrmN.js.map} +1 -1
- package/dist/{admin-fact-card-BPSVhS15.js → admin-fact-card-DKvBnUXB.js} +2 -2
- package/dist/{admin-fact-card-BPSVhS15.js.map → admin-fact-card-DKvBnUXB.js.map} +1 -1
- package/dist/admin-format-BbiTCqUG.js +171 -0
- package/dist/admin-format-BbiTCqUG.js.map +1 -0
- package/dist/{admin-health-D0L5Kig7.js → admin-health-DmnI4e8K.js} +249 -248
- package/dist/admin-health-DmnI4e8K.js.map +1 -0
- package/dist/{admin-imports-CgZB5JAV.js → admin-imports-C0aMP6sj.js} +65 -65
- package/dist/{admin-imports-CgZB5JAV.js.map → admin-imports-C0aMP6sj.js.map} +1 -1
- package/dist/{admin-input-DJAK9nmk.js → admin-input-JKrQIGfD.js} +2 -2
- package/dist/{admin-input-DJAK9nmk.js.map → admin-input-JKrQIGfD.js.map} +1 -1
- package/dist/{admin-label-aviN9Gng.js → admin-label-CHWsVIZC.js} +2 -2
- package/dist/{admin-label-aviN9Gng.js.map → admin-label-CHWsVIZC.js.map} +1 -1
- package/dist/{admin-linked-table-row-BGr7JXeM.js → admin-linked-table-row-BMZYYsuk.js} +4 -4
- package/dist/{admin-linked-table-row-BGr7JXeM.js.map → admin-linked-table-row-BMZYYsuk.js.map} +1 -1
- package/dist/{admin-map-dialog-DS2Wz6G3.js → admin-map-dialog-BHUGdCcv.js} +24 -24
- package/dist/{admin-map-dialog-DS2Wz6G3.js.map → admin-map-dialog-BHUGdCcv.js.map} +1 -1
- package/dist/{admin-metering-D-e-37Jn.js → admin-metering-CDqueHUh.js} +307 -307
- package/dist/{admin-metering-D-e-37Jn.js.map → admin-metering-CDqueHUh.js.map} +1 -1
- package/dist/admin-missing-record-BPFs3MmO.js +42 -0
- package/dist/admin-missing-record-BPFs3MmO.js.map +1 -0
- package/dist/admin-ops-CL2kjDwi.js +359 -0
- package/dist/admin-ops-CL2kjDwi.js.map +1 -0
- package/dist/admin-orders-C1Sf2qhc.js +192 -0
- package/dist/admin-orders-C1Sf2qhc.js.map +1 -0
- package/dist/admin-parked-a0tB5bhG.js +193 -0
- package/dist/admin-parked-a0tB5bhG.js.map +1 -0
- package/dist/admin-payments-DJcjwRA4.js +221 -0
- package/dist/admin-payments-DJcjwRA4.js.map +1 -0
- package/dist/{admin-price-detail-CSI5oKdb.js → admin-price-detail-BOmeWw15.js} +103 -103
- package/dist/{admin-price-detail-CSI5oKdb.js.map → admin-price-detail-BOmeWw15.js.map} +1 -1
- package/dist/{admin-price-format-BVUpDoSC.js → admin-price-format-CqOmHrIn.js} +2 -2
- package/dist/{admin-price-format-BVUpDoSC.js.map → admin-price-format-CqOmHrIn.js.map} +1 -1
- package/dist/{admin-price-wizard-CBEcNGvP.js → admin-price-wizard-B6s5OJeO.js} +63 -63
- package/dist/{admin-price-wizard-CBEcNGvP.js.map → admin-price-wizard-B6s5OJeO.js.map} +1 -1
- package/dist/{admin-proposals-Cuj7tvaM.js → admin-proposals-DVrl-ym4.js} +70 -70
- package/dist/{admin-proposals-Cuj7tvaM.js.map → admin-proposals-DVrl-ym4.js.map} +1 -1
- package/dist/admin-provider-prices-BVVogH7Q.js +241 -0
- package/dist/admin-provider-prices-BVVogH7Q.js.map +1 -0
- package/dist/{admin-range-picker-De36L-AP.js → admin-range-picker-C6BtSm2B.js} +9 -9
- package/dist/{admin-range-picker-De36L-AP.js.map → admin-range-picker-C6BtSm2B.js.map} +1 -1
- package/dist/{admin-records-H0MlhEVY.js → admin-records-DKtcgN11.js} +50 -50
- package/dist/{admin-records-H0MlhEVY.js.map → admin-records-DKtcgN11.js.map} +1 -1
- package/dist/{admin-reports-BFGS_PWf.js → admin-reports-CtPoiceH.js} +50 -50
- package/dist/{admin-reports-BFGS_PWf.js.map → admin-reports-CtPoiceH.js.map} +1 -1
- package/dist/{admin-select-BUcEU5Rg.js → admin-select-6Yuh5M1Q.js} +2 -2
- package/dist/{admin-select-BUcEU5Rg.js.map → admin-select-6Yuh5M1Q.js.map} +1 -1
- package/dist/admin-settings-DscHu4ww.js +1823 -0
- package/dist/admin-settings-DscHu4ww.js.map +1 -0
- package/dist/{admin-shared-lfIUEbPY.js → admin-shared-BywM-MMp.js} +28 -24
- package/dist/{admin-shared-lfIUEbPY.js.map → admin-shared-BywM-MMp.js.map} +1 -1
- package/dist/{admin-skeleton-B0yzYY_X.js → admin-skeleton-lndmw89u.js} +2 -2
- package/dist/{admin-skeleton-B0yzYY_X.js.map → admin-skeleton-lndmw89u.js.map} +1 -1
- package/dist/admin-status-badge-IL8ofZ_6.js +51 -0
- package/dist/admin-status-badge-IL8ofZ_6.js.map +1 -0
- package/dist/admin-subscriptions-Cd5CGrue.js +271 -0
- package/dist/admin-subscriptions-Cd5CGrue.js.map +1 -0
- package/dist/{admin-switch-DDorugaw.js → admin-switch-DpwQSzEm.js} +2 -2
- package/dist/{admin-switch-DDorugaw.js.map → admin-switch-DpwQSzEm.js.map} +1 -1
- package/dist/{admin-table-BU6Tie69.js → admin-table-D-GdGM1m.js} +2 -2
- package/dist/{admin-table-BU6Tie69.js.map → admin-table-D-GdGM1m.js.map} +1 -1
- package/dist/admin-tabs-B--1flzO.js +158 -0
- package/dist/admin-tabs-B--1flzO.js.map +1 -0
- package/dist/{admin-textarea-Dc6lnEub.js → admin-textarea-xsp5V9xM.js} +2 -2
- package/dist/{admin-textarea-Dc6lnEub.js.map → admin-textarea-xsp5V9xM.js.map} +1 -1
- package/dist/admin-tile-grids-CzGpidd9.js +6 -0
- package/dist/admin-tile-grids-CzGpidd9.js.map +1 -0
- package/dist/{admin-typed-confirm-dialog-Bk6XxmPb.js → admin-typed-confirm-dialog-NiEDwX_0.js} +11 -11
- package/dist/{admin-typed-confirm-dialog-Bk6XxmPb.js.map → admin-typed-confirm-dialog-NiEDwX_0.js.map} +1 -1
- package/dist/{admin-utils-B9eEBNsR.js → admin-utils-wuPUD0uh.js} +341 -283
- package/dist/admin-utils-wuPUD0uh.js.map +1 -0
- package/dist/admin-widget-viz-kHHVmDEx.js +646 -0
- package/dist/admin-widget-viz-kHHVmDEx.js.map +1 -0
- package/dist/admin.css +1 -1
- package/dist/admin.js +544 -413
- package/dist/admin.js.map +1 -1
- package/dist/client/generated/routes.d.ts +17 -0
- package/dist/client/generated/wire.d.ts +4 -0
- package/dist/client/types.d.ts +6 -0
- package/dist/{client-BYgnI6_h.js → client-ctrbivyN.js} +3 -2
- package/dist/client-ctrbivyN.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/{hooks-t2tSrCpa.js → hooks-KpTetx6F.js} +2 -2
- package/dist/{hooks-t2tSrCpa.js.map → hooks-KpTetx6F.js.map} +1 -1
- package/dist/index.js +750 -711
- package/dist/index.js.map +1 -1
- package/dist/lib/card-brands.d.ts +1 -0
- package/dist/locales/de.js +3 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +3 -0
- package/dist/locales/en.js +3 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +3 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +3 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +3 -0
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +3 -0
- package/dist/locales/zh.js.map +1 -1
- package/dist/react.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/admin-attempts-DyDDt-qw.js +0 -418
- package/dist/admin-attempts-DyDDt-qw.js.map +0 -1
- package/dist/admin-capabilities-BDcZeHL_.js.map +0 -1
- package/dist/admin-dashboard-CJE63yz4.js +0 -420
- package/dist/admin-dashboard-CJE63yz4.js.map +0 -1
- package/dist/admin-data-table-hvFcJepL.js +0 -96
- package/dist/admin-data-table-hvFcJepL.js.map +0 -1
- package/dist/admin-detail-BRP6pL7t.js +0 -328
- package/dist/admin-detail-BRP6pL7t.js.map +0 -1
- package/dist/admin-detail-CRzFb_pa.js +0 -1331
- package/dist/admin-detail-CRzFb_pa.js.map +0 -1
- package/dist/admin-detail-QLxU8r-5.js +0 -344
- package/dist/admin-detail-QLxU8r-5.js.map +0 -1
- package/dist/admin-detail-pPC8Q9l-.js +0 -710
- package/dist/admin-detail-pPC8Q9l-.js.map +0 -1
- package/dist/admin-dialog-width-BPrgdYlj.js +0 -6
- package/dist/admin-dialog-width-BPrgdYlj.js.map +0 -1
- package/dist/admin-format-DoohJ7Fg.js +0 -136
- package/dist/admin-format-DoohJ7Fg.js.map +0 -1
- package/dist/admin-health-D0L5Kig7.js.map +0 -1
- package/dist/admin-ops-CQP4TzWM.js +0 -235
- package/dist/admin-ops-CQP4TzWM.js.map +0 -1
- package/dist/admin-orders-BJ7W5S8P.js +0 -192
- package/dist/admin-orders-BJ7W5S8P.js.map +0 -1
- package/dist/admin-parked-B8xHkV2e.js +0 -193
- package/dist/admin-parked-B8xHkV2e.js.map +0 -1
- package/dist/admin-payments-CzkzqYA1.js +0 -246
- package/dist/admin-payments-CzkzqYA1.js.map +0 -1
- package/dist/admin-provider-prices-B6vwnVPi.js +0 -246
- package/dist/admin-provider-prices-B6vwnVPi.js.map +0 -1
- package/dist/admin-settings-DYC-c7mJ.js +0 -1813
- package/dist/admin-settings-DYC-c7mJ.js.map +0 -1
- package/dist/admin-status-badge-0-K37EfN.js +0 -43
- package/dist/admin-status-badge-0-K37EfN.js.map +0 -1
- package/dist/admin-subscriptions-CvW-YFs0.js +0 -301
- package/dist/admin-subscriptions-CvW-YFs0.js.map +0 -1
- package/dist/admin-tabs-D5lqdVcC.js +0 -46
- package/dist/admin-tabs-D5lqdVcC.js.map +0 -1
- package/dist/admin-utils-B9eEBNsR.js.map +0 -1
- package/dist/admin-widget-viz-8aukE3v_.js +0 -581
- package/dist/admin-widget-viz-8aukE3v_.js.map +0 -1
- package/dist/client-BYgnI6_h.js.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as s } from "./admin-button-
|
|
3
|
-
import { t as c } from "./admin-input-
|
|
4
|
-
import { t as l } from "./admin-skeleton-
|
|
5
|
-
import {
|
|
6
|
-
import { c as d,
|
|
1
|
+
import { E as e, O as t, c as n, p as r, r as i, s as a, w as o } from "./admin-utils-wuPUD0uh.js";
|
|
2
|
+
import { t as s } from "./admin-button-DBzTD6By.js";
|
|
3
|
+
import { t as c } from "./admin-input-JKrQIGfD.js";
|
|
4
|
+
import { t as l } from "./admin-skeleton-lndmw89u.js";
|
|
5
|
+
import { c as u } from "./admin-capabilities-CZdT1Pxe.js";
|
|
6
|
+
import { c as d, f, l as p, n as m, o as h, s as g } from "./admin-format-BbiTCqUG.js";
|
|
7
7
|
import { n as _ } from "./admin-confirm-katGq0Qo.js";
|
|
8
|
-
import { t as v } from "./admin-
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
11
|
-
import {
|
|
12
|
-
import { t as ne } from "./admin-
|
|
13
|
-
import { t as A } from "./admin-
|
|
14
|
-
import { a as re, i as ie, n as ae, o as oe, r as se, s as ce, t as le } from "./admin-dialog-
|
|
15
|
-
import { t as j } from "./admin-label-
|
|
16
|
-
import { t as ue } from "./admin-switch-
|
|
17
|
-
import {
|
|
8
|
+
import { t as v } from "./admin-badge-DR_8AhdC.js";
|
|
9
|
+
import { t as y } from "./admin-form-field-errors-hbUMIriS.js";
|
|
10
|
+
import { a as b, i as x, n as S, r as C, t as w } from "./admin-select-6Yuh5M1Q.js";
|
|
11
|
+
import { n as T, t as E } from "./admin-cursor-pager-C-KjCIy9.js";
|
|
12
|
+
import { a as D, n as ee, o as te, r as O, s as k, t as ne } from "./admin-table-D-GdGM1m.js";
|
|
13
|
+
import { t as A } from "./admin-linked-table-row-BMZYYsuk.js";
|
|
14
|
+
import { a as re, i as ie, n as ae, o as oe, r as se, s as ce, t as le } from "./admin-dialog-Dn2FRJu4.js";
|
|
15
|
+
import { t as j } from "./admin-label-CHWsVIZC.js";
|
|
16
|
+
import { t as ue } from "./admin-switch-DpwQSzEm.js";
|
|
17
|
+
import { i as de, r as fe } from "./admin-dialog-width-CC7QHT1p.js";
|
|
18
18
|
import * as M from "react";
|
|
19
19
|
import { useMutation as pe, useQuery as me, useQueryClient as he } from "@tanstack/react-query";
|
|
20
20
|
import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
@@ -243,53 +243,53 @@ function Le(e, t) {
|
|
|
243
243
|
}
|
|
244
244
|
//#endregion
|
|
245
245
|
//#region src/admin/pages/catalog/meter-form.tsx
|
|
246
|
-
function Re({ meter:
|
|
247
|
-
let { toast: a, toastApiError: o, adminMutations: l } =
|
|
248
|
-
defaultValues: Ee(
|
|
249
|
-
onSubmit: async ({ value:
|
|
246
|
+
function Re({ meter: n, writesAllowed: i }) {
|
|
247
|
+
let { toast: a, toastApiError: o, adminMutations: l } = r(), { id: u, text: d } = t(), [f, p] = M.useState(!1), [m, h] = M.useState(""), g = he(), _ = pe(l.putUsageMeter(g)), v = n ? Le(n, i) : null, T = Se({
|
|
248
|
+
defaultValues: Ee(n),
|
|
249
|
+
onSubmit: async ({ value: e }) => {
|
|
250
250
|
h("");
|
|
251
251
|
try {
|
|
252
|
-
let
|
|
253
|
-
|
|
254
|
-
} catch (
|
|
255
|
-
if (
|
|
256
|
-
h(
|
|
252
|
+
let t = De(e);
|
|
253
|
+
t.meter.expected_revision = n?.revision ?? 0, await _.mutateAsync(t), a.success(n ? "Meter updated" : "Meter created"), p(!1), T.reset();
|
|
254
|
+
} catch (e) {
|
|
255
|
+
if (e instanceof Error && !("status" in e)) {
|
|
256
|
+
h(e.message);
|
|
257
257
|
return;
|
|
258
258
|
}
|
|
259
|
-
o(
|
|
259
|
+
o(e, n ? "Update meter" : "Create meter");
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
});
|
|
263
|
-
return
|
|
263
|
+
return v ? /* @__PURE__ */ F(s, {
|
|
264
264
|
variant: "outline",
|
|
265
265
|
size: "sm",
|
|
266
266
|
disabled: !0,
|
|
267
|
-
title:
|
|
267
|
+
title: v,
|
|
268
268
|
children: [/* @__PURE__ */ P(I, {
|
|
269
269
|
icon: z,
|
|
270
270
|
className: "size-4"
|
|
271
|
-
}), /* @__PURE__ */ P(
|
|
271
|
+
}), /* @__PURE__ */ P(e, { id: "Edit definition" })]
|
|
272
272
|
}) : /* @__PURE__ */ F(le, {
|
|
273
273
|
open: f,
|
|
274
274
|
onOpenChange: (e) => {
|
|
275
275
|
p(e), h(""), e || T.reset();
|
|
276
276
|
},
|
|
277
277
|
children: [/* @__PURE__ */ P(ce, { render: /* @__PURE__ */ F(s, {
|
|
278
|
-
variant:
|
|
278
|
+
variant: n ? "outline" : "default",
|
|
279
279
|
size: "sm",
|
|
280
280
|
children: [/* @__PURE__ */ P(I, {
|
|
281
|
-
icon:
|
|
281
|
+
icon: n ? z : L,
|
|
282
282
|
className: "size-4"
|
|
283
|
-
}),
|
|
283
|
+
}), n ? "Edit definition" : "Create meter"]
|
|
284
284
|
}) }), /* @__PURE__ */ P(ae, {
|
|
285
|
-
className:
|
|
285
|
+
className: fe,
|
|
286
286
|
children: /* @__PURE__ */ F("form", {
|
|
287
287
|
className: "grid gap-5",
|
|
288
288
|
onSubmit: (e) => {
|
|
289
289
|
e.preventDefault(), e.stopPropagation(), T.handleSubmit();
|
|
290
290
|
},
|
|
291
291
|
children: [
|
|
292
|
-
/* @__PURE__ */ F(re, { children: [/* @__PURE__ */ P(oe, { children:
|
|
292
|
+
/* @__PURE__ */ F(re, { children: [/* @__PURE__ */ P(oe, { children: n ? "Edit meter" : "Create meter" }), /* @__PURE__ */ P(se, { children: /* @__PURE__ */ P(e, { id: "Define the event fields OpenRails will aggregate. Your host still reports each event through the usage API." }) })] }),
|
|
293
293
|
/* @__PURE__ */ F("div", {
|
|
294
294
|
className: "grid gap-4",
|
|
295
295
|
children: [
|
|
@@ -301,22 +301,22 @@ function Re({ meter: e, writesAllowed: r }) {
|
|
|
301
301
|
children: [
|
|
302
302
|
/* @__PURE__ */ P(j, {
|
|
303
303
|
htmlFor: u("meter-key"),
|
|
304
|
-
children: /* @__PURE__ */ P(
|
|
304
|
+
children: /* @__PURE__ */ P(e, { id: "Key" })
|
|
305
305
|
}),
|
|
306
306
|
/* @__PURE__ */ P(c, {
|
|
307
307
|
id: u("meter-key"),
|
|
308
308
|
value: t.state.value,
|
|
309
309
|
onChange: (e) => t.handleChange(e.target.value),
|
|
310
310
|
onBlur: t.handleBlur,
|
|
311
|
-
disabled: !!
|
|
311
|
+
disabled: !!n,
|
|
312
312
|
placeholder: d("api-tokens"),
|
|
313
313
|
autoComplete: "off"
|
|
314
314
|
}),
|
|
315
315
|
/* @__PURE__ */ P("p", {
|
|
316
316
|
className: "text-xs text-muted-foreground",
|
|
317
|
-
children: /* @__PURE__ */ P(
|
|
317
|
+
children: /* @__PURE__ */ P(e, { id: "Stable identifier. It cannot be renamed after creation." })
|
|
318
318
|
}),
|
|
319
|
-
/* @__PURE__ */ P(
|
|
319
|
+
/* @__PURE__ */ P(y, { errors: t.state.meta.errors })
|
|
320
320
|
]
|
|
321
321
|
})
|
|
322
322
|
}),
|
|
@@ -324,45 +324,45 @@ function Re({ meter: e, writesAllowed: r }) {
|
|
|
324
324
|
className: "grid gap-4 sm:grid-cols-2",
|
|
325
325
|
children: [/* @__PURE__ */ P(T.Field, {
|
|
326
326
|
name: "eventType",
|
|
327
|
-
children: (
|
|
327
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
328
328
|
className: "grid gap-1.5",
|
|
329
329
|
children: [
|
|
330
330
|
/* @__PURE__ */ P(j, {
|
|
331
331
|
htmlFor: u("meter-event-type"),
|
|
332
|
-
children: /* @__PURE__ */ P(
|
|
332
|
+
children: /* @__PURE__ */ P(e, { id: "Event type" })
|
|
333
333
|
}),
|
|
334
334
|
/* @__PURE__ */ P(c, {
|
|
335
335
|
id: u("meter-event-type"),
|
|
336
|
-
value:
|
|
337
|
-
onChange: (
|
|
336
|
+
value: t.state.value,
|
|
337
|
+
onChange: (e) => t.handleChange(e.target.value),
|
|
338
338
|
placeholder: d("token.used"),
|
|
339
339
|
autoComplete: "off"
|
|
340
340
|
}),
|
|
341
341
|
/* @__PURE__ */ P("p", {
|
|
342
342
|
className: "text-xs text-muted-foreground",
|
|
343
|
-
children: /* @__PURE__ */ P(
|
|
343
|
+
children: /* @__PURE__ */ P(e, { id: "Leave blank to use the meter key." })
|
|
344
344
|
})
|
|
345
345
|
]
|
|
346
346
|
})
|
|
347
347
|
}), /* @__PURE__ */ P(T.Field, {
|
|
348
348
|
name: "unit",
|
|
349
|
-
children: (
|
|
349
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
350
350
|
className: "grid gap-1.5",
|
|
351
351
|
children: [
|
|
352
352
|
/* @__PURE__ */ P(j, {
|
|
353
353
|
htmlFor: u("meter-unit"),
|
|
354
|
-
children: /* @__PURE__ */ P(
|
|
354
|
+
children: /* @__PURE__ */ P(e, { id: "Unit" })
|
|
355
355
|
}),
|
|
356
356
|
/* @__PURE__ */ P(c, {
|
|
357
357
|
id: u("meter-unit"),
|
|
358
|
-
value:
|
|
359
|
-
onChange: (
|
|
358
|
+
value: t.state.value,
|
|
359
|
+
onChange: (e) => t.handleChange(e.target.value),
|
|
360
360
|
placeholder: d("tokens"),
|
|
361
361
|
autoComplete: "off"
|
|
362
362
|
}),
|
|
363
363
|
/* @__PURE__ */ P("p", {
|
|
364
364
|
className: "text-xs text-muted-foreground",
|
|
365
|
-
children: /* @__PURE__ */ P(
|
|
365
|
+
children: /* @__PURE__ */ P(e, { id: "Human-readable quantity shown in billing." })
|
|
366
366
|
})
|
|
367
367
|
]
|
|
368
368
|
})
|
|
@@ -372,92 +372,92 @@ function Re({ meter: e, writesAllowed: r }) {
|
|
|
372
372
|
className: "grid gap-4 sm:grid-cols-2",
|
|
373
373
|
children: [/* @__PURE__ */ P(T.Field, {
|
|
374
374
|
name: "aggregation",
|
|
375
|
-
children: (
|
|
375
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
376
376
|
className: "grid gap-1.5",
|
|
377
377
|
children: [/* @__PURE__ */ P(j, {
|
|
378
378
|
htmlFor: u("meter-aggregation"),
|
|
379
|
-
children: /* @__PURE__ */ P(
|
|
380
|
-
}), /* @__PURE__ */ F(
|
|
381
|
-
value:
|
|
382
|
-
onValueChange: (
|
|
383
|
-
children: [/* @__PURE__ */ P(
|
|
379
|
+
children: /* @__PURE__ */ P(e, { id: "Aggregation" })
|
|
380
|
+
}), /* @__PURE__ */ F(w, {
|
|
381
|
+
value: t.state.value,
|
|
382
|
+
onValueChange: (e) => t.handleChange(e),
|
|
383
|
+
children: [/* @__PURE__ */ P(x, {
|
|
384
384
|
id: u("meter-aggregation"),
|
|
385
385
|
className: "w-full",
|
|
386
|
-
children: /* @__PURE__ */ P(
|
|
387
|
-
}), /* @__PURE__ */ F(
|
|
386
|
+
children: /* @__PURE__ */ P(b, {})
|
|
387
|
+
}), /* @__PURE__ */ F(S, { children: [/* @__PURE__ */ P(C, {
|
|
388
388
|
value: "sum",
|
|
389
|
-
children: /* @__PURE__ */ P(
|
|
390
|
-
}), /* @__PURE__ */ P(
|
|
389
|
+
children: /* @__PURE__ */ P(e, { id: "Sum a numeric field" })
|
|
390
|
+
}), /* @__PURE__ */ P(C, {
|
|
391
391
|
value: "count",
|
|
392
|
-
children: /* @__PURE__ */ P(
|
|
392
|
+
children: /* @__PURE__ */ P(e, { id: "Count events" })
|
|
393
393
|
})] })]
|
|
394
394
|
})]
|
|
395
395
|
})
|
|
396
396
|
}), /* @__PURE__ */ P(T.Subscribe, {
|
|
397
397
|
selector: (e) => e.values.aggregation,
|
|
398
|
-
children: (
|
|
398
|
+
children: (t) => t === "sum" ? /* @__PURE__ */ P(T.Field, {
|
|
399
399
|
name: "valueProperty",
|
|
400
400
|
validators: { onBlur: ({ value: e }) => e.trim() ? void 0 : "Sum meters require a value property." },
|
|
401
|
-
children: (
|
|
401
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
402
402
|
className: "grid gap-1.5",
|
|
403
403
|
children: [
|
|
404
404
|
/* @__PURE__ */ P(j, {
|
|
405
405
|
htmlFor: u("meter-value-property"),
|
|
406
|
-
children: /* @__PURE__ */ P(
|
|
406
|
+
children: /* @__PURE__ */ P(e, { id: "Value property" })
|
|
407
407
|
}),
|
|
408
408
|
/* @__PURE__ */ P(c, {
|
|
409
409
|
id: u("meter-value-property"),
|
|
410
|
-
value:
|
|
411
|
-
onChange: (
|
|
412
|
-
onBlur:
|
|
410
|
+
value: t.state.value,
|
|
411
|
+
onChange: (e) => t.handleChange(e.target.value),
|
|
412
|
+
onBlur: t.handleBlur,
|
|
413
413
|
placeholder: d("tokens"),
|
|
414
414
|
autoComplete: "off"
|
|
415
415
|
}),
|
|
416
|
-
/* @__PURE__ */ P(
|
|
416
|
+
/* @__PURE__ */ P(y, { errors: t.state.meta.errors })
|
|
417
417
|
]
|
|
418
418
|
})
|
|
419
419
|
}) : /* @__PURE__ */ P("div", {
|
|
420
420
|
className: "self-end rounded-lg bg-muted/50 px-3 py-2 text-xs text-muted-foreground",
|
|
421
|
-
children: /* @__PURE__ */ P(
|
|
421
|
+
children: /* @__PURE__ */ P(e, { id: "Count uses one unit for every matching event." })
|
|
422
422
|
})
|
|
423
423
|
})]
|
|
424
424
|
}),
|
|
425
425
|
/* @__PURE__ */ P(T.Field, {
|
|
426
426
|
name: "groupBy",
|
|
427
427
|
mode: "array",
|
|
428
|
-
children: (
|
|
428
|
+
children: (t) => /* @__PURE__ */ F("fieldset", {
|
|
429
429
|
className: "grid gap-2",
|
|
430
430
|
children: [/* @__PURE__ */ F("div", {
|
|
431
431
|
className: "flex items-center justify-between gap-3",
|
|
432
|
-
children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(j, { children: /* @__PURE__ */ P(
|
|
432
|
+
children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(j, { children: /* @__PURE__ */ P(e, { id: "Dimensions" }) }), /* @__PURE__ */ P("p", {
|
|
433
433
|
className: "text-xs text-muted-foreground",
|
|
434
|
-
children: /* @__PURE__ */ P(
|
|
434
|
+
children: /* @__PURE__ */ P(e, { id: "Register event properties used by filters or matrix rates." })
|
|
435
435
|
})] }), /* @__PURE__ */ F(s, {
|
|
436
436
|
type: "button",
|
|
437
437
|
variant: "outline",
|
|
438
438
|
size: "sm",
|
|
439
|
-
onClick: () =>
|
|
439
|
+
onClick: () => t.pushValue({
|
|
440
440
|
key: "",
|
|
441
441
|
value: ""
|
|
442
442
|
}),
|
|
443
443
|
children: [/* @__PURE__ */ P(I, {
|
|
444
444
|
icon: L,
|
|
445
445
|
className: "size-4"
|
|
446
|
-
}), /* @__PURE__ */ P(
|
|
446
|
+
}), /* @__PURE__ */ P(e, { id: "Add dimension" })]
|
|
447
447
|
})]
|
|
448
|
-
}),
|
|
448
|
+
}), t.state.value.map((e, n) => /* @__PURE__ */ F("div", {
|
|
449
449
|
className: "grid grid-cols-[1fr_1fr_auto] gap-2",
|
|
450
450
|
children: [
|
|
451
451
|
/* @__PURE__ */ P(c, {
|
|
452
452
|
"aria-label": `Dimension ${n + 1} name`,
|
|
453
|
-
value:
|
|
453
|
+
value: e.key,
|
|
454
454
|
onChange: (e) => T.setFieldValue(`groupBy[${n}].key`, e.target.value),
|
|
455
455
|
placeholder: d("model"),
|
|
456
456
|
autoComplete: "off"
|
|
457
457
|
}),
|
|
458
458
|
/* @__PURE__ */ P(c, {
|
|
459
459
|
"aria-label": `Dimension ${n + 1} property`,
|
|
460
|
-
value:
|
|
460
|
+
value: e.value,
|
|
461
461
|
onChange: (e) => T.setFieldValue(`groupBy[${n}].value`, e.target.value),
|
|
462
462
|
placeholder: d("metadata.model"),
|
|
463
463
|
autoComplete: "off"
|
|
@@ -467,7 +467,7 @@ function Re({ meter: e, writesAllowed: r }) {
|
|
|
467
467
|
variant: "ghost",
|
|
468
468
|
size: "icon",
|
|
469
469
|
"aria-label": `Remove dimension ${n + 1}`,
|
|
470
|
-
onClick: () =>
|
|
470
|
+
onClick: () => t.removeValue(n),
|
|
471
471
|
children: /* @__PURE__ */ P(I, {
|
|
472
472
|
icon: R,
|
|
473
473
|
className: "size-4"
|
|
@@ -488,7 +488,7 @@ function Re({ meter: e, writesAllowed: r }) {
|
|
|
488
488
|
type: "button",
|
|
489
489
|
variant: "outline",
|
|
490
490
|
onClick: () => p(!1),
|
|
491
|
-
children: /* @__PURE__ */ P(
|
|
491
|
+
children: /* @__PURE__ */ P(e, { id: "Cancel" })
|
|
492
492
|
}), /* @__PURE__ */ P(T.Subscribe, {
|
|
493
493
|
selector: (e) => e.isSubmitting,
|
|
494
494
|
children: (e) => /* @__PURE__ */ P(s, {
|
|
@@ -505,14 +505,14 @@ function Re({ meter: e, writesAllowed: r }) {
|
|
|
505
505
|
//#endregion
|
|
506
506
|
//#region src/admin/pages/catalog/rate-card-editor.tsx
|
|
507
507
|
var G = M.createContext(null);
|
|
508
|
-
function ze({ meter:
|
|
509
|
-
let { toast: f, toastApiError: p, adminMutations: m } =
|
|
508
|
+
function ze({ meter: n, writesAllowed: a = !1, products: o, productsPending: l = !1, productsError: u = !1, productsForbidden: d = !1 }) {
|
|
509
|
+
let { toast: f, toastApiError: p, adminMutations: m } = r(), { id: h, text: g } = t(), [v, y] = M.useState(!1), [T, E] = M.useState(null), D = _(), ee = he(), te = pe(m.putDefaultUsageRateCard(ee)), O = o.filter((e) => !e.archived), k = n.rate_card, ne = te.isPending, A = Se({
|
|
510
510
|
defaultValues: Oe(k),
|
|
511
511
|
onSubmit: async ({ value: e }) => {
|
|
512
512
|
E(null);
|
|
513
513
|
try {
|
|
514
514
|
let t = ke(e);
|
|
515
|
-
if (k && !await
|
|
515
|
+
if (k && !await D({
|
|
516
516
|
title: "Replace the default rate?",
|
|
517
517
|
description: "Amounts already charged do not change. New events use the new rate; admitted work keeps its pinned rate.",
|
|
518
518
|
confirmLabel: "Replace rate",
|
|
@@ -532,22 +532,22 @@ function ze({ meter: e, writesAllowed: r = !1, products: o, productsPending: l =
|
|
|
532
532
|
p(e, "Save rate card");
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
}), ue = async (
|
|
535
|
+
}), ue = async (e) => {
|
|
536
536
|
try {
|
|
537
|
-
await
|
|
538
|
-
meter:
|
|
539
|
-
rateCard:
|
|
540
|
-
}), f.success(k ? "Default rate replaced" : "Default rate added"),
|
|
537
|
+
await te.mutateAsync({
|
|
538
|
+
meter: n,
|
|
539
|
+
rateCard: e
|
|
540
|
+
}), f.success(k ? "Default rate replaced" : "Default rate added"), y(!1);
|
|
541
541
|
} catch (e) {
|
|
542
542
|
p(e, "Save default rate");
|
|
543
543
|
}
|
|
544
544
|
};
|
|
545
|
-
return !
|
|
545
|
+
return !a || !n.billing_supported ? null : /* @__PURE__ */ P(G.Provider, {
|
|
546
546
|
value: T,
|
|
547
547
|
children: /* @__PURE__ */ F(le, {
|
|
548
548
|
open: v,
|
|
549
549
|
onOpenChange: (e) => {
|
|
550
|
-
|
|
550
|
+
y(e), E(null), e || A.reset();
|
|
551
551
|
},
|
|
552
552
|
children: [/* @__PURE__ */ P(ce, { render: /* @__PURE__ */ F(s, {
|
|
553
553
|
variant: k ? "outline" : "default",
|
|
@@ -557,7 +557,7 @@ function ze({ meter: e, writesAllowed: r = !1, products: o, productsPending: l =
|
|
|
557
557
|
className: "size-4"
|
|
558
558
|
}), k ? "Edit default rate" : "Add default rate"]
|
|
559
559
|
}) }), /* @__PURE__ */ P(ae, {
|
|
560
|
-
className: `${
|
|
560
|
+
className: `${de} max-h-[calc(100dvh-2rem)] overflow-y-auto`,
|
|
561
561
|
children: /* @__PURE__ */ F("form", {
|
|
562
562
|
className: "grid gap-6",
|
|
563
563
|
onChange: () => E(null),
|
|
@@ -565,47 +565,47 @@ function ze({ meter: e, writesAllowed: r = !1, products: o, productsPending: l =
|
|
|
565
565
|
e.preventDefault(), e.stopPropagation(), A.handleSubmit();
|
|
566
566
|
},
|
|
567
567
|
children: [
|
|
568
|
-
/* @__PURE__ */ F(re, { children: [/* @__PURE__ */ P(oe, { children: k ? "Edit default rate" : "Add default rate" }), /* @__PURE__ */ P(se, { children: /* @__PURE__ */ P(
|
|
568
|
+
/* @__PURE__ */ F(re, { children: [/* @__PURE__ */ P(oe, { children: k ? "Edit default rate" : "Add default rate" }), /* @__PURE__ */ P(se, { children: /* @__PURE__ */ P(e, { id: "Set the price that charges every customer's usage as it is recorded. Money is entered in major currency units." }) })] }),
|
|
569
569
|
/* @__PURE__ */ F("section", {
|
|
570
570
|
className: "grid gap-4",
|
|
571
571
|
children: [/* @__PURE__ */ P("h3", {
|
|
572
572
|
className: "text-sm font-medium",
|
|
573
|
-
children: /* @__PURE__ */ P(
|
|
573
|
+
children: /* @__PURE__ */ P(e, { id: "Product and model" })
|
|
574
574
|
}), l ? /* @__PURE__ */ P("div", {
|
|
575
575
|
className: "rounded-lg bg-muted/50 p-3 text-sm text-muted-foreground",
|
|
576
|
-
children: /* @__PURE__ */ P(
|
|
576
|
+
children: /* @__PURE__ */ P(e, { id: "Loading products…" })
|
|
577
577
|
}) : u ? /* @__PURE__ */ P("div", {
|
|
578
578
|
role: "alert",
|
|
579
579
|
className: "rounded-lg bg-muted/50 p-3 text-sm text-destructive",
|
|
580
580
|
children: d ? "Your role cannot read products for this merchant." : "Products could not be loaded. Close this form and try again."
|
|
581
581
|
}) : O.length === 0 ? /* @__PURE__ */ F("div", {
|
|
582
582
|
className: "rounded-lg bg-muted/50 p-3 text-sm",
|
|
583
|
-
children: [/* @__PURE__ */ P("p", { children: /* @__PURE__ */ P(
|
|
583
|
+
children: [/* @__PURE__ */ P("p", { children: /* @__PURE__ */ P(e, { id: "No active products are available." }) }), /* @__PURE__ */ P(i, {
|
|
584
584
|
className: "text-primary underline underline-offset-3",
|
|
585
585
|
to: "/catalog",
|
|
586
|
-
children: /* @__PURE__ */ P(
|
|
586
|
+
children: /* @__PURE__ */ P(e, { id: "Create or activate a product first" })
|
|
587
587
|
})]
|
|
588
588
|
}) : /* @__PURE__ */ F("div", {
|
|
589
589
|
className: "grid gap-4 sm:grid-cols-3",
|
|
590
590
|
children: [
|
|
591
591
|
/* @__PURE__ */ P(A.Field, {
|
|
592
592
|
name: "productId",
|
|
593
|
-
children: (
|
|
593
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
594
594
|
className: "grid gap-1.5 sm:col-span-2",
|
|
595
595
|
children: [
|
|
596
596
|
/* @__PURE__ */ P(j, {
|
|
597
597
|
htmlFor: h("rate-product"),
|
|
598
|
-
children: /* @__PURE__ */ P(
|
|
598
|
+
children: /* @__PURE__ */ P(e, { id: "Product" })
|
|
599
599
|
}),
|
|
600
|
-
/* @__PURE__ */ F(
|
|
601
|
-
value:
|
|
602
|
-
onValueChange: (
|
|
603
|
-
children: [/* @__PURE__ */ P(
|
|
600
|
+
/* @__PURE__ */ F(w, {
|
|
601
|
+
value: t.state.value || null,
|
|
602
|
+
onValueChange: (e) => t.handleChange(e ?? ""),
|
|
603
|
+
children: [/* @__PURE__ */ P(x, {
|
|
604
604
|
id: h("rate-product"),
|
|
605
605
|
className: "w-full",
|
|
606
606
|
...Y("rate-product", T),
|
|
607
|
-
children: /* @__PURE__ */ P(
|
|
608
|
-
}), /* @__PURE__ */ P(
|
|
607
|
+
children: /* @__PURE__ */ P(b, { placeholder: g("Select product") })
|
|
608
|
+
}), /* @__PURE__ */ P(S, { children: O.map((e) => /* @__PURE__ */ P(C, {
|
|
609
609
|
value: e.id,
|
|
610
610
|
children: e.display_name
|
|
611
611
|
}, e.id)) })]
|
|
@@ -616,17 +616,17 @@ function ze({ meter: e, writesAllowed: r = !1, products: o, productsPending: l =
|
|
|
616
616
|
}),
|
|
617
617
|
/* @__PURE__ */ P(A.Field, {
|
|
618
618
|
name: "currency",
|
|
619
|
-
children: (
|
|
619
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
620
620
|
className: "grid gap-1.5",
|
|
621
621
|
children: [
|
|
622
622
|
/* @__PURE__ */ P(j, {
|
|
623
623
|
htmlFor: h("rate-currency"),
|
|
624
|
-
children: /* @__PURE__ */ P(
|
|
624
|
+
children: /* @__PURE__ */ P(e, { id: "Currency" })
|
|
625
625
|
}),
|
|
626
626
|
/* @__PURE__ */ P(c, {
|
|
627
627
|
id: h("rate-currency"),
|
|
628
|
-
value:
|
|
629
|
-
onChange: (
|
|
628
|
+
value: t.state.value,
|
|
629
|
+
onChange: (e) => t.handleChange(e.target.value.toUpperCase()),
|
|
630
630
|
maxLength: 3,
|
|
631
631
|
placeholder: g("USD"),
|
|
632
632
|
className: "uppercase",
|
|
@@ -639,7 +639,7 @@ function ze({ meter: e, writesAllowed: r = !1, products: o, productsPending: l =
|
|
|
639
639
|
}),
|
|
640
640
|
/* @__PURE__ */ P(Be, {
|
|
641
641
|
form: A,
|
|
642
|
-
meter:
|
|
642
|
+
meter: n
|
|
643
643
|
})
|
|
644
644
|
]
|
|
645
645
|
})]
|
|
@@ -651,24 +651,24 @@ function ze({ meter: e, writesAllowed: r = !1, products: o, productsPending: l =
|
|
|
651
651
|
children: [
|
|
652
652
|
/* @__PURE__ */ P("h3", {
|
|
653
653
|
className: "text-sm font-medium",
|
|
654
|
-
children: /* @__PURE__ */ P(
|
|
654
|
+
children: /* @__PURE__ */ P(e, { id: "Rate" })
|
|
655
655
|
}),
|
|
656
656
|
t === "per_unit" && /* @__PURE__ */ P(Ve, {
|
|
657
657
|
form: A,
|
|
658
|
-
meter:
|
|
658
|
+
meter: n
|
|
659
659
|
}),
|
|
660
660
|
t === "tiered" && /* @__PURE__ */ P(Ue, { form: A }),
|
|
661
661
|
t === "package" && /* @__PURE__ */ P(We, { form: A }),
|
|
662
662
|
t === "dynamic" && /* @__PURE__ */ P("p", {
|
|
663
663
|
className: "text-sm text-muted-foreground",
|
|
664
|
-
children: /* @__PURE__ */ P(
|
|
664
|
+
children: /* @__PURE__ */ P(e, { id: "Charge each event’s stated amount when it reports positive units. Missing amounts or zero units charge nothing." })
|
|
665
665
|
})
|
|
666
666
|
]
|
|
667
667
|
})
|
|
668
668
|
}),
|
|
669
669
|
/* @__PURE__ */ P(Ge, {
|
|
670
670
|
form: A,
|
|
671
|
-
meter:
|
|
671
|
+
meter: n
|
|
672
672
|
}),
|
|
673
673
|
/* @__PURE__ */ P(A.Subscribe, {
|
|
674
674
|
selector: (e) => e.values.model,
|
|
@@ -686,8 +686,8 @@ function ze({ meter: e, writesAllowed: r = !1, products: o, productsPending: l =
|
|
|
686
686
|
/* @__PURE__ */ F(ie, { children: [/* @__PURE__ */ P(s, {
|
|
687
687
|
type: "button",
|
|
688
688
|
variant: "outline",
|
|
689
|
-
onClick: () =>
|
|
690
|
-
children: /* @__PURE__ */ P(
|
|
689
|
+
onClick: () => y(!1),
|
|
690
|
+
children: /* @__PURE__ */ P(e, { id: "Cancel" })
|
|
691
691
|
}), /* @__PURE__ */ P(s, {
|
|
692
692
|
type: "submit",
|
|
693
693
|
disabled: ne || l || u || O.length === 0,
|
|
@@ -699,72 +699,72 @@ function ze({ meter: e, writesAllowed: r = !1, products: o, productsPending: l =
|
|
|
699
699
|
})
|
|
700
700
|
});
|
|
701
701
|
}
|
|
702
|
-
function Be({ form:
|
|
702
|
+
function Be({ form: n, meter: r }) {
|
|
703
703
|
let { id: i } = t();
|
|
704
|
-
return /* @__PURE__ */ P(
|
|
704
|
+
return /* @__PURE__ */ P(n.Field, {
|
|
705
705
|
name: "model",
|
|
706
|
-
children: (
|
|
706
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
707
707
|
className: "grid gap-1.5 sm:col-span-3",
|
|
708
708
|
children: [/* @__PURE__ */ P(j, {
|
|
709
709
|
htmlFor: i("rate-model"),
|
|
710
|
-
children: /* @__PURE__ */ P(
|
|
711
|
-
}), /* @__PURE__ */ F(
|
|
712
|
-
value:
|
|
713
|
-
onValueChange: (
|
|
714
|
-
children: [/* @__PURE__ */ P(
|
|
710
|
+
children: /* @__PURE__ */ P(e, { id: "Pricing model" })
|
|
711
|
+
}), /* @__PURE__ */ F(w, {
|
|
712
|
+
value: t.state.value,
|
|
713
|
+
onValueChange: (e) => t.handleChange(e),
|
|
714
|
+
children: [/* @__PURE__ */ P(x, {
|
|
715
715
|
id: i("rate-model"),
|
|
716
716
|
className: "w-full",
|
|
717
|
-
children: /* @__PURE__ */ P(
|
|
718
|
-
}), /* @__PURE__ */ F(
|
|
719
|
-
/* @__PURE__ */ P(
|
|
717
|
+
children: /* @__PURE__ */ P(b, {})
|
|
718
|
+
}), /* @__PURE__ */ F(S, { children: [
|
|
719
|
+
/* @__PURE__ */ P(C, {
|
|
720
720
|
value: "per_unit",
|
|
721
|
-
children: /* @__PURE__ */ P(
|
|
721
|
+
children: /* @__PURE__ */ P(e, { id: "Per unit" })
|
|
722
722
|
}),
|
|
723
|
-
/* @__PURE__ */ P(
|
|
723
|
+
/* @__PURE__ */ P(C, {
|
|
724
724
|
value: "tiered",
|
|
725
|
-
children: /* @__PURE__ */ P(
|
|
725
|
+
children: /* @__PURE__ */ P(e, { id: "Tiered" })
|
|
726
726
|
}),
|
|
727
|
-
/* @__PURE__ */ P(
|
|
727
|
+
/* @__PURE__ */ P(C, {
|
|
728
728
|
value: "package",
|
|
729
|
-
children: /* @__PURE__ */ P(
|
|
729
|
+
children: /* @__PURE__ */ P(e, { id: "Package" })
|
|
730
730
|
}),
|
|
731
|
-
/* @__PURE__ */ P(
|
|
731
|
+
/* @__PURE__ */ P(C, {
|
|
732
732
|
value: "dynamic",
|
|
733
733
|
disabled: r.aggregation !== "sum",
|
|
734
|
-
children: /* @__PURE__ */ P(
|
|
734
|
+
children: /* @__PURE__ */ P(e, { id: "Dynamic (event amount)" })
|
|
735
735
|
})
|
|
736
736
|
] })]
|
|
737
737
|
})]
|
|
738
738
|
})
|
|
739
739
|
});
|
|
740
740
|
}
|
|
741
|
-
function Ve({ form:
|
|
741
|
+
function Ve({ form: n, meter: r }) {
|
|
742
742
|
let { id: i, text: a } = t();
|
|
743
743
|
return /* @__PURE__ */ F(N, { children: [
|
|
744
|
-
/* @__PURE__ */ P(
|
|
744
|
+
/* @__PURE__ */ P(n.Field, {
|
|
745
745
|
name: "matrixEnabled",
|
|
746
|
-
children: (
|
|
746
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
747
747
|
className: "flex items-center justify-between gap-4 rounded-lg bg-muted/50 px-3 py-2.5",
|
|
748
748
|
children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(j, {
|
|
749
749
|
htmlFor: i("rate-matrix"),
|
|
750
|
-
children: /* @__PURE__ */ P(
|
|
750
|
+
children: /* @__PURE__ */ P(e, { id: "Use matrix rates" })
|
|
751
751
|
}), /* @__PURE__ */ P("p", {
|
|
752
752
|
className: "text-xs text-muted-foreground",
|
|
753
|
-
children: /* @__PURE__ */ P(
|
|
753
|
+
children: /* @__PURE__ */ P(e, { id: "Price each value of one registered dimension separately." })
|
|
754
754
|
})] }), /* @__PURE__ */ P(ue, {
|
|
755
755
|
id: i("rate-matrix"),
|
|
756
|
-
checked:
|
|
757
|
-
onCheckedChange:
|
|
756
|
+
checked: t.state.value,
|
|
757
|
+
onCheckedChange: t.handleChange,
|
|
758
758
|
disabled: Object.keys(r.group_by ?? {}).length === 0
|
|
759
759
|
})]
|
|
760
760
|
})
|
|
761
761
|
}),
|
|
762
|
-
/* @__PURE__ */ P(
|
|
762
|
+
/* @__PURE__ */ P(n.Subscribe, {
|
|
763
763
|
selector: (e) => e.values.matrixEnabled,
|
|
764
|
-
children: (
|
|
765
|
-
form:
|
|
764
|
+
children: (e) => e ? /* @__PURE__ */ P(He, {
|
|
765
|
+
form: n,
|
|
766
766
|
meter: r
|
|
767
|
-
}) : /* @__PURE__ */ P(
|
|
767
|
+
}) : /* @__PURE__ */ P(n.Field, {
|
|
768
768
|
name: "unitAmount",
|
|
769
769
|
children: (e) => /* @__PURE__ */ P(q, {
|
|
770
770
|
id: "rate-unit-amount",
|
|
@@ -778,7 +778,7 @@ function Ve({ form: e, meter: r }) {
|
|
|
778
778
|
/* @__PURE__ */ F("div", {
|
|
779
779
|
className: "grid gap-4 sm:grid-cols-3",
|
|
780
780
|
children: [
|
|
781
|
-
/* @__PURE__ */ P(
|
|
781
|
+
/* @__PURE__ */ P(n.Field, {
|
|
782
782
|
name: "divideBy",
|
|
783
783
|
children: (e) => /* @__PURE__ */ P(K, {
|
|
784
784
|
id: "rate-divide-by",
|
|
@@ -789,38 +789,38 @@ function Ve({ form: e, meter: r }) {
|
|
|
789
789
|
placeholder: "1"
|
|
790
790
|
})
|
|
791
791
|
}),
|
|
792
|
-
/* @__PURE__ */ P(
|
|
792
|
+
/* @__PURE__ */ P(n.Field, {
|
|
793
793
|
name: "round",
|
|
794
|
-
children: (
|
|
794
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
795
795
|
className: "grid gap-1.5",
|
|
796
796
|
children: [/* @__PURE__ */ P(j, {
|
|
797
797
|
htmlFor: i("rate-round"),
|
|
798
|
-
children: /* @__PURE__ */ P(
|
|
799
|
-
}), /* @__PURE__ */ F(
|
|
800
|
-
value:
|
|
801
|
-
onValueChange: (
|
|
802
|
-
children: [/* @__PURE__ */ P(
|
|
798
|
+
children: /* @__PURE__ */ P(e, { id: "Rounding" })
|
|
799
|
+
}), /* @__PURE__ */ F(w, {
|
|
800
|
+
value: t.state.value,
|
|
801
|
+
onValueChange: (e) => t.handleChange(e),
|
|
802
|
+
children: [/* @__PURE__ */ P(x, {
|
|
803
803
|
id: i("rate-round"),
|
|
804
804
|
className: "w-full",
|
|
805
|
-
children: /* @__PURE__ */ P(
|
|
806
|
-
}), /* @__PURE__ */ F(
|
|
807
|
-
/* @__PURE__ */ P(
|
|
805
|
+
children: /* @__PURE__ */ P(b, {})
|
|
806
|
+
}), /* @__PURE__ */ F(S, { children: [
|
|
807
|
+
/* @__PURE__ */ P(C, {
|
|
808
808
|
value: "half_up",
|
|
809
|
-
children: /* @__PURE__ */ P(
|
|
809
|
+
children: /* @__PURE__ */ P(e, { id: "Nearest" })
|
|
810
810
|
}),
|
|
811
|
-
/* @__PURE__ */ P(
|
|
811
|
+
/* @__PURE__ */ P(C, {
|
|
812
812
|
value: "up",
|
|
813
|
-
children: /* @__PURE__ */ P(
|
|
813
|
+
children: /* @__PURE__ */ P(e, { id: "Up" })
|
|
814
814
|
}),
|
|
815
|
-
/* @__PURE__ */ P(
|
|
815
|
+
/* @__PURE__ */ P(C, {
|
|
816
816
|
value: "down",
|
|
817
|
-
children: /* @__PURE__ */ P(
|
|
817
|
+
children: /* @__PURE__ */ P(e, { id: "Down" })
|
|
818
818
|
})
|
|
819
819
|
] })]
|
|
820
820
|
})]
|
|
821
821
|
})
|
|
822
822
|
}),
|
|
823
|
-
/* @__PURE__ */ P(
|
|
823
|
+
/* @__PURE__ */ P(n.Field, {
|
|
824
824
|
name: "maximumAmount",
|
|
825
825
|
children: (e) => /* @__PURE__ */ P(q, {
|
|
826
826
|
id: "rate-maximum",
|
|
@@ -834,26 +834,26 @@ function Ve({ form: e, meter: r }) {
|
|
|
834
834
|
})
|
|
835
835
|
] });
|
|
836
836
|
}
|
|
837
|
-
function He({ form:
|
|
837
|
+
function He({ form: n, meter: r }) {
|
|
838
838
|
let { id: i, text: a } = t(), o = M.useContext(G);
|
|
839
|
-
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
839
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(n.Field, {
|
|
840
840
|
name: "matrixDimension",
|
|
841
|
-
children: (
|
|
841
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
842
842
|
className: "grid gap-1.5",
|
|
843
843
|
children: [
|
|
844
844
|
/* @__PURE__ */ P(j, {
|
|
845
845
|
htmlFor: i("matrix-dimension"),
|
|
846
|
-
children: /* @__PURE__ */ P(
|
|
846
|
+
children: /* @__PURE__ */ P(e, { id: "Dimension" })
|
|
847
847
|
}),
|
|
848
|
-
/* @__PURE__ */ F(
|
|
849
|
-
value:
|
|
850
|
-
onValueChange: (
|
|
851
|
-
children: [/* @__PURE__ */ P(
|
|
848
|
+
/* @__PURE__ */ F(w, {
|
|
849
|
+
value: t.state.value || null,
|
|
850
|
+
onValueChange: (e) => t.handleChange(e ?? ""),
|
|
851
|
+
children: [/* @__PURE__ */ P(x, {
|
|
852
852
|
id: i("matrix-dimension"),
|
|
853
853
|
className: "w-full",
|
|
854
854
|
...Y("matrix-dimension", o),
|
|
855
|
-
children: /* @__PURE__ */ P(
|
|
856
|
-
}), /* @__PURE__ */ P(
|
|
855
|
+
children: /* @__PURE__ */ P(b, { placeholder: a("Select dimension") })
|
|
856
|
+
}), /* @__PURE__ */ P(S, { children: Object.keys(r.group_by ?? {}).map((e) => /* @__PURE__ */ P(C, {
|
|
857
857
|
value: e,
|
|
858
858
|
children: e
|
|
859
859
|
}, e)) })]
|
|
@@ -861,7 +861,7 @@ function He({ form: e, meter: r }) {
|
|
|
861
861
|
/* @__PURE__ */ P(X, { fieldId: "matrix-dimension" })
|
|
862
862
|
]
|
|
863
863
|
})
|
|
864
|
-
}), /* @__PURE__ */ P(
|
|
864
|
+
}), /* @__PURE__ */ P(n.Field, {
|
|
865
865
|
name: "matrixCells",
|
|
866
866
|
mode: "array",
|
|
867
867
|
children: (t) => /* @__PURE__ */ F("div", {
|
|
@@ -869,7 +869,7 @@ function He({ form: e, meter: r }) {
|
|
|
869
869
|
children: [
|
|
870
870
|
/* @__PURE__ */ F("div", {
|
|
871
871
|
className: "flex items-center justify-between gap-3",
|
|
872
|
-
children: [/* @__PURE__ */ P(j, { children: /* @__PURE__ */ P(
|
|
872
|
+
children: [/* @__PURE__ */ P(j, { children: /* @__PURE__ */ P(e, { id: "Matrix cells" }) }), /* @__PURE__ */ F(s, {
|
|
873
873
|
id: i("matrix-add-cell"),
|
|
874
874
|
type: "button",
|
|
875
875
|
variant: "outline",
|
|
@@ -882,45 +882,45 @@ function He({ form: e, meter: r }) {
|
|
|
882
882
|
children: [/* @__PURE__ */ P(I, {
|
|
883
883
|
icon: L,
|
|
884
884
|
className: "size-4"
|
|
885
|
-
}), /* @__PURE__ */ P(
|
|
885
|
+
}), /* @__PURE__ */ P(e, { id: "Add cell" })]
|
|
886
886
|
})]
|
|
887
887
|
}),
|
|
888
888
|
/* @__PURE__ */ P(X, { fieldId: "matrix-add-cell" }),
|
|
889
889
|
t.state.value.length > 0 && /* @__PURE__ */ F("div", {
|
|
890
890
|
className: "hidden gap-2 px-0.5 text-xs text-muted-foreground sm:grid sm:grid-cols-[1fr_1fr_1fr_auto]",
|
|
891
891
|
children: [
|
|
892
|
-
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(
|
|
893
|
-
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(
|
|
894
|
-
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(
|
|
892
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(e, { id: "Value" }) }),
|
|
893
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(e, { id: "Unit price" }) }),
|
|
894
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(e, { id: "Maximum" }) }),
|
|
895
895
|
/* @__PURE__ */ P("span", {
|
|
896
896
|
className: "size-8",
|
|
897
897
|
"aria-hidden": "true"
|
|
898
898
|
})
|
|
899
899
|
]
|
|
900
900
|
}),
|
|
901
|
-
t.state.value.map((
|
|
901
|
+
t.state.value.map((e, r) => /* @__PURE__ */ F("div", {
|
|
902
902
|
className: "grid gap-2 sm:grid-cols-[1fr_1fr_1fr_auto]",
|
|
903
903
|
children: [
|
|
904
904
|
/* @__PURE__ */ P(J, {
|
|
905
905
|
id: `matrix-cell-${r}-value`,
|
|
906
906
|
label: a("Value"),
|
|
907
|
-
value:
|
|
908
|
-
onChange: (
|
|
907
|
+
value: e.key,
|
|
908
|
+
onChange: (e) => n.setFieldValue(`matrixCells[${r}].key`, e),
|
|
909
909
|
placeholder: a("gpt-5")
|
|
910
910
|
}),
|
|
911
911
|
/* @__PURE__ */ P(J, {
|
|
912
912
|
id: `matrix-cell-${r}-unit-price`,
|
|
913
913
|
label: a("Unit price"),
|
|
914
|
-
value:
|
|
915
|
-
onChange: (
|
|
914
|
+
value: e.unitAmount,
|
|
915
|
+
onChange: (e) => n.setFieldValue(`matrixCells[${r}].unitAmount`, e),
|
|
916
916
|
inputMode: "decimal",
|
|
917
917
|
placeholder: a("Price")
|
|
918
918
|
}),
|
|
919
919
|
/* @__PURE__ */ P(J, {
|
|
920
920
|
id: `matrix-cell-${r}-maximum`,
|
|
921
921
|
label: a("Maximum"),
|
|
922
|
-
value:
|
|
923
|
-
onChange: (
|
|
922
|
+
value: e.maximumAmount,
|
|
923
|
+
onChange: (e) => n.setFieldValue(`matrixCells[${r}].maximumAmount`, e),
|
|
924
924
|
inputMode: "decimal",
|
|
925
925
|
placeholder: a("Maximum")
|
|
926
926
|
}),
|
|
@@ -934,9 +934,9 @@ function He({ form: e, meter: r }) {
|
|
|
934
934
|
})
|
|
935
935
|
})] });
|
|
936
936
|
}
|
|
937
|
-
function Ue({ form:
|
|
937
|
+
function Ue({ form: n }) {
|
|
938
938
|
let { id: r, text: i } = t();
|
|
939
|
-
return /* @__PURE__ */ P(N, { children: /* @__PURE__ */ P(
|
|
939
|
+
return /* @__PURE__ */ P(N, { children: /* @__PURE__ */ P(n.Field, {
|
|
940
940
|
name: "tiers",
|
|
941
941
|
mode: "array",
|
|
942
942
|
children: (t) => /* @__PURE__ */ F("div", {
|
|
@@ -944,9 +944,9 @@ function Ue({ form: e }) {
|
|
|
944
944
|
children: [
|
|
945
945
|
/* @__PURE__ */ F("div", {
|
|
946
946
|
className: "flex items-center justify-between gap-3",
|
|
947
|
-
children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(j, { children: /* @__PURE__ */ P(
|
|
947
|
+
children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(j, { children: /* @__PURE__ */ P(e, { id: "Tiers" }) }), /* @__PURE__ */ P("p", {
|
|
948
948
|
className: "text-xs text-muted-foreground",
|
|
949
|
-
children: /* @__PURE__ */ P(
|
|
949
|
+
children: /* @__PURE__ */ P(e, { id: "Leave the final limit blank for the unbounded tier." })
|
|
950
950
|
})] }), /* @__PURE__ */ F(s, {
|
|
951
951
|
id: r("tier-add"),
|
|
952
952
|
type: "button",
|
|
@@ -960,46 +960,46 @@ function Ue({ form: e }) {
|
|
|
960
960
|
children: [/* @__PURE__ */ P(I, {
|
|
961
961
|
icon: L,
|
|
962
962
|
className: "size-4"
|
|
963
|
-
}), /* @__PURE__ */ P(
|
|
963
|
+
}), /* @__PURE__ */ P(e, { id: "Add tier" })]
|
|
964
964
|
})]
|
|
965
965
|
}),
|
|
966
966
|
/* @__PURE__ */ P(X, { fieldId: "tier-add" }),
|
|
967
967
|
t.state.value.length > 0 && /* @__PURE__ */ F("div", {
|
|
968
968
|
className: "hidden gap-2 px-0.5 text-xs text-muted-foreground sm:grid sm:grid-cols-[1fr_1fr_1fr_auto]",
|
|
969
969
|
children: [
|
|
970
|
-
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(
|
|
971
|
-
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(
|
|
972
|
-
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(
|
|
970
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(e, { id: "Upper limit" }) }),
|
|
971
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(e, { id: "Unit price" }) }),
|
|
972
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(e, { id: "Flat amount" }) }),
|
|
973
973
|
/* @__PURE__ */ P("span", {
|
|
974
974
|
className: "size-8",
|
|
975
975
|
"aria-hidden": "true"
|
|
976
976
|
})
|
|
977
977
|
]
|
|
978
978
|
}),
|
|
979
|
-
t.state.value.map((
|
|
979
|
+
t.state.value.map((e, r) => /* @__PURE__ */ F("div", {
|
|
980
980
|
className: "grid gap-2 sm:grid-cols-[1fr_1fr_1fr_auto]",
|
|
981
981
|
children: [
|
|
982
982
|
/* @__PURE__ */ P(J, {
|
|
983
983
|
id: `tier-${r}-limit`,
|
|
984
984
|
label: i("Upper limit"),
|
|
985
|
-
value:
|
|
986
|
-
onChange: (
|
|
985
|
+
value: e.upTo,
|
|
986
|
+
onChange: (e) => n.setFieldValue(`tiers[${r}].upTo`, e),
|
|
987
987
|
inputMode: "numeric",
|
|
988
988
|
placeholder: r === t.state.value.length - 1 ? "No limit" : "Up to"
|
|
989
989
|
}),
|
|
990
990
|
/* @__PURE__ */ P(J, {
|
|
991
991
|
id: `tier-${r}-unit-price`,
|
|
992
992
|
label: i("Unit price"),
|
|
993
|
-
value:
|
|
994
|
-
onChange: (
|
|
993
|
+
value: e.unitAmount,
|
|
994
|
+
onChange: (e) => n.setFieldValue(`tiers[${r}].unitAmount`, e),
|
|
995
995
|
inputMode: "decimal",
|
|
996
996
|
placeholder: i("Unit price")
|
|
997
997
|
}),
|
|
998
998
|
/* @__PURE__ */ P(J, {
|
|
999
999
|
id: `tier-${r}-flat-amount`,
|
|
1000
1000
|
label: i("Flat amount"),
|
|
1001
|
-
value:
|
|
1002
|
-
onChange: (
|
|
1001
|
+
value: e.flatAmount,
|
|
1002
|
+
onChange: (e) => n.setFieldValue(`tiers[${r}].flatAmount`, e),
|
|
1003
1003
|
inputMode: "decimal",
|
|
1004
1004
|
placeholder: i("Flat amount")
|
|
1005
1005
|
}),
|
|
@@ -1054,17 +1054,17 @@ function We({ form: e }) {
|
|
|
1054
1054
|
]
|
|
1055
1055
|
});
|
|
1056
1056
|
}
|
|
1057
|
-
function Ge({ form:
|
|
1057
|
+
function Ge({ form: n, meter: r }) {
|
|
1058
1058
|
let { id: i, text: a } = t(), o = M.useContext(G);
|
|
1059
1059
|
return /* @__PURE__ */ F("section", {
|
|
1060
1060
|
className: "grid gap-3 border-t pt-5",
|
|
1061
1061
|
children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("h3", {
|
|
1062
1062
|
className: "text-sm font-medium",
|
|
1063
|
-
children: /* @__PURE__ */ P(
|
|
1063
|
+
children: /* @__PURE__ */ P(e, { id: "Event filters" })
|
|
1064
1064
|
}), /* @__PURE__ */ P("p", {
|
|
1065
1065
|
className: "text-xs text-muted-foreground",
|
|
1066
|
-
children: /* @__PURE__ */ P(
|
|
1067
|
-
})] }), /* @__PURE__ */ P(
|
|
1066
|
+
children: /* @__PURE__ */ P(e, { id: "Optional. Only events with one of the listed dimension values are rated." })
|
|
1067
|
+
})] }), /* @__PURE__ */ P(n.Field, {
|
|
1068
1068
|
name: "filters",
|
|
1069
1069
|
mode: "array",
|
|
1070
1070
|
children: (t) => /* @__PURE__ */ F("div", {
|
|
@@ -1073,8 +1073,8 @@ function Ge({ form: e, meter: r }) {
|
|
|
1073
1073
|
t.state.value.length > 0 && /* @__PURE__ */ F("div", {
|
|
1074
1074
|
className: "hidden gap-2 px-0.5 text-xs text-muted-foreground sm:grid sm:grid-cols-[1fr_2fr_auto]",
|
|
1075
1075
|
children: [
|
|
1076
|
-
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(
|
|
1077
|
-
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(
|
|
1076
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(e, { id: "Dimension" }) }),
|
|
1077
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(e, { id: "Values" }) }),
|
|
1078
1078
|
/* @__PURE__ */ P("span", {
|
|
1079
1079
|
className: "size-8",
|
|
1080
1080
|
"aria-hidden": "true"
|
|
@@ -1090,17 +1090,17 @@ function Ge({ form: e, meter: r }) {
|
|
|
1090
1090
|
/* @__PURE__ */ P(j, {
|
|
1091
1091
|
htmlFor: i(`filter-${c}-dimension`),
|
|
1092
1092
|
className: "text-xs text-muted-foreground sm:sr-only",
|
|
1093
|
-
children: /* @__PURE__ */ P(
|
|
1093
|
+
children: /* @__PURE__ */ P(e, { id: "Dimension" })
|
|
1094
1094
|
}),
|
|
1095
|
-
/* @__PURE__ */ F(
|
|
1095
|
+
/* @__PURE__ */ F(w, {
|
|
1096
1096
|
value: s.key || null,
|
|
1097
|
-
onValueChange: (
|
|
1098
|
-
children: [/* @__PURE__ */ P(
|
|
1097
|
+
onValueChange: (e) => n.setFieldValue(`filters[${c}].key`, e ?? ""),
|
|
1098
|
+
children: [/* @__PURE__ */ P(x, {
|
|
1099
1099
|
id: i(`filter-${c}-dimension`),
|
|
1100
1100
|
className: "w-full",
|
|
1101
1101
|
...Y(`filter-${c}-dimension`, o),
|
|
1102
|
-
children: /* @__PURE__ */ P(
|
|
1103
|
-
}), /* @__PURE__ */ P(
|
|
1102
|
+
children: /* @__PURE__ */ P(b, { placeholder: a("Dimension") })
|
|
1103
|
+
}), /* @__PURE__ */ P(S, { children: Object.keys(r.group_by ?? {}).map((e) => /* @__PURE__ */ P(C, {
|
|
1104
1104
|
value: e,
|
|
1105
1105
|
children: e
|
|
1106
1106
|
}, e)) })]
|
|
@@ -1112,7 +1112,7 @@ function Ge({ form: e, meter: r }) {
|
|
|
1112
1112
|
id: `filter-${c}-values`,
|
|
1113
1113
|
label: a("Values"),
|
|
1114
1114
|
value: s.value,
|
|
1115
|
-
onChange: (
|
|
1115
|
+
onChange: (e) => n.setFieldValue(`filters[${c}].value`, e),
|
|
1116
1116
|
placeholder: a("eu, us")
|
|
1117
1117
|
}),
|
|
1118
1118
|
/* @__PURE__ */ P(Ye, {
|
|
@@ -1134,49 +1134,49 @@ function Ge({ form: e, meter: r }) {
|
|
|
1134
1134
|
children: [/* @__PURE__ */ P(I, {
|
|
1135
1135
|
icon: L,
|
|
1136
1136
|
className: "size-4"
|
|
1137
|
-
}), /* @__PURE__ */ P(
|
|
1137
|
+
}), /* @__PURE__ */ P(e, { id: "Add filter" })]
|
|
1138
1138
|
})
|
|
1139
1139
|
]
|
|
1140
1140
|
})
|
|
1141
1141
|
})]
|
|
1142
1142
|
});
|
|
1143
1143
|
}
|
|
1144
|
-
function Ke({ form:
|
|
1144
|
+
function Ke({ form: n }) {
|
|
1145
1145
|
let { id: r, text: i } = t();
|
|
1146
1146
|
return /* @__PURE__ */ F("section", {
|
|
1147
1147
|
className: "grid gap-4 border-t pt-5",
|
|
1148
1148
|
children: [
|
|
1149
1149
|
/* @__PURE__ */ P("h3", {
|
|
1150
1150
|
className: "text-sm font-medium",
|
|
1151
|
-
children: /* @__PURE__ */ P(
|
|
1151
|
+
children: /* @__PURE__ */ P(e, { id: "Allowance" })
|
|
1152
1152
|
}),
|
|
1153
|
-
/* @__PURE__ */ P(
|
|
1153
|
+
/* @__PURE__ */ P(n.Field, {
|
|
1154
1154
|
name: "allowanceMode",
|
|
1155
|
-
children: (
|
|
1155
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
1156
1156
|
className: "grid gap-1.5",
|
|
1157
1157
|
children: [/* @__PURE__ */ P(j, {
|
|
1158
1158
|
htmlFor: r("allowance-mode"),
|
|
1159
|
-
children: /* @__PURE__ */ P(
|
|
1160
|
-
}), /* @__PURE__ */ F(
|
|
1161
|
-
value:
|
|
1162
|
-
onValueChange: (
|
|
1163
|
-
children: [/* @__PURE__ */ P(
|
|
1159
|
+
children: /* @__PURE__ */ P(e, { id: "Included usage" })
|
|
1160
|
+
}), /* @__PURE__ */ F(w, {
|
|
1161
|
+
value: t.state.value,
|
|
1162
|
+
onValueChange: (e) => t.handleChange(e),
|
|
1163
|
+
children: [/* @__PURE__ */ P(x, {
|
|
1164
1164
|
id: r("allowance-mode"),
|
|
1165
1165
|
className: "w-full",
|
|
1166
|
-
children: /* @__PURE__ */ P(
|
|
1167
|
-
}), /* @__PURE__ */ F(
|
|
1166
|
+
children: /* @__PURE__ */ P(b, {})
|
|
1167
|
+
}), /* @__PURE__ */ F(S, { children: [/* @__PURE__ */ P(C, {
|
|
1168
1168
|
value: "none",
|
|
1169
|
-
children: /* @__PURE__ */ P(
|
|
1170
|
-
}), /* @__PURE__ */ P(
|
|
1169
|
+
children: /* @__PURE__ */ P(e, { id: "No allowance" })
|
|
1170
|
+
}), /* @__PURE__ */ P(C, {
|
|
1171
1171
|
value: "included",
|
|
1172
|
-
children: /* @__PURE__ */ P(
|
|
1172
|
+
children: /* @__PURE__ */ P(e, { id: "Fixed included units" })
|
|
1173
1173
|
})] })]
|
|
1174
1174
|
})]
|
|
1175
1175
|
})
|
|
1176
1176
|
}),
|
|
1177
|
-
/* @__PURE__ */ P(
|
|
1177
|
+
/* @__PURE__ */ P(n.Subscribe, {
|
|
1178
1178
|
selector: (e) => e.values.allowanceMode,
|
|
1179
|
-
children: (
|
|
1179
|
+
children: (e) => e === "included" ? /* @__PURE__ */ P(n.Field, {
|
|
1180
1180
|
name: "allowanceIncluded",
|
|
1181
1181
|
children: (e) => /* @__PURE__ */ P(K, {
|
|
1182
1182
|
id: "allowance-included",
|
|
@@ -1191,21 +1191,21 @@ function Ke({ form: e }) {
|
|
|
1191
1191
|
]
|
|
1192
1192
|
});
|
|
1193
1193
|
}
|
|
1194
|
-
function qe({ values:
|
|
1195
|
-
let
|
|
1194
|
+
function qe({ values: t }) {
|
|
1195
|
+
let n = "Complete the required fields to preview this rate.";
|
|
1196
1196
|
try {
|
|
1197
|
-
let
|
|
1198
|
-
|
|
1197
|
+
let e = ke(t);
|
|
1198
|
+
n = Ie({ price: e.price }), e.allowance?.included !== void 0 && (n += ` · ${e.allowance.included.toLocaleString()} included`);
|
|
1199
1199
|
} catch {}
|
|
1200
1200
|
return /* @__PURE__ */ F("section", {
|
|
1201
1201
|
className: "rounded-lg bg-muted/50 px-3 py-2.5",
|
|
1202
1202
|
"aria-live": "polite",
|
|
1203
1203
|
children: [/* @__PURE__ */ P("p", {
|
|
1204
1204
|
className: "text-xs font-medium text-muted-foreground",
|
|
1205
|
-
children: /* @__PURE__ */ P(
|
|
1205
|
+
children: /* @__PURE__ */ P(e, { id: "Rate preview" })
|
|
1206
1206
|
}), /* @__PURE__ */ P("p", {
|
|
1207
1207
|
className: "mt-1 text-sm font-medium tabular-nums",
|
|
1208
|
-
children:
|
|
1208
|
+
children: n
|
|
1209
1209
|
})]
|
|
1210
1210
|
});
|
|
1211
1211
|
}
|
|
@@ -1304,7 +1304,7 @@ function Ye({ label: e, onClick: t, disabled: n }) {
|
|
|
1304
1304
|
//#region src/admin/pages/catalog/metering.tsx
|
|
1305
1305
|
var Xe = 200;
|
|
1306
1306
|
function Ze() {
|
|
1307
|
-
let { text:
|
|
1307
|
+
let { text: n } = t(), { adminQueries: i } = r(), [a, l] = M.useState(""), d = T("", Xe), { data: f, isPending: p, error: m, refetch: h } = me(i.usageMeters(d.size, d.cursor)), g = u(), _ = f?.data ?? [], v = a.trim().toLowerCase(), y = v ? _.filter((e) => [
|
|
1308
1308
|
e.key,
|
|
1309
1309
|
e.event_type,
|
|
1310
1310
|
e.aggregation,
|
|
@@ -1312,7 +1312,7 @@ function Ze() {
|
|
|
1312
1312
|
e.rate_card?.product_key
|
|
1313
1313
|
].some((e) => e?.toLowerCase().includes(v))) : _, b = we({
|
|
1314
1314
|
pending: p,
|
|
1315
|
-
error: m instanceof
|
|
1315
|
+
error: m instanceof o ? m : m ? { status: 500 } : null,
|
|
1316
1316
|
count: _.length
|
|
1317
1317
|
});
|
|
1318
1318
|
return /* @__PURE__ */ F("div", {
|
|
@@ -1324,29 +1324,29 @@ function Ze() {
|
|
|
1324
1324
|
className: "max-w-2xl",
|
|
1325
1325
|
children: [/* @__PURE__ */ P("h1", {
|
|
1326
1326
|
className: "text-2xl font-semibold tracking-tight text-balance",
|
|
1327
|
-
children: /* @__PURE__ */ P(
|
|
1327
|
+
children: /* @__PURE__ */ P(e, { id: "Metering" })
|
|
1328
1328
|
}), /* @__PURE__ */ P("p", {
|
|
1329
1329
|
className: "mt-1 text-sm text-pretty text-muted-foreground",
|
|
1330
|
-
children: /* @__PURE__ */ P(
|
|
1330
|
+
children: /* @__PURE__ */ P(e, { id: "Define usage streams and the default rates charged when usage is recorded. Applications report the events separately." })
|
|
1331
1331
|
})]
|
|
1332
1332
|
}), g && b !== "permission" && /* @__PURE__ */ P(Re, { writesAllowed: !0 })]
|
|
1333
1333
|
}),
|
|
1334
|
-
f && !g && /* @__PURE__ */ P(Q, { children: /* @__PURE__ */ P(
|
|
1334
|
+
f && !g && /* @__PURE__ */ P(Q, { children: /* @__PURE__ */ P(e, { id: "Catalog updates are disabled. Meter definitions and rates are visible here; changes require the host operator." }) }),
|
|
1335
1335
|
b === "loading" ? /* @__PURE__ */ P(tt, {}) : b === "permission" ? /* @__PURE__ */ P($, {
|
|
1336
|
-
title:
|
|
1337
|
-
description:
|
|
1336
|
+
title: n("Metering access is restricted"),
|
|
1337
|
+
description: n("Your role does not have permission to read the merchant catalog.")
|
|
1338
1338
|
}) : b === "error" ? /* @__PURE__ */ P($, {
|
|
1339
|
-
title:
|
|
1340
|
-
description:
|
|
1339
|
+
title: n("Metering could not be loaded"),
|
|
1340
|
+
description: n("Try again. If the problem continues, check the OpenRails API logs."),
|
|
1341
1341
|
action: /* @__PURE__ */ P(s, {
|
|
1342
1342
|
variant: "outline",
|
|
1343
1343
|
size: "sm",
|
|
1344
1344
|
onClick: () => void h(),
|
|
1345
|
-
children: /* @__PURE__ */ P(
|
|
1345
|
+
children: /* @__PURE__ */ P(e, { id: "Try again" })
|
|
1346
1346
|
})
|
|
1347
1347
|
}) : b === "empty" ? /* @__PURE__ */ P($, {
|
|
1348
|
-
title:
|
|
1349
|
-
description:
|
|
1348
|
+
title: n("No usage meters yet"),
|
|
1349
|
+
description: n("Create a meter to describe the events your application will report and bill."),
|
|
1350
1350
|
action: g ? /* @__PURE__ */ P(Re, { writesAllowed: !0 }) : void 0
|
|
1351
1351
|
}) : /* @__PURE__ */ F(N, { children: [
|
|
1352
1352
|
/* @__PURE__ */ F("div", {
|
|
@@ -1355,62 +1355,62 @@ function Ze() {
|
|
|
1355
1355
|
icon: xe,
|
|
1356
1356
|
className: "absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground"
|
|
1357
1357
|
}), /* @__PURE__ */ P(c, {
|
|
1358
|
-
value:
|
|
1358
|
+
value: a,
|
|
1359
1359
|
onChange: (e) => l(e.target.value),
|
|
1360
1360
|
className: "pl-8",
|
|
1361
|
-
placeholder:
|
|
1362
|
-
"aria-label":
|
|
1361
|
+
placeholder: n("Filter this page…"),
|
|
1362
|
+
"aria-label": n("Filter meters on this page")
|
|
1363
1363
|
})]
|
|
1364
1364
|
}),
|
|
1365
1365
|
/* @__PURE__ */ P("div", {
|
|
1366
1366
|
className: "max-w-full overflow-x-auto",
|
|
1367
|
-
children: /* @__PURE__ */ F(
|
|
1367
|
+
children: /* @__PURE__ */ F(ne, { children: [/* @__PURE__ */ P(te, { children: /* @__PURE__ */ F(k, {
|
|
1368
1368
|
className: "hover:bg-transparent",
|
|
1369
1369
|
children: [
|
|
1370
|
-
/* @__PURE__ */ P(
|
|
1370
|
+
/* @__PURE__ */ P(D, {
|
|
1371
1371
|
className: "text-muted-foreground",
|
|
1372
|
-
children: /* @__PURE__ */ P(
|
|
1372
|
+
children: /* @__PURE__ */ P(e, { id: "Meter" })
|
|
1373
1373
|
}),
|
|
1374
|
-
/* @__PURE__ */ P(
|
|
1374
|
+
/* @__PURE__ */ P(D, {
|
|
1375
1375
|
className: "text-muted-foreground",
|
|
1376
|
-
children: /* @__PURE__ */ P(
|
|
1376
|
+
children: /* @__PURE__ */ P(e, { id: "Event" })
|
|
1377
1377
|
}),
|
|
1378
|
-
/* @__PURE__ */ P(
|
|
1378
|
+
/* @__PURE__ */ P(D, {
|
|
1379
1379
|
className: "text-muted-foreground",
|
|
1380
|
-
children: /* @__PURE__ */ P(
|
|
1380
|
+
children: /* @__PURE__ */ P(e, { id: "Aggregation" })
|
|
1381
1381
|
}),
|
|
1382
|
-
/* @__PURE__ */ P(
|
|
1382
|
+
/* @__PURE__ */ P(D, {
|
|
1383
1383
|
className: "text-muted-foreground",
|
|
1384
|
-
children: /* @__PURE__ */ P(
|
|
1384
|
+
children: /* @__PURE__ */ P(e, { id: "Default price" })
|
|
1385
1385
|
}),
|
|
1386
|
-
/* @__PURE__ */ P(
|
|
1386
|
+
/* @__PURE__ */ P(D, {
|
|
1387
1387
|
className: "text-muted-foreground",
|
|
1388
|
-
children: /* @__PURE__ */ P(
|
|
1388
|
+
children: /* @__PURE__ */ P(e, { id: "Product" })
|
|
1389
1389
|
}),
|
|
1390
|
-
/* @__PURE__ */ P(
|
|
1390
|
+
/* @__PURE__ */ P(D, {
|
|
1391
1391
|
className: "text-muted-foreground",
|
|
1392
|
-
children: /* @__PURE__ */ P(
|
|
1392
|
+
children: /* @__PURE__ */ P(e, { id: "Activity" })
|
|
1393
1393
|
}),
|
|
1394
|
-
/* @__PURE__ */ P(
|
|
1394
|
+
/* @__PURE__ */ P(D, {
|
|
1395
1395
|
className: "text-muted-foreground",
|
|
1396
|
-
children: /* @__PURE__ */ P(
|
|
1396
|
+
children: /* @__PURE__ */ P(e, { id: "Last event" })
|
|
1397
1397
|
}),
|
|
1398
|
-
/* @__PURE__ */ P(
|
|
1398
|
+
/* @__PURE__ */ P(D, { children: /* @__PURE__ */ P("span", {
|
|
1399
1399
|
className: "sr-only",
|
|
1400
|
-
children: /* @__PURE__ */ P(
|
|
1400
|
+
children: /* @__PURE__ */ P(e, { id: "Open" })
|
|
1401
1401
|
}) })
|
|
1402
1402
|
]
|
|
1403
|
-
}) }), /* @__PURE__ */ F(ee, { children: [y.map((e) => /* @__PURE__ */ P(Qe, { meter: e }, e.key)), y.length === 0 && /* @__PURE__ */ P(
|
|
1403
|
+
}) }), /* @__PURE__ */ F(ee, { children: [y.map((e) => /* @__PURE__ */ P(Qe, { meter: e }, e.key)), y.length === 0 && /* @__PURE__ */ P(k, { children: /* @__PURE__ */ F(O, {
|
|
1404
1404
|
colSpan: 9,
|
|
1405
1405
|
className: "h-24 text-center text-muted-foreground",
|
|
1406
1406
|
children: [
|
|
1407
|
-
/* @__PURE__ */ P(
|
|
1408
|
-
|
|
1407
|
+
/* @__PURE__ */ P(e, { id: "No meters on this page match “" }),
|
|
1408
|
+
a,
|
|
1409
1409
|
"”."
|
|
1410
1410
|
]
|
|
1411
1411
|
}) })] })] })
|
|
1412
1412
|
}),
|
|
1413
|
-
/* @__PURE__ */ P(
|
|
1413
|
+
/* @__PURE__ */ P(E, {
|
|
1414
1414
|
pages: d,
|
|
1415
1415
|
rows: f?.data?.length ?? 0,
|
|
1416
1416
|
nextCursor: f?.next_cursor,
|
|
@@ -1426,10 +1426,10 @@ function Ze() {
|
|
|
1426
1426
|
});
|
|
1427
1427
|
}
|
|
1428
1428
|
function Qe({ meter: e }) {
|
|
1429
|
-
return /* @__PURE__ */ F(
|
|
1429
|
+
return /* @__PURE__ */ F(A, {
|
|
1430
1430
|
to: `/catalog/metering/${encodeURIComponent(e.key)}`,
|
|
1431
1431
|
children: [
|
|
1432
|
-
/* @__PURE__ */ F(
|
|
1432
|
+
/* @__PURE__ */ F(O, { children: [/* @__PURE__ */ P(i, {
|
|
1433
1433
|
className: "font-medium underline-offset-3 hover:underline",
|
|
1434
1434
|
to: `/catalog/metering/${encodeURIComponent(e.key)}`,
|
|
1435
1435
|
children: e.key
|
|
@@ -1437,25 +1437,25 @@ function Qe({ meter: e }) {
|
|
|
1437
1437
|
className: "text-xs text-muted-foreground",
|
|
1438
1438
|
children: e.unit
|
|
1439
1439
|
})] }),
|
|
1440
|
-
/* @__PURE__ */ P(
|
|
1441
|
-
/* @__PURE__ */ P(
|
|
1440
|
+
/* @__PURE__ */ P(O, { children: e.event_type }),
|
|
1441
|
+
/* @__PURE__ */ P(O, { children: /* @__PURE__ */ P(v, {
|
|
1442
1442
|
variant: "secondary",
|
|
1443
1443
|
children: e.aggregation
|
|
1444
1444
|
}) }),
|
|
1445
|
-
/* @__PURE__ */ P(
|
|
1445
|
+
/* @__PURE__ */ P(O, {
|
|
1446
1446
|
className: "font-medium tabular-nums",
|
|
1447
1447
|
children: Ie(e.rate_card)
|
|
1448
1448
|
}),
|
|
1449
|
-
/* @__PURE__ */ P(
|
|
1450
|
-
/* @__PURE__ */ P(
|
|
1449
|
+
/* @__PURE__ */ P(O, { children: e.rate_card?.product_key ?? "—" }),
|
|
1450
|
+
/* @__PURE__ */ P(O, { children: /* @__PURE__ */ F("span", {
|
|
1451
1451
|
className: "inline-flex items-center gap-1.5 text-sm",
|
|
1452
1452
|
children: [/* @__PURE__ */ P("span", { className: `size-1.5 rounded-full ${e.has_activity ? "bg-settled" : "bg-muted-foreground/50"}` }), e.has_activity ? "Active" : "No events"]
|
|
1453
1453
|
}) }),
|
|
1454
|
-
/* @__PURE__ */ P(
|
|
1454
|
+
/* @__PURE__ */ P(O, {
|
|
1455
1455
|
className: "text-muted-foreground tabular-nums",
|
|
1456
1456
|
children: h(e.last_event_at)
|
|
1457
1457
|
}),
|
|
1458
|
-
/* @__PURE__ */ P(
|
|
1458
|
+
/* @__PURE__ */ P(O, {
|
|
1459
1459
|
className: "text-right",
|
|
1460
1460
|
children: /* @__PURE__ */ P(I, {
|
|
1461
1461
|
icon: ve,
|
|
@@ -1466,18 +1466,18 @@ function Qe({ meter: e }) {
|
|
|
1466
1466
|
});
|
|
1467
1467
|
}
|
|
1468
1468
|
function $e() {
|
|
1469
|
-
let { text:
|
|
1469
|
+
let { text: i } = t(), { adminQueries: c } = r(), { key: l = "" } = n(), d = l, f = a(), p = me(c.usageMeter(d)), m = u(), h = me(c.allProducts({ errorAction: "Load products for metering" }));
|
|
1470
1470
|
if (p.isPending) return /* @__PURE__ */ P(nt, {});
|
|
1471
1471
|
if (p.error) {
|
|
1472
|
-
let
|
|
1472
|
+
let e = p.error instanceof o && p.error.status === 404, t = p.error instanceof o && p.error.status === 403;
|
|
1473
1473
|
return /* @__PURE__ */ P($, {
|
|
1474
|
-
title:
|
|
1475
|
-
description:
|
|
1476
|
-
action:
|
|
1474
|
+
title: t ? "Metering access is restricted" : e ? "Meter not found" : "Meter could not be loaded",
|
|
1475
|
+
description: t ? "Your role does not have permission to read this meter." : e ? "This meter does not exist in the active merchant catalog." : "Try loading the meter again.",
|
|
1476
|
+
action: t ? void 0 : /* @__PURE__ */ P(s, {
|
|
1477
1477
|
variant: "outline",
|
|
1478
1478
|
size: "sm",
|
|
1479
|
-
onClick: () =>
|
|
1480
|
-
children:
|
|
1479
|
+
onClick: () => e ? f("/catalog/metering") : void p.refetch(),
|
|
1480
|
+
children: e ? "Back to metering" : "Try again"
|
|
1481
1481
|
})
|
|
1482
1482
|
});
|
|
1483
1483
|
}
|
|
@@ -1494,7 +1494,7 @@ function $e() {
|
|
|
1494
1494
|
variant: "ghost",
|
|
1495
1495
|
size: "icon",
|
|
1496
1496
|
onClick: () => f("/catalog/metering"),
|
|
1497
|
-
"aria-label":
|
|
1497
|
+
"aria-label": i("Back to metering"),
|
|
1498
1498
|
children: /* @__PURE__ */ P(I, {
|
|
1499
1499
|
icon: _e,
|
|
1500
1500
|
className: "size-4"
|
|
@@ -1507,9 +1507,9 @@ function $e() {
|
|
|
1507
1507
|
children: [/* @__PURE__ */ P("h1", {
|
|
1508
1508
|
className: "truncate text-xl font-semibold tracking-tight",
|
|
1509
1509
|
children: g.key
|
|
1510
|
-
}), !m && /* @__PURE__ */ P(
|
|
1510
|
+
}), !m && /* @__PURE__ */ P(v, {
|
|
1511
1511
|
variant: "secondary",
|
|
1512
|
-
children: /* @__PURE__ */ P(
|
|
1512
|
+
children: /* @__PURE__ */ P(e, { id: "read-only" })
|
|
1513
1513
|
})]
|
|
1514
1514
|
}), /* @__PURE__ */ F("p", {
|
|
1515
1515
|
className: "mt-1 text-sm text-muted-foreground",
|
|
@@ -1532,47 +1532,47 @@ function $e() {
|
|
|
1532
1532
|
products: h.data?.data ?? [],
|
|
1533
1533
|
productsPending: h.isPending,
|
|
1534
1534
|
productsError: !!h.error,
|
|
1535
|
-
productsForbidden: h.error instanceof
|
|
1535
|
+
productsForbidden: h.error instanceof o && h.error.status === 403
|
|
1536
1536
|
})]
|
|
1537
1537
|
})
|
|
1538
1538
|
]
|
|
1539
1539
|
}),
|
|
1540
|
-
!m && /* @__PURE__ */ P(Q, { children: /* @__PURE__ */ P(
|
|
1540
|
+
!m && /* @__PURE__ */ P(Q, { children: /* @__PURE__ */ P(e, { id: "Catalog updates are disabled. The console is read-only." }) }),
|
|
1541
1541
|
/* @__PURE__ */ F("section", {
|
|
1542
1542
|
className: "grid gap-4",
|
|
1543
1543
|
children: [
|
|
1544
1544
|
/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("h2", {
|
|
1545
1545
|
className: "text-base font-semibold",
|
|
1546
|
-
children: /* @__PURE__ */ P(
|
|
1546
|
+
children: /* @__PURE__ */ P(e, { id: "Event contract" })
|
|
1547
1547
|
}), /* @__PURE__ */ F("p", {
|
|
1548
1548
|
className: "mt-1 max-w-3xl text-sm text-pretty text-muted-foreground",
|
|
1549
1549
|
children: [
|
|
1550
|
-
/* @__PURE__ */ P(
|
|
1550
|
+
/* @__PURE__ */ P(e, { id: "Creating this meter does not send events. The host application must report idempotent usage to" }),
|
|
1551
1551
|
" ",
|
|
1552
1552
|
/* @__PURE__ */ P("code", {
|
|
1553
1553
|
className: "text-foreground",
|
|
1554
|
-
children: /* @__PURE__ */ P(
|
|
1554
|
+
children: /* @__PURE__ */ P(e, { id: "/app/usage-events" })
|
|
1555
1555
|
}),
|
|
1556
|
-
/* @__PURE__ */ P(
|
|
1556
|
+
/* @__PURE__ */ P(e, { id: " with this shape." })
|
|
1557
1557
|
]
|
|
1558
1558
|
})] }),
|
|
1559
1559
|
/* @__PURE__ */ F("dl", {
|
|
1560
1560
|
className: "grid gap-x-8 gap-y-4 border-y py-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
1561
1561
|
children: [
|
|
1562
1562
|
/* @__PURE__ */ P(Z, {
|
|
1563
|
-
label:
|
|
1563
|
+
label: i("Event type"),
|
|
1564
1564
|
value: g.event_type
|
|
1565
1565
|
}),
|
|
1566
1566
|
/* @__PURE__ */ P(Z, {
|
|
1567
|
-
label:
|
|
1567
|
+
label: i("Aggregation"),
|
|
1568
1568
|
value: g.aggregation === "sum" ? `Sum ${g.value_property}` : "Count each event"
|
|
1569
1569
|
}),
|
|
1570
1570
|
/* @__PURE__ */ P(Z, {
|
|
1571
|
-
label:
|
|
1571
|
+
label: i("Meter key"),
|
|
1572
1572
|
value: g.key
|
|
1573
1573
|
}),
|
|
1574
1574
|
/* @__PURE__ */ P(Z, {
|
|
1575
|
-
label:
|
|
1575
|
+
label: i("Billing support"),
|
|
1576
1576
|
value: g.billing_supported ? "Supported" : "Read only"
|
|
1577
1577
|
}),
|
|
1578
1578
|
Object.entries(g.group_by ?? {}).map(([e, t]) => /* @__PURE__ */ P(Z, {
|
|
@@ -1597,8 +1597,8 @@ function $e() {
|
|
|
1597
1597
|
]
|
|
1598
1598
|
});
|
|
1599
1599
|
}
|
|
1600
|
-
function et({ meter:
|
|
1601
|
-
let { toast: a, toastApiError: o, adminMutations: c } =
|
|
1600
|
+
function et({ meter: n, writesAllowed: i }) {
|
|
1601
|
+
let { toast: a, toastApiError: o, adminMutations: c } = r(), { text: l } = t(), u = _(), d = he(), f = pe(c.deleteDefaultUsageRateCard(d)), p = n.rate_card, m = async () => {
|
|
1602
1602
|
if (await u({
|
|
1603
1603
|
title: "Remove the default rate?",
|
|
1604
1604
|
description: "New usage for this meter will stop being rated after removal. Billed usage orders and accrued amounts remain unchanged.",
|
|
@@ -1606,7 +1606,7 @@ function et({ meter: e, writesAllowed: r }) {
|
|
|
1606
1606
|
cancelLabel: "Keep rate",
|
|
1607
1607
|
tone: "destructive"
|
|
1608
1608
|
})) try {
|
|
1609
|
-
await f.mutateAsync(
|
|
1609
|
+
await f.mutateAsync(n), a.success("Default rate removed");
|
|
1610
1610
|
} catch (e) {
|
|
1611
1611
|
o(e, "Remove default rate");
|
|
1612
1612
|
}
|
|
@@ -1617,11 +1617,11 @@ function et({ meter: e, writesAllowed: r }) {
|
|
|
1617
1617
|
className: "flex flex-wrap items-start justify-between gap-4",
|
|
1618
1618
|
children: [/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("h2", {
|
|
1619
1619
|
className: "text-base font-semibold",
|
|
1620
|
-
children: /* @__PURE__ */ P(
|
|
1620
|
+
children: /* @__PURE__ */ P(e, { id: "Default rate" })
|
|
1621
1621
|
}), /* @__PURE__ */ P("p", {
|
|
1622
1622
|
className: "mt-1 text-sm text-muted-foreground",
|
|
1623
|
-
children: /* @__PURE__ */ P(
|
|
1624
|
-
})] }), p &&
|
|
1623
|
+
children: /* @__PURE__ */ P(e, { id: "Used for every customer." })
|
|
1624
|
+
})] }), p && i && /* @__PURE__ */ F(s, {
|
|
1625
1625
|
variant: "outline",
|
|
1626
1626
|
size: "sm",
|
|
1627
1627
|
disabled: f.isPending,
|
|
@@ -1631,7 +1631,7 @@ function et({ meter: e, writesAllowed: r }) {
|
|
|
1631
1631
|
className: "size-4"
|
|
1632
1632
|
}), f.isPending ? "Removing…" : "Remove default"]
|
|
1633
1633
|
})]
|
|
1634
|
-
}),
|
|
1634
|
+
}), n.billing_supported ? p ? /* @__PURE__ */ F("dl", {
|
|
1635
1635
|
className: "grid gap-x-8 gap-y-4 border-y py-4 sm:grid-cols-2 lg:grid-cols-4",
|
|
1636
1636
|
children: [
|
|
1637
1637
|
/* @__PURE__ */ P(Z, {
|
|
@@ -1661,8 +1661,8 @@ function et({ meter: e, writesAllowed: r }) {
|
|
|
1661
1661
|
]
|
|
1662
1662
|
}) : /* @__PURE__ */ P("p", {
|
|
1663
1663
|
className: "border-y py-6 text-sm text-muted-foreground",
|
|
1664
|
-
children: /* @__PURE__ */ P(
|
|
1665
|
-
}) : /* @__PURE__ */ P(Q, { children: /* @__PURE__ */ P(
|
|
1664
|
+
children: /* @__PURE__ */ P(e, { id: "No default rate. Usage is recorded but is not billed by this meter." })
|
|
1665
|
+
}) : /* @__PURE__ */ P(Q, { children: /* @__PURE__ */ P(e, { id: "This meter uses an aggregation that the billing engine cannot rate." }) })]
|
|
1666
1666
|
});
|
|
1667
1667
|
}
|
|
1668
1668
|
function Z({ label: e, value: t }) {
|
|
@@ -1718,4 +1718,4 @@ function nt() {
|
|
|
1718
1718
|
//#endregion
|
|
1719
1719
|
export { Ze as CatalogMeteringPage, $e as MeterDetailPage };
|
|
1720
1720
|
|
|
1721
|
-
//# sourceMappingURL=admin-metering-
|
|
1721
|
+
//# sourceMappingURL=admin-metering-CDqueHUh.js.map
|