@openrails/billing-ui 0.268.3 → 0.269.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/context.d.ts +164 -62
- package/dist/admin/lib/api/endpoints.d.ts +3 -7
- package/dist/admin/lib/api/import-endpoints.d.ts +44 -0
- package/dist/admin/lib/api/index.d.ts +17 -7
- package/dist/admin/lib/api/types.d.ts +0 -29
- package/dist/admin/lib/import-queries.d.ts +66 -0
- package/dist/admin/lib/mutations.d.ts +1 -5
- package/dist/admin/lib/queries.d.ts +6 -20
- package/dist/admin/messages.d.ts +176 -6
- package/dist/admin/pages/catalog/index.d.ts +0 -1
- package/dist/admin/pages/imports/detail.d.ts +2 -0
- package/dist/admin/pages/imports/index.d.ts +2 -0
- package/dist/admin/pages/imports/mapping-csv.d.ts +10 -0
- package/dist/admin/pages/imports/progress.d.ts +21 -0
- package/dist/admin/pages/imports/records.d.ts +2 -0
- package/dist/admin/pages/imports/shared.d.ts +22 -0
- package/dist/admin/pages/parked/index.d.ts +2 -0
- package/dist/admin/pages/proposals/grouping.d.ts +13 -0
- package/dist/admin/pages/proposals/index.d.ts +2 -0
- package/dist/admin/pages/provider-prices/index.d.ts +2 -0
- package/dist/admin/pages/provider-prices/map-dialog.d.ts +11 -0
- package/dist/admin/routes.d.ts +1 -1
- package/dist/{admin-attempts-BLeeKABa.js → admin-attempts-DQTg0UzZ.js} +82 -82
- package/dist/{admin-attempts-BLeeKABa.js.map → admin-attempts-DQTg0UzZ.js.map} +1 -1
- package/dist/{admin-auth-DWVWxDup.js → admin-auth-1aZIgXiS.js} +2 -2
- package/dist/{admin-auth-DWVWxDup.js.map → admin-auth-1aZIgXiS.js.map} +1 -1
- package/dist/{admin-badge-CrEqD9Ew.js → admin-badge-pgG6D9-a.js} +2 -2
- package/dist/{admin-badge-CrEqD9Ew.js.map → admin-badge-pgG6D9-a.js.map} +1 -1
- package/dist/{admin-button-a7bDFgp0.js → admin-button-CrcYk5r0.js} +2 -2
- package/dist/{admin-button-a7bDFgp0.js.map → admin-button-CrcYk5r0.js.map} +1 -1
- package/dist/{admin-capabilities-QYUuJXvG.js → admin-capabilities-BDcZeHL_.js} +2 -2
- package/dist/{admin-capabilities-QYUuJXvG.js.map → admin-capabilities-BDcZeHL_.js.map} +1 -1
- package/dist/{admin-card-D1tz8Lbh.js → admin-card-DvTMc5Se.js} +2 -2
- package/dist/{admin-card-D1tz8Lbh.js.map → admin-card-DvTMc5Se.js.map} +1 -1
- package/dist/{admin-catalog-ggiDgWsR.js → admin-catalog-BlF5mnu4.js} +285 -382
- package/dist/admin-catalog-BlF5mnu4.js.map +1 -0
- package/dist/{admin-dom-VkcwevWr.js → admin-cursor-pager-CIb3Jw2F.js} +20 -25
- package/dist/admin-cursor-pager-CIb3Jw2F.js.map +1 -0
- package/dist/{admin-customers-BVMg-gUv.js → admin-customers-EpfoWDh-.js} +13 -13
- package/dist/{admin-customers-BVMg-gUv.js.map → admin-customers-EpfoWDh-.js.map} +1 -1
- package/dist/{admin-dashboard-Cc13i8i9.js → admin-dashboard-CJE63yz4.js} +46 -46
- package/dist/{admin-dashboard-Cc13i8i9.js.map → admin-dashboard-CJE63yz4.js.map} +1 -1
- package/dist/{admin-data-table-BL84xKKF.js → admin-data-table-hvFcJepL.js} +16 -16
- package/dist/{admin-data-table-BL84xKKF.js.map → admin-data-table-hvFcJepL.js.map} +1 -1
- package/dist/{admin-detail-CaEwBdX9.js → admin-detail-BRP6pL7t.js} +51 -51
- package/dist/{admin-detail-CaEwBdX9.js.map → admin-detail-BRP6pL7t.js.map} +1 -1
- package/dist/{admin-detail-9YAep3ts.js → admin-detail-CRzFb_pa.js} +232 -232
- package/dist/{admin-detail-9YAep3ts.js.map → admin-detail-CRzFb_pa.js.map} +1 -1
- package/dist/admin-detail-Ceod8AXy.js +299 -0
- package/dist/admin-detail-Ceod8AXy.js.map +1 -0
- package/dist/{admin-detail-C8t5jBps.js → admin-detail-QLxU8r-5.js} +62 -62
- package/dist/{admin-detail-C8t5jBps.js.map → admin-detail-QLxU8r-5.js.map} +1 -1
- package/dist/admin-detail-pPC8Q9l-.js +710 -0
- package/dist/{admin-detail-D2zcz_Xm.js.map → admin-detail-pPC8Q9l-.js.map} +1 -1
- package/dist/{admin-dialog-CiAw5vx-.js → admin-dialog-BSRf9Zre.js} +24 -24
- package/dist/{admin-dialog-CiAw5vx-.js.map → admin-dialog-BSRf9Zre.js.map} +1 -1
- package/dist/admin-dom-C7Y7A6Wa.js +8 -0
- package/dist/admin-dom-C7Y7A6Wa.js.map +1 -0
- package/dist/{admin-dropdown-menu-CYJbmqK2.js → admin-dropdown-menu-D0E5rwmn.js} +2 -2
- package/dist/{admin-dropdown-menu-CYJbmqK2.js.map → admin-dropdown-menu-D0E5rwmn.js.map} +1 -1
- package/dist/{admin-fact-card-BHTpDlaX.js → admin-fact-card-BPSVhS15.js} +2 -2
- package/dist/{admin-fact-card-BHTpDlaX.js.map → admin-fact-card-BPSVhS15.js.map} +1 -1
- package/dist/{admin-health-BUnjbvYR.js → admin-health-D0L5Kig7.js} +84 -84
- package/dist/{admin-health-BUnjbvYR.js.map → admin-health-D0L5Kig7.js.map} +1 -1
- package/dist/admin-imports-TCOljTgw.js +269 -0
- package/dist/admin-imports-TCOljTgw.js.map +1 -0
- package/dist/{admin-input-C-S_RGGo.js → admin-input-DJAK9nmk.js} +2 -2
- package/dist/{admin-input-C-S_RGGo.js.map → admin-input-DJAK9nmk.js.map} +1 -1
- package/dist/{admin-label-DPVYDdSO.js → admin-label-aviN9Gng.js} +2 -2
- package/dist/{admin-label-DPVYDdSO.js.map → admin-label-aviN9Gng.js.map} +1 -1
- package/dist/{admin-linked-table-row-D-gbTT7a.js → admin-linked-table-row-BGr7JXeM.js} +6 -6
- package/dist/{admin-linked-table-row-D-gbTT7a.js.map → admin-linked-table-row-BGr7JXeM.js.map} +1 -1
- package/dist/admin-map-dialog-DpGaIq52.js +135 -0
- package/dist/admin-map-dialog-DpGaIq52.js.map +1 -0
- package/dist/admin-mapping-csv-FtkyTBmk.js +56 -0
- package/dist/admin-mapping-csv-FtkyTBmk.js.map +1 -0
- package/dist/{admin-metering-BjbL0jjT.js → admin-metering-D-e-37Jn.js} +285 -285
- package/dist/{admin-metering-BjbL0jjT.js.map → admin-metering-D-e-37Jn.js.map} +1 -1
- package/dist/admin-ops-CQP4TzWM.js +235 -0
- package/dist/admin-ops-CQP4TzWM.js.map +1 -0
- package/dist/{admin-orders-BVW9-Fs9.js → admin-orders-BJ7W5S8P.js} +32 -32
- package/dist/{admin-orders-BVW9-Fs9.js.map → admin-orders-BJ7W5S8P.js.map} +1 -1
- package/dist/admin-parked-7HL8mOjw.js +193 -0
- package/dist/admin-parked-7HL8mOjw.js.map +1 -0
- package/dist/{admin-payments-C5MsFFmm.js → admin-payments-CzkzqYA1.js} +17 -17
- package/dist/{admin-payments-C5MsFFmm.js.map → admin-payments-CzkzqYA1.js.map} +1 -1
- package/dist/{admin-price-detail-D517JYHB.js → admin-price-detail-CSI5oKdb.js} +74 -74
- package/dist/{admin-price-detail-D517JYHB.js.map → admin-price-detail-CSI5oKdb.js.map} +1 -1
- package/dist/{admin-price-wizard-bj36o3ux.js → admin-price-wizard-CBEcNGvP.js} +38 -38
- package/dist/{admin-price-wizard-bj36o3ux.js.map → admin-price-wizard-CBEcNGvP.js.map} +1 -1
- package/dist/admin-proposals-dtgijWKz.js +375 -0
- package/dist/admin-proposals-dtgijWKz.js.map +1 -0
- package/dist/admin-provider-prices-ChuponcZ.js +246 -0
- package/dist/admin-provider-prices-ChuponcZ.js.map +1 -0
- package/dist/{admin-range-picker-D2aFF8IV.js → admin-range-picker-De36L-AP.js} +12 -12
- package/dist/{admin-range-picker-D2aFF8IV.js.map → admin-range-picker-De36L-AP.js.map} +1 -1
- package/dist/admin-records-CUHUOXAU.js +391 -0
- package/dist/admin-records-CUHUOXAU.js.map +1 -0
- package/dist/{admin-reports-D-ob04d4.js → admin-reports-BFGS_PWf.js} +45 -45
- package/dist/{admin-reports-D-ob04d4.js.map → admin-reports-BFGS_PWf.js.map} +1 -1
- package/dist/{admin-select-C8O7nx72.js → admin-select-BUcEU5Rg.js} +2 -2
- package/dist/{admin-select-C8O7nx72.js.map → admin-select-BUcEU5Rg.js.map} +1 -1
- package/dist/{admin-settings-Bs6cLcqi.js → admin-settings-DYC-c7mJ.js} +296 -296
- package/dist/{admin-settings-Bs6cLcqi.js.map → admin-settings-DYC-c7mJ.js.map} +1 -1
- package/dist/admin-shared-CzG8Pan3.js +222 -0
- package/dist/admin-shared-CzG8Pan3.js.map +1 -0
- package/dist/{admin-skeleton-wfocg2PJ.js → admin-skeleton-B0yzYY_X.js} +2 -2
- package/dist/{admin-skeleton-wfocg2PJ.js.map → admin-skeleton-B0yzYY_X.js.map} +1 -1
- package/dist/{admin-status-badge-D_gDMrht.js → admin-status-badge-0-K37EfN.js} +7 -2
- package/dist/admin-status-badge-0-K37EfN.js.map +1 -0
- package/dist/{admin-subscriptions-DYR1RGMO.js → admin-subscriptions-CvW-YFs0.js} +74 -74
- package/dist/{admin-subscriptions-DYR1RGMO.js.map → admin-subscriptions-CvW-YFs0.js.map} +1 -1
- package/dist/{admin-switch-F5D0AYjT.js → admin-switch-DDorugaw.js} +2 -2
- package/dist/{admin-switch-F5D0AYjT.js.map → admin-switch-DDorugaw.js.map} +1 -1
- package/dist/{admin-table-nUij5fLc.js → admin-table-BU6Tie69.js} +2 -2
- package/dist/{admin-table-nUij5fLc.js.map → admin-table-BU6Tie69.js.map} +1 -1
- package/dist/{admin-tabs-C3myjKdr.js → admin-tabs-D5lqdVcC.js} +2 -2
- package/dist/{admin-tabs-C3myjKdr.js.map → admin-tabs-D5lqdVcC.js.map} +1 -1
- package/dist/{admin-textarea-v-L-PXIc.js → admin-textarea-Dc6lnEub.js} +2 -2
- package/dist/{admin-textarea-v-L-PXIc.js.map → admin-textarea-Dc6lnEub.js.map} +1 -1
- package/dist/{admin-typed-confirm-dialog-BLgpuikW.js → admin-typed-confirm-dialog-Bk6XxmPb.js} +6 -6
- package/dist/{admin-typed-confirm-dialog-BLgpuikW.js.map → admin-typed-confirm-dialog-Bk6XxmPb.js.map} +1 -1
- package/dist/{admin-utils-6yE4YIVI.js → admin-utils-B9eEBNsR.js} +398 -146
- package/dist/admin-utils-B9eEBNsR.js.map +1 -0
- package/dist/{admin-widget-viz-BiEfckd4.js → admin-widget-viz-8aukE3v_.js} +34 -34
- package/dist/{admin-widget-viz-BiEfckd4.js.map → admin-widget-viz-8aukE3v_.js.map} +1 -1
- package/dist/admin.css +1 -1
- package/dist/admin.js +489 -264
- package/dist/admin.js.map +1 -1
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +94 -22
- package/dist/client/generated/wire.d.ts +89 -14
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/dist/admin-catalog-ggiDgWsR.js.map +0 -1
- package/dist/admin-detail-D2zcz_Xm.js +0 -710
- package/dist/admin-dom-VkcwevWr.js.map +0 -1
- package/dist/admin-ops-DT8epiXg.js +0 -217
- package/dist/admin-ops-DT8epiXg.js.map +0 -1
- package/dist/admin-status-badge-D_gDMrht.js.map +0 -1
- package/dist/admin-utils-6yE4YIVI.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
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 { s as u } from "./admin-capabilities-
|
|
1
|
+
import { C as e, D as t, T as n, c as r, p as i, r as a, s as o } from "./admin-utils-B9eEBNsR.js";
|
|
2
|
+
import { t as s } from "./admin-button-CrcYk5r0.js";
|
|
3
|
+
import { t as c } from "./admin-input-DJAK9nmk.js";
|
|
4
|
+
import { t as l } from "./admin-skeleton-B0yzYY_X.js";
|
|
5
|
+
import { s as u } from "./admin-capabilities-BDcZeHL_.js";
|
|
6
6
|
import { c as d, d as f, l as p, n as m, o as h, s as g } from "./admin-format-DoohJ7Fg.js";
|
|
7
7
|
import { n as _ } from "./admin-confirm-katGq0Qo.js";
|
|
8
8
|
import { t as v } from "./admin-form-field-errors-hbUMIriS.js";
|
|
9
|
-
import { a as y, i as b, n as x, r as S, t as C } from "./admin-select-
|
|
10
|
-
import { n as w,
|
|
11
|
-
import { a as E, n as ee, o as te, r as D, s as O, t as k } from "./admin-table-
|
|
12
|
-
import { t as ne } from "./admin-linked-table-row-
|
|
13
|
-
import { t as A } from "./admin-badge-
|
|
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-
|
|
9
|
+
import { a as y, i as b, n as x, r as S, t as C } from "./admin-select-BUcEU5Rg.js";
|
|
10
|
+
import { n as w, t as T } from "./admin-cursor-pager-CIb3Jw2F.js";
|
|
11
|
+
import { a as E, n as ee, o as te, r as D, s as O, t as k } from "./admin-table-BU6Tie69.js";
|
|
12
|
+
import { t as ne } from "./admin-linked-table-row-BGr7JXeM.js";
|
|
13
|
+
import { t as A } from "./admin-badge-pgG6D9-a.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-BSRf9Zre.js";
|
|
15
|
+
import { t as j } from "./admin-label-aviN9Gng.js";
|
|
16
|
+
import { t as ue } from "./admin-switch-DDorugaw.js";
|
|
17
17
|
import { n as de, r as fe } from "./admin-dialog-width-BPrgdYlj.js";
|
|
18
18
|
import * as M from "react";
|
|
19
19
|
import { useMutation as pe, useQuery as me, useQueryClient as he } from "@tanstack/react-query";
|
|
@@ -243,20 +243,20 @@ 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:
|
|
248
|
-
defaultValues: Ee(
|
|
249
|
-
onSubmit: async ({ value:
|
|
246
|
+
function Re({ meter: e, writesAllowed: r }) {
|
|
247
|
+
let { toast: a, toastApiError: o, adminMutations: l } = i(), { id: u, text: d } = t(), [f, p] = M.useState(!1), [m, h] = M.useState(""), g = he(), _ = pe(l.putUsageMeter(g)), w = e ? Le(e, r) : null, T = Se({
|
|
248
|
+
defaultValues: Ee(e),
|
|
249
|
+
onSubmit: async ({ value: t }) => {
|
|
250
250
|
h("");
|
|
251
251
|
try {
|
|
252
|
-
let n = De(
|
|
253
|
-
n.meter.expected_revision =
|
|
254
|
-
} catch (
|
|
255
|
-
if (
|
|
256
|
-
h(
|
|
252
|
+
let n = De(t);
|
|
253
|
+
n.meter.expected_revision = e?.revision ?? 0, await _.mutateAsync(n), a.success(e ? "Meter updated" : "Meter created"), p(!1), T.reset();
|
|
254
|
+
} catch (t) {
|
|
255
|
+
if (t instanceof Error && !("status" in t)) {
|
|
256
|
+
h(t.message);
|
|
257
257
|
return;
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
o(t, e ? "Update meter" : "Create meter");
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
});
|
|
@@ -268,19 +268,19 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
268
268
|
children: [/* @__PURE__ */ P(I, {
|
|
269
269
|
icon: z,
|
|
270
270
|
className: "size-4"
|
|
271
|
-
}), /* @__PURE__ */ P(
|
|
271
|
+
}), /* @__PURE__ */ P(n, { 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: e ? "outline" : "default",
|
|
279
279
|
size: "sm",
|
|
280
280
|
children: [/* @__PURE__ */ P(I, {
|
|
281
|
-
icon:
|
|
281
|
+
icon: e ? z : L,
|
|
282
282
|
className: "size-4"
|
|
283
|
-
}),
|
|
283
|
+
}), e ? "Edit definition" : "Create meter"]
|
|
284
284
|
}) }), /* @__PURE__ */ P(ae, {
|
|
285
285
|
className: de,
|
|
286
286
|
children: /* @__PURE__ */ F("form", {
|
|
@@ -289,34 +289,34 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
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: e ? "Edit meter" : "Create meter" }), /* @__PURE__ */ P(se, { children: /* @__PURE__ */ P(n, { 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: [
|
|
296
296
|
/* @__PURE__ */ P(T.Field, {
|
|
297
297
|
name: "key",
|
|
298
298
|
validators: { onBlur: ({ value: e }) => e.trim() ? void 0 : "Enter a meter key." },
|
|
299
|
-
children: (
|
|
299
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
300
300
|
className: "grid gap-1.5",
|
|
301
301
|
children: [
|
|
302
302
|
/* @__PURE__ */ P(j, {
|
|
303
303
|
htmlFor: u("meter-key"),
|
|
304
|
-
children: /* @__PURE__ */ P(
|
|
304
|
+
children: /* @__PURE__ */ P(n, { id: "Key" })
|
|
305
305
|
}),
|
|
306
306
|
/* @__PURE__ */ P(c, {
|
|
307
307
|
id: u("meter-key"),
|
|
308
|
-
value:
|
|
309
|
-
onChange: (
|
|
310
|
-
onBlur:
|
|
311
|
-
disabled: !!
|
|
308
|
+
value: t.state.value,
|
|
309
|
+
onChange: (e) => t.handleChange(e.target.value),
|
|
310
|
+
onBlur: t.handleBlur,
|
|
311
|
+
disabled: !!e,
|
|
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(n, { id: "Stable identifier. It cannot be renamed after creation." })
|
|
318
318
|
}),
|
|
319
|
-
/* @__PURE__ */ P(v, { errors:
|
|
319
|
+
/* @__PURE__ */ P(v, { errors: t.state.meta.errors })
|
|
320
320
|
]
|
|
321
321
|
})
|
|
322
322
|
}),
|
|
@@ -329,7 +329,7 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
329
329
|
children: [
|
|
330
330
|
/* @__PURE__ */ P(j, {
|
|
331
331
|
htmlFor: u("meter-event-type"),
|
|
332
|
-
children: /* @__PURE__ */ P(
|
|
332
|
+
children: /* @__PURE__ */ P(n, { id: "Event type" })
|
|
333
333
|
}),
|
|
334
334
|
/* @__PURE__ */ P(c, {
|
|
335
335
|
id: u("meter-event-type"),
|
|
@@ -340,7 +340,7 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
340
340
|
}),
|
|
341
341
|
/* @__PURE__ */ P("p", {
|
|
342
342
|
className: "text-xs text-muted-foreground",
|
|
343
|
-
children: /* @__PURE__ */ P(
|
|
343
|
+
children: /* @__PURE__ */ P(n, { id: "Leave blank to use the meter key." })
|
|
344
344
|
})
|
|
345
345
|
]
|
|
346
346
|
})
|
|
@@ -351,7 +351,7 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
351
351
|
children: [
|
|
352
352
|
/* @__PURE__ */ P(j, {
|
|
353
353
|
htmlFor: u("meter-unit"),
|
|
354
|
-
children: /* @__PURE__ */ P(
|
|
354
|
+
children: /* @__PURE__ */ P(n, { id: "Unit" })
|
|
355
355
|
}),
|
|
356
356
|
/* @__PURE__ */ P(c, {
|
|
357
357
|
id: u("meter-unit"),
|
|
@@ -362,7 +362,7 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
362
362
|
}),
|
|
363
363
|
/* @__PURE__ */ P("p", {
|
|
364
364
|
className: "text-xs text-muted-foreground",
|
|
365
|
-
children: /* @__PURE__ */ P(
|
|
365
|
+
children: /* @__PURE__ */ P(n, { id: "Human-readable quantity shown in billing." })
|
|
366
366
|
})
|
|
367
367
|
]
|
|
368
368
|
})
|
|
@@ -376,7 +376,7 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
376
376
|
className: "grid gap-1.5",
|
|
377
377
|
children: [/* @__PURE__ */ P(j, {
|
|
378
378
|
htmlFor: u("meter-aggregation"),
|
|
379
|
-
children: /* @__PURE__ */ P(
|
|
379
|
+
children: /* @__PURE__ */ P(n, { id: "Aggregation" })
|
|
380
380
|
}), /* @__PURE__ */ F(C, {
|
|
381
381
|
value: e.state.value,
|
|
382
382
|
onValueChange: (t) => e.handleChange(t),
|
|
@@ -386,10 +386,10 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
386
386
|
children: /* @__PURE__ */ P(y, {})
|
|
387
387
|
}), /* @__PURE__ */ F(x, { children: [/* @__PURE__ */ P(S, {
|
|
388
388
|
value: "sum",
|
|
389
|
-
children: /* @__PURE__ */ P(
|
|
389
|
+
children: /* @__PURE__ */ P(n, { id: "Sum a numeric field" })
|
|
390
390
|
}), /* @__PURE__ */ P(S, {
|
|
391
391
|
value: "count",
|
|
392
|
-
children: /* @__PURE__ */ P(
|
|
392
|
+
children: /* @__PURE__ */ P(n, { id: "Count events" })
|
|
393
393
|
})] })]
|
|
394
394
|
})]
|
|
395
395
|
})
|
|
@@ -403,7 +403,7 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
403
403
|
children: [
|
|
404
404
|
/* @__PURE__ */ P(j, {
|
|
405
405
|
htmlFor: u("meter-value-property"),
|
|
406
|
-
children: /* @__PURE__ */ P(
|
|
406
|
+
children: /* @__PURE__ */ P(n, { id: "Value property" })
|
|
407
407
|
}),
|
|
408
408
|
/* @__PURE__ */ P(c, {
|
|
409
409
|
id: u("meter-value-property"),
|
|
@@ -418,7 +418,7 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
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(n, { id: "Count uses one unit for every matching event." })
|
|
422
422
|
})
|
|
423
423
|
})]
|
|
424
424
|
}),
|
|
@@ -429,9 +429,9 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
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(n, { id: "Dimensions" }) }), /* @__PURE__ */ P("p", {
|
|
433
433
|
className: "text-xs text-muted-foreground",
|
|
434
|
-
children: /* @__PURE__ */ P(
|
|
434
|
+
children: /* @__PURE__ */ P(n, { id: "Register event properties used by filters or matrix rates." })
|
|
435
435
|
})] }), /* @__PURE__ */ F(s, {
|
|
436
436
|
type: "button",
|
|
437
437
|
variant: "outline",
|
|
@@ -443,7 +443,7 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
443
443
|
children: [/* @__PURE__ */ P(I, {
|
|
444
444
|
icon: L,
|
|
445
445
|
className: "size-4"
|
|
446
|
-
}), /* @__PURE__ */ P(
|
|
446
|
+
}), /* @__PURE__ */ P(n, { id: "Add dimension" })]
|
|
447
447
|
})]
|
|
448
448
|
}), e.state.value.map((t, n) => /* @__PURE__ */ F("div", {
|
|
449
449
|
className: "grid grid-cols-[1fr_1fr_auto] gap-2",
|
|
@@ -488,7 +488,7 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
488
488
|
type: "button",
|
|
489
489
|
variant: "outline",
|
|
490
490
|
onClick: () => p(!1),
|
|
491
|
-
children: /* @__PURE__ */ P(
|
|
491
|
+
children: /* @__PURE__ */ P(n, { id: "Cancel" })
|
|
492
492
|
}), /* @__PURE__ */ P(T.Subscribe, {
|
|
493
493
|
selector: (e) => e.isSubmitting,
|
|
494
494
|
children: (e) => /* @__PURE__ */ P(s, {
|
|
@@ -505,8 +505,8 @@ function Re({ meter: t, writesAllowed: n }) {
|
|
|
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: e, writesAllowed: r = !1, products: o, productsPending: l = !1, productsError: u = !1, productsForbidden: d = !1 }) {
|
|
509
|
+
let { toast: f, toastApiError: p, adminMutations: m } = i(), { id: h, text: g } = t(), [v, w] = M.useState(!1), [T, E] = M.useState(null), ee = _(), te = he(), D = pe(m.putDefaultUsageRateCard(te)), O = o.filter((e) => !e.archived), k = e.rate_card, ne = D.isPending, A = Se({
|
|
510
510
|
defaultValues: Oe(k),
|
|
511
511
|
onSubmit: async ({ value: e }) => {
|
|
512
512
|
E(null);
|
|
@@ -532,17 +532,17 @@ function ze({ meter: t, writesAllowed: n = !1, products: a, productsPending: l =
|
|
|
532
532
|
p(e, "Save rate card");
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
}), ue = async (
|
|
535
|
+
}), ue = async (t) => {
|
|
536
536
|
try {
|
|
537
537
|
await D.mutateAsync({
|
|
538
|
-
meter:
|
|
539
|
-
rateCard:
|
|
538
|
+
meter: e,
|
|
539
|
+
rateCard: t
|
|
540
540
|
}), f.success(k ? "Default rate replaced" : "Default rate added"), w(!1);
|
|
541
541
|
} catch (e) {
|
|
542
542
|
p(e, "Save default rate");
|
|
543
543
|
}
|
|
544
544
|
};
|
|
545
|
-
return !
|
|
545
|
+
return !r || !e.billing_supported ? null : /* @__PURE__ */ P(G.Provider, {
|
|
546
546
|
value: T,
|
|
547
547
|
children: /* @__PURE__ */ F(le, {
|
|
548
548
|
open: v,
|
|
@@ -565,25 +565,25 @@ function ze({ meter: t, writesAllowed: n = !1, products: a, 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(n, { 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(n, { 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(n, { 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(n, { id: "No active products are available." }) }), /* @__PURE__ */ P(a, {
|
|
584
584
|
className: "text-primary underline underline-offset-3",
|
|
585
585
|
to: "/catalog",
|
|
586
|
-
children: /* @__PURE__ */ P(
|
|
586
|
+
children: /* @__PURE__ */ P(n, { id: "Create or activate a product first" })
|
|
587
587
|
})]
|
|
588
588
|
}) : /* @__PURE__ */ F("div", {
|
|
589
589
|
className: "grid gap-4 sm:grid-cols-3",
|
|
@@ -595,7 +595,7 @@ function ze({ meter: t, writesAllowed: n = !1, products: a, productsPending: l =
|
|
|
595
595
|
children: [
|
|
596
596
|
/* @__PURE__ */ P(j, {
|
|
597
597
|
htmlFor: h("rate-product"),
|
|
598
|
-
children: /* @__PURE__ */ P(
|
|
598
|
+
children: /* @__PURE__ */ P(n, { id: "Product" })
|
|
599
599
|
}),
|
|
600
600
|
/* @__PURE__ */ F(C, {
|
|
601
601
|
value: e.state.value || null,
|
|
@@ -621,7 +621,7 @@ function ze({ meter: t, writesAllowed: n = !1, products: a, productsPending: l =
|
|
|
621
621
|
children: [
|
|
622
622
|
/* @__PURE__ */ P(j, {
|
|
623
623
|
htmlFor: h("rate-currency"),
|
|
624
|
-
children: /* @__PURE__ */ P(
|
|
624
|
+
children: /* @__PURE__ */ P(n, { id: "Currency" })
|
|
625
625
|
}),
|
|
626
626
|
/* @__PURE__ */ P(c, {
|
|
627
627
|
id: h("rate-currency"),
|
|
@@ -639,36 +639,36 @@ function ze({ meter: t, writesAllowed: n = !1, products: a, productsPending: l =
|
|
|
639
639
|
}),
|
|
640
640
|
/* @__PURE__ */ P(Be, {
|
|
641
641
|
form: A,
|
|
642
|
-
meter:
|
|
642
|
+
meter: e
|
|
643
643
|
})
|
|
644
644
|
]
|
|
645
645
|
})]
|
|
646
646
|
}),
|
|
647
647
|
/* @__PURE__ */ P(A.Subscribe, {
|
|
648
648
|
selector: (e) => e.values.model,
|
|
649
|
-
children: (
|
|
649
|
+
children: (t) => /* @__PURE__ */ F("section", {
|
|
650
650
|
className: "grid gap-4 border-t pt-5",
|
|
651
651
|
children: [
|
|
652
652
|
/* @__PURE__ */ P("h3", {
|
|
653
653
|
className: "text-sm font-medium",
|
|
654
|
-
children: /* @__PURE__ */ P(
|
|
654
|
+
children: /* @__PURE__ */ P(n, { id: "Rate" })
|
|
655
655
|
}),
|
|
656
|
-
|
|
656
|
+
t === "per_unit" && /* @__PURE__ */ P(Ve, {
|
|
657
657
|
form: A,
|
|
658
|
-
meter:
|
|
658
|
+
meter: e
|
|
659
659
|
}),
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
660
|
+
t === "tiered" && /* @__PURE__ */ P(Ue, { form: A }),
|
|
661
|
+
t === "package" && /* @__PURE__ */ P(We, { form: A }),
|
|
662
|
+
t === "dynamic" && /* @__PURE__ */ P("p", {
|
|
663
663
|
className: "text-sm text-muted-foreground",
|
|
664
|
-
children: /* @__PURE__ */ P(
|
|
664
|
+
children: /* @__PURE__ */ P(n, { 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: e
|
|
672
672
|
}),
|
|
673
673
|
/* @__PURE__ */ P(A.Subscribe, {
|
|
674
674
|
selector: (e) => e.values.model,
|
|
@@ -687,7 +687,7 @@ function ze({ meter: t, writesAllowed: n = !1, products: a, productsPending: l =
|
|
|
687
687
|
type: "button",
|
|
688
688
|
variant: "outline",
|
|
689
689
|
onClick: () => w(!1),
|
|
690
|
-
children: /* @__PURE__ */ P(
|
|
690
|
+
children: /* @__PURE__ */ P(n, { id: "Cancel" })
|
|
691
691
|
}), /* @__PURE__ */ P(s, {
|
|
692
692
|
type: "submit",
|
|
693
693
|
disabled: ne || l || u || O.length === 0,
|
|
@@ -699,76 +699,76 @@ function ze({ meter: t, writesAllowed: n = !1, products: a, productsPending: l =
|
|
|
699
699
|
})
|
|
700
700
|
});
|
|
701
701
|
}
|
|
702
|
-
function Be({ form:
|
|
703
|
-
let { id:
|
|
704
|
-
return /* @__PURE__ */ P(
|
|
702
|
+
function Be({ form: e, meter: r }) {
|
|
703
|
+
let { id: i } = t();
|
|
704
|
+
return /* @__PURE__ */ P(e.Field, {
|
|
705
705
|
name: "model",
|
|
706
706
|
children: (e) => /* @__PURE__ */ F("div", {
|
|
707
707
|
className: "grid gap-1.5 sm:col-span-3",
|
|
708
708
|
children: [/* @__PURE__ */ P(j, {
|
|
709
|
-
htmlFor:
|
|
710
|
-
children: /* @__PURE__ */ P(
|
|
709
|
+
htmlFor: i("rate-model"),
|
|
710
|
+
children: /* @__PURE__ */ P(n, { id: "Pricing model" })
|
|
711
711
|
}), /* @__PURE__ */ F(C, {
|
|
712
712
|
value: e.state.value,
|
|
713
713
|
onValueChange: (t) => e.handleChange(t),
|
|
714
714
|
children: [/* @__PURE__ */ P(b, {
|
|
715
|
-
id:
|
|
715
|
+
id: i("rate-model"),
|
|
716
716
|
className: "w-full",
|
|
717
717
|
children: /* @__PURE__ */ P(y, {})
|
|
718
718
|
}), /* @__PURE__ */ F(x, { children: [
|
|
719
719
|
/* @__PURE__ */ P(S, {
|
|
720
720
|
value: "per_unit",
|
|
721
|
-
children: /* @__PURE__ */ P(
|
|
721
|
+
children: /* @__PURE__ */ P(n, { id: "Per unit" })
|
|
722
722
|
}),
|
|
723
723
|
/* @__PURE__ */ P(S, {
|
|
724
724
|
value: "tiered",
|
|
725
|
-
children: /* @__PURE__ */ P(
|
|
725
|
+
children: /* @__PURE__ */ P(n, { id: "Tiered" })
|
|
726
726
|
}),
|
|
727
727
|
/* @__PURE__ */ P(S, {
|
|
728
728
|
value: "package",
|
|
729
|
-
children: /* @__PURE__ */ P(
|
|
729
|
+
children: /* @__PURE__ */ P(n, { id: "Package" })
|
|
730
730
|
}),
|
|
731
731
|
/* @__PURE__ */ P(S, {
|
|
732
732
|
value: "dynamic",
|
|
733
|
-
disabled:
|
|
734
|
-
children: /* @__PURE__ */ P(
|
|
733
|
+
disabled: r.aggregation !== "sum",
|
|
734
|
+
children: /* @__PURE__ */ P(n, { id: "Dynamic (event amount)" })
|
|
735
735
|
})
|
|
736
736
|
] })]
|
|
737
737
|
})]
|
|
738
738
|
})
|
|
739
739
|
});
|
|
740
740
|
}
|
|
741
|
-
function Ve({ form:
|
|
742
|
-
let { id:
|
|
741
|
+
function Ve({ form: e, meter: r }) {
|
|
742
|
+
let { id: i, text: a } = t();
|
|
743
743
|
return /* @__PURE__ */ F(N, { children: [
|
|
744
|
-
/* @__PURE__ */ P(
|
|
744
|
+
/* @__PURE__ */ P(e.Field, {
|
|
745
745
|
name: "matrixEnabled",
|
|
746
746
|
children: (e) => /* @__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
|
-
htmlFor:
|
|
750
|
-
children: /* @__PURE__ */ P(
|
|
749
|
+
htmlFor: i("rate-matrix"),
|
|
750
|
+
children: /* @__PURE__ */ P(n, { 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(n, { id: "Price each value of one registered dimension separately." })
|
|
754
754
|
})] }), /* @__PURE__ */ P(ue, {
|
|
755
|
-
id:
|
|
755
|
+
id: i("rate-matrix"),
|
|
756
756
|
checked: e.state.value,
|
|
757
757
|
onCheckedChange: e.handleChange,
|
|
758
|
-
disabled: Object.keys(
|
|
758
|
+
disabled: Object.keys(r.group_by ?? {}).length === 0
|
|
759
759
|
})]
|
|
760
760
|
})
|
|
761
761
|
}),
|
|
762
|
-
/* @__PURE__ */ P(
|
|
762
|
+
/* @__PURE__ */ P(e.Subscribe, {
|
|
763
763
|
selector: (e) => e.values.matrixEnabled,
|
|
764
|
-
children: (
|
|
765
|
-
form:
|
|
766
|
-
meter:
|
|
767
|
-
}) : /* @__PURE__ */ P(
|
|
764
|
+
children: (t) => t ? /* @__PURE__ */ P(He, {
|
|
765
|
+
form: e,
|
|
766
|
+
meter: r
|
|
767
|
+
}) : /* @__PURE__ */ P(e.Field, {
|
|
768
768
|
name: "unitAmount",
|
|
769
769
|
children: (e) => /* @__PURE__ */ P(q, {
|
|
770
770
|
id: "rate-unit-amount",
|
|
771
|
-
label:
|
|
771
|
+
label: a("Price per divisor"),
|
|
772
772
|
value: e.state.value,
|
|
773
773
|
onChange: e.handleChange,
|
|
774
774
|
placeholder: "0.0025"
|
|
@@ -778,82 +778,82 @@ function Ve({ form: t, meter: n }) {
|
|
|
778
778
|
/* @__PURE__ */ F("div", {
|
|
779
779
|
className: "grid gap-4 sm:grid-cols-3",
|
|
780
780
|
children: [
|
|
781
|
-
/* @__PURE__ */ P(
|
|
781
|
+
/* @__PURE__ */ P(e.Field, {
|
|
782
782
|
name: "divideBy",
|
|
783
783
|
children: (e) => /* @__PURE__ */ P(K, {
|
|
784
784
|
id: "rate-divide-by",
|
|
785
|
-
label:
|
|
785
|
+
label: a("Divisor"),
|
|
786
786
|
value: e.state.value,
|
|
787
787
|
onChange: e.handleChange,
|
|
788
788
|
inputMode: "numeric",
|
|
789
789
|
placeholder: "1"
|
|
790
790
|
})
|
|
791
791
|
}),
|
|
792
|
-
/* @__PURE__ */ P(
|
|
792
|
+
/* @__PURE__ */ P(e.Field, {
|
|
793
793
|
name: "round",
|
|
794
794
|
children: (e) => /* @__PURE__ */ F("div", {
|
|
795
795
|
className: "grid gap-1.5",
|
|
796
796
|
children: [/* @__PURE__ */ P(j, {
|
|
797
|
-
htmlFor:
|
|
798
|
-
children: /* @__PURE__ */ P(
|
|
797
|
+
htmlFor: i("rate-round"),
|
|
798
|
+
children: /* @__PURE__ */ P(n, { id: "Rounding" })
|
|
799
799
|
}), /* @__PURE__ */ F(C, {
|
|
800
800
|
value: e.state.value,
|
|
801
801
|
onValueChange: (t) => e.handleChange(t),
|
|
802
802
|
children: [/* @__PURE__ */ P(b, {
|
|
803
|
-
id:
|
|
803
|
+
id: i("rate-round"),
|
|
804
804
|
className: "w-full",
|
|
805
805
|
children: /* @__PURE__ */ P(y, {})
|
|
806
806
|
}), /* @__PURE__ */ F(x, { children: [
|
|
807
807
|
/* @__PURE__ */ P(S, {
|
|
808
808
|
value: "half_up",
|
|
809
|
-
children: /* @__PURE__ */ P(
|
|
809
|
+
children: /* @__PURE__ */ P(n, { id: "Nearest" })
|
|
810
810
|
}),
|
|
811
811
|
/* @__PURE__ */ P(S, {
|
|
812
812
|
value: "up",
|
|
813
|
-
children: /* @__PURE__ */ P(
|
|
813
|
+
children: /* @__PURE__ */ P(n, { id: "Up" })
|
|
814
814
|
}),
|
|
815
815
|
/* @__PURE__ */ P(S, {
|
|
816
816
|
value: "down",
|
|
817
|
-
children: /* @__PURE__ */ P(
|
|
817
|
+
children: /* @__PURE__ */ P(n, { id: "Down" })
|
|
818
818
|
})
|
|
819
819
|
] })]
|
|
820
820
|
})]
|
|
821
821
|
})
|
|
822
822
|
}),
|
|
823
|
-
/* @__PURE__ */ P(
|
|
823
|
+
/* @__PURE__ */ P(e.Field, {
|
|
824
824
|
name: "maximumAmount",
|
|
825
825
|
children: (e) => /* @__PURE__ */ P(q, {
|
|
826
826
|
id: "rate-maximum",
|
|
827
|
-
label:
|
|
827
|
+
label: a("Period maximum"),
|
|
828
828
|
value: e.state.value,
|
|
829
829
|
onChange: e.handleChange,
|
|
830
|
-
placeholder:
|
|
830
|
+
placeholder: a("No maximum")
|
|
831
831
|
})
|
|
832
832
|
})
|
|
833
833
|
]
|
|
834
834
|
})
|
|
835
835
|
] });
|
|
836
836
|
}
|
|
837
|
-
function He({ form:
|
|
838
|
-
let { id:
|
|
839
|
-
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(
|
|
837
|
+
function He({ form: e, meter: r }) {
|
|
838
|
+
let { id: i, text: a } = t(), o = M.useContext(G);
|
|
839
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(e.Field, {
|
|
840
840
|
name: "matrixDimension",
|
|
841
841
|
children: (e) => /* @__PURE__ */ F("div", {
|
|
842
842
|
className: "grid gap-1.5",
|
|
843
843
|
children: [
|
|
844
844
|
/* @__PURE__ */ P(j, {
|
|
845
|
-
htmlFor:
|
|
846
|
-
children: /* @__PURE__ */ P(
|
|
845
|
+
htmlFor: i("matrix-dimension"),
|
|
846
|
+
children: /* @__PURE__ */ P(n, { id: "Dimension" })
|
|
847
847
|
}),
|
|
848
848
|
/* @__PURE__ */ F(C, {
|
|
849
849
|
value: e.state.value || null,
|
|
850
850
|
onValueChange: (t) => e.handleChange(t ?? ""),
|
|
851
851
|
children: [/* @__PURE__ */ P(b, {
|
|
852
|
-
id:
|
|
852
|
+
id: i("matrix-dimension"),
|
|
853
853
|
className: "w-full",
|
|
854
|
-
...Y("matrix-dimension",
|
|
855
|
-
children: /* @__PURE__ */ P(y, { placeholder:
|
|
856
|
-
}), /* @__PURE__ */ P(x, { children: Object.keys(
|
|
854
|
+
...Y("matrix-dimension", o),
|
|
855
|
+
children: /* @__PURE__ */ P(y, { placeholder: a("Select dimension") })
|
|
856
|
+
}), /* @__PURE__ */ P(x, { children: Object.keys(r.group_by ?? {}).map((e) => /* @__PURE__ */ P(S, {
|
|
857
857
|
value: e,
|
|
858
858
|
children: e
|
|
859
859
|
}, e)) })]
|
|
@@ -861,20 +861,20 @@ function He({ form: t, meter: n }) {
|
|
|
861
861
|
/* @__PURE__ */ P(X, { fieldId: "matrix-dimension" })
|
|
862
862
|
]
|
|
863
863
|
})
|
|
864
|
-
}), /* @__PURE__ */ P(
|
|
864
|
+
}), /* @__PURE__ */ P(e.Field, {
|
|
865
865
|
name: "matrixCells",
|
|
866
866
|
mode: "array",
|
|
867
|
-
children: (
|
|
867
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
868
868
|
className: "grid gap-2",
|
|
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(
|
|
873
|
-
id:
|
|
872
|
+
children: [/* @__PURE__ */ P(j, { children: /* @__PURE__ */ P(n, { id: "Matrix cells" }) }), /* @__PURE__ */ F(s, {
|
|
873
|
+
id: i("matrix-add-cell"),
|
|
874
874
|
type: "button",
|
|
875
875
|
variant: "outline",
|
|
876
876
|
size: "sm",
|
|
877
|
-
onClick: () =>
|
|
877
|
+
onClick: () => t.pushValue({
|
|
878
878
|
key: "",
|
|
879
879
|
unitAmount: "",
|
|
880
880
|
maximumAmount: ""
|
|
@@ -882,51 +882,51 @@ function He({ form: t, meter: n }) {
|
|
|
882
882
|
children: [/* @__PURE__ */ P(I, {
|
|
883
883
|
icon: L,
|
|
884
884
|
className: "size-4"
|
|
885
|
-
}), /* @__PURE__ */ P(
|
|
885
|
+
}), /* @__PURE__ */ P(n, { 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(n, { id: "Value" }) }),
|
|
893
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(n, { id: "Unit price" }) }),
|
|
894
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(n, { id: "Maximum" }) }),
|
|
895
895
|
/* @__PURE__ */ P("span", {
|
|
896
896
|
className: "size-8",
|
|
897
897
|
"aria-hidden": "true"
|
|
898
898
|
})
|
|
899
899
|
]
|
|
900
900
|
}),
|
|
901
|
-
|
|
901
|
+
t.state.value.map((n, 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
|
-
label:
|
|
906
|
+
label: a("Value"),
|
|
907
907
|
value: n.key,
|
|
908
|
-
onChange: (
|
|
909
|
-
placeholder:
|
|
908
|
+
onChange: (t) => e.setFieldValue(`matrixCells[${r}].key`, t),
|
|
909
|
+
placeholder: a("gpt-5")
|
|
910
910
|
}),
|
|
911
911
|
/* @__PURE__ */ P(J, {
|
|
912
912
|
id: `matrix-cell-${r}-unit-price`,
|
|
913
|
-
label:
|
|
913
|
+
label: a("Unit price"),
|
|
914
914
|
value: n.unitAmount,
|
|
915
|
-
onChange: (
|
|
915
|
+
onChange: (t) => e.setFieldValue(`matrixCells[${r}].unitAmount`, t),
|
|
916
916
|
inputMode: "decimal",
|
|
917
|
-
placeholder:
|
|
917
|
+
placeholder: a("Price")
|
|
918
918
|
}),
|
|
919
919
|
/* @__PURE__ */ P(J, {
|
|
920
920
|
id: `matrix-cell-${r}-maximum`,
|
|
921
|
-
label:
|
|
921
|
+
label: a("Maximum"),
|
|
922
922
|
value: n.maximumAmount,
|
|
923
|
-
onChange: (
|
|
923
|
+
onChange: (t) => e.setFieldValue(`matrixCells[${r}].maximumAmount`, t),
|
|
924
924
|
inputMode: "decimal",
|
|
925
|
-
placeholder:
|
|
925
|
+
placeholder: a("Maximum")
|
|
926
926
|
}),
|
|
927
927
|
/* @__PURE__ */ P(Ye, {
|
|
928
928
|
label: `Remove matrix cell ${r + 1}`,
|
|
929
|
-
onClick: () =>
|
|
929
|
+
onClick: () => t.removeValue(r)
|
|
930
930
|
})
|
|
931
931
|
]
|
|
932
932
|
}, r))
|
|
@@ -934,25 +934,25 @@ function He({ form: t, meter: n }) {
|
|
|
934
934
|
})
|
|
935
935
|
})] });
|
|
936
936
|
}
|
|
937
|
-
function Ue({ form:
|
|
938
|
-
let { id:
|
|
939
|
-
return /* @__PURE__ */ P(N, { children: /* @__PURE__ */ P(
|
|
937
|
+
function Ue({ form: e }) {
|
|
938
|
+
let { id: r, text: i } = t();
|
|
939
|
+
return /* @__PURE__ */ P(N, { children: /* @__PURE__ */ P(e.Field, {
|
|
940
940
|
name: "tiers",
|
|
941
941
|
mode: "array",
|
|
942
|
-
children: (
|
|
942
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
943
943
|
className: "grid gap-2",
|
|
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(n, { id: "Tiers" }) }), /* @__PURE__ */ P("p", {
|
|
948
948
|
className: "text-xs text-muted-foreground",
|
|
949
|
-
children: /* @__PURE__ */ P(
|
|
949
|
+
children: /* @__PURE__ */ P(n, { id: "Leave the final limit blank for the unbounded tier." })
|
|
950
950
|
})] }), /* @__PURE__ */ F(s, {
|
|
951
|
-
id:
|
|
951
|
+
id: r("tier-add"),
|
|
952
952
|
type: "button",
|
|
953
953
|
variant: "outline",
|
|
954
954
|
size: "sm",
|
|
955
|
-
onClick: () =>
|
|
955
|
+
onClick: () => t.pushValue({
|
|
956
956
|
upTo: "",
|
|
957
957
|
unitAmount: "",
|
|
958
958
|
flatAmount: ""
|
|
@@ -960,66 +960,66 @@ function Ue({ form: t }) {
|
|
|
960
960
|
children: [/* @__PURE__ */ P(I, {
|
|
961
961
|
icon: L,
|
|
962
962
|
className: "size-4"
|
|
963
|
-
}), /* @__PURE__ */ P(
|
|
963
|
+
}), /* @__PURE__ */ P(n, { 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(n, { id: "Upper limit" }) }),
|
|
971
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(n, { id: "Unit price" }) }),
|
|
972
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(n, { 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
|
-
|
|
979
|
+
t.state.value.map((n, 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
|
-
id: `tier-${
|
|
984
|
-
label:
|
|
983
|
+
id: `tier-${r}-limit`,
|
|
984
|
+
label: i("Upper limit"),
|
|
985
985
|
value: n.upTo,
|
|
986
|
-
onChange: (
|
|
986
|
+
onChange: (t) => e.setFieldValue(`tiers[${r}].upTo`, t),
|
|
987
987
|
inputMode: "numeric",
|
|
988
|
-
placeholder:
|
|
988
|
+
placeholder: r === t.state.value.length - 1 ? "No limit" : "Up to"
|
|
989
989
|
}),
|
|
990
990
|
/* @__PURE__ */ P(J, {
|
|
991
|
-
id: `tier-${
|
|
992
|
-
label:
|
|
991
|
+
id: `tier-${r}-unit-price`,
|
|
992
|
+
label: i("Unit price"),
|
|
993
993
|
value: n.unitAmount,
|
|
994
|
-
onChange: (
|
|
994
|
+
onChange: (t) => e.setFieldValue(`tiers[${r}].unitAmount`, t),
|
|
995
995
|
inputMode: "decimal",
|
|
996
|
-
placeholder:
|
|
996
|
+
placeholder: i("Unit price")
|
|
997
997
|
}),
|
|
998
998
|
/* @__PURE__ */ P(J, {
|
|
999
|
-
id: `tier-${
|
|
1000
|
-
label:
|
|
999
|
+
id: `tier-${r}-flat-amount`,
|
|
1000
|
+
label: i("Flat amount"),
|
|
1001
1001
|
value: n.flatAmount,
|
|
1002
|
-
onChange: (
|
|
1002
|
+
onChange: (t) => e.setFieldValue(`tiers[${r}].flatAmount`, t),
|
|
1003
1003
|
inputMode: "decimal",
|
|
1004
|
-
placeholder:
|
|
1004
|
+
placeholder: i("Flat amount")
|
|
1005
1005
|
}),
|
|
1006
1006
|
/* @__PURE__ */ P(Ye, {
|
|
1007
|
-
label: `Remove tier ${
|
|
1008
|
-
onClick: () =>
|
|
1009
|
-
disabled:
|
|
1007
|
+
label: `Remove tier ${r + 1}`,
|
|
1008
|
+
onClick: () => t.removeValue(r),
|
|
1009
|
+
disabled: t.state.value.length === 1
|
|
1010
1010
|
})
|
|
1011
1011
|
]
|
|
1012
|
-
},
|
|
1012
|
+
}, r))
|
|
1013
1013
|
]
|
|
1014
1014
|
})
|
|
1015
1015
|
}) });
|
|
1016
1016
|
}
|
|
1017
|
-
function We({ form:
|
|
1018
|
-
let { text: n } =
|
|
1017
|
+
function We({ form: e }) {
|
|
1018
|
+
let { text: n } = t();
|
|
1019
1019
|
return /* @__PURE__ */ F("div", {
|
|
1020
1020
|
className: "grid gap-4 sm:grid-cols-3",
|
|
1021
1021
|
children: [
|
|
1022
|
-
/* @__PURE__ */ P(
|
|
1022
|
+
/* @__PURE__ */ P(e.Field, {
|
|
1023
1023
|
name: "packageAmount",
|
|
1024
1024
|
children: (e) => /* @__PURE__ */ P(q, {
|
|
1025
1025
|
id: "package-amount",
|
|
@@ -1029,7 +1029,7 @@ function We({ form: t }) {
|
|
|
1029
1029
|
placeholder: "10.00"
|
|
1030
1030
|
})
|
|
1031
1031
|
}),
|
|
1032
|
-
/* @__PURE__ */ P(
|
|
1032
|
+
/* @__PURE__ */ P(e.Field, {
|
|
1033
1033
|
name: "packageSize",
|
|
1034
1034
|
children: (e) => /* @__PURE__ */ P(K, {
|
|
1035
1035
|
id: "package-size",
|
|
@@ -1040,7 +1040,7 @@ function We({ form: t }) {
|
|
|
1040
1040
|
placeholder: "1000"
|
|
1041
1041
|
})
|
|
1042
1042
|
}),
|
|
1043
|
-
/* @__PURE__ */ P(
|
|
1043
|
+
/* @__PURE__ */ P(e.Field, {
|
|
1044
1044
|
name: "freeUnits",
|
|
1045
1045
|
children: (e) => /* @__PURE__ */ P(K, {
|
|
1046
1046
|
id: "package-free",
|
|
@@ -1054,53 +1054,53 @@ function We({ form: t }) {
|
|
|
1054
1054
|
]
|
|
1055
1055
|
});
|
|
1056
1056
|
}
|
|
1057
|
-
function Ge({ form:
|
|
1058
|
-
let { id:
|
|
1057
|
+
function Ge({ form: e, meter: r }) {
|
|
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(n, { 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(n, { id: "Optional. Only events with one of the listed dimension values are rated." })
|
|
1067
|
+
})] }), /* @__PURE__ */ P(e.Field, {
|
|
1068
1068
|
name: "filters",
|
|
1069
1069
|
mode: "array",
|
|
1070
|
-
children: (
|
|
1070
|
+
children: (t) => /* @__PURE__ */ F("div", {
|
|
1071
1071
|
className: "grid gap-2",
|
|
1072
1072
|
children: [
|
|
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(n, { id: "Dimension" }) }),
|
|
1077
|
+
/* @__PURE__ */ P("span", { children: /* @__PURE__ */ P(n, { id: "Values" }) }),
|
|
1078
1078
|
/* @__PURE__ */ P("span", {
|
|
1079
1079
|
className: "size-8",
|
|
1080
1080
|
"aria-hidden": "true"
|
|
1081
1081
|
})
|
|
1082
1082
|
]
|
|
1083
1083
|
}),
|
|
1084
|
-
|
|
1084
|
+
t.state.value.map((s, c) => /* @__PURE__ */ F("div", {
|
|
1085
1085
|
className: "grid gap-2 sm:grid-cols-[1fr_2fr_auto]",
|
|
1086
1086
|
children: [
|
|
1087
1087
|
/* @__PURE__ */ F("div", {
|
|
1088
1088
|
className: "grid gap-1.5",
|
|
1089
1089
|
children: [
|
|
1090
1090
|
/* @__PURE__ */ P(j, {
|
|
1091
|
-
htmlFor:
|
|
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(n, { id: "Dimension" })
|
|
1094
1094
|
}),
|
|
1095
1095
|
/* @__PURE__ */ F(C, {
|
|
1096
1096
|
value: s.key || null,
|
|
1097
|
-
onValueChange: (
|
|
1097
|
+
onValueChange: (t) => e.setFieldValue(`filters[${c}].key`, t ?? ""),
|
|
1098
1098
|
children: [/* @__PURE__ */ P(b, {
|
|
1099
|
-
id:
|
|
1099
|
+
id: i(`filter-${c}-dimension`),
|
|
1100
1100
|
className: "w-full",
|
|
1101
|
-
...Y(`filter-${c}-dimension`,
|
|
1102
|
-
children: /* @__PURE__ */ P(y, { placeholder:
|
|
1103
|
-
}), /* @__PURE__ */ P(x, { children: Object.keys(
|
|
1101
|
+
...Y(`filter-${c}-dimension`, o),
|
|
1102
|
+
children: /* @__PURE__ */ P(y, { placeholder: a("Dimension") })
|
|
1103
|
+
}), /* @__PURE__ */ P(x, { children: Object.keys(r.group_by ?? {}).map((e) => /* @__PURE__ */ P(S, {
|
|
1104
1104
|
value: e,
|
|
1105
1105
|
children: e
|
|
1106
1106
|
}, e)) })]
|
|
@@ -1110,14 +1110,14 @@ function Ge({ form: t, meter: n }) {
|
|
|
1110
1110
|
}),
|
|
1111
1111
|
/* @__PURE__ */ P(J, {
|
|
1112
1112
|
id: `filter-${c}-values`,
|
|
1113
|
-
label:
|
|
1113
|
+
label: a("Values"),
|
|
1114
1114
|
value: s.value,
|
|
1115
|
-
onChange: (
|
|
1116
|
-
placeholder:
|
|
1115
|
+
onChange: (t) => e.setFieldValue(`filters[${c}].value`, t),
|
|
1116
|
+
placeholder: a("eu, us")
|
|
1117
1117
|
}),
|
|
1118
1118
|
/* @__PURE__ */ P(Ye, {
|
|
1119
1119
|
label: `Remove filter ${c + 1}`,
|
|
1120
|
-
onClick: () =>
|
|
1120
|
+
onClick: () => t.removeValue(c)
|
|
1121
1121
|
})
|
|
1122
1122
|
]
|
|
1123
1123
|
}, c)),
|
|
@@ -1126,61 +1126,61 @@ function Ge({ form: t, meter: n }) {
|
|
|
1126
1126
|
variant: "outline",
|
|
1127
1127
|
size: "sm",
|
|
1128
1128
|
className: "w-fit",
|
|
1129
|
-
disabled: Object.keys(
|
|
1130
|
-
onClick: () =>
|
|
1129
|
+
disabled: Object.keys(r.group_by ?? {}).length === 0,
|
|
1130
|
+
onClick: () => t.pushValue({
|
|
1131
1131
|
key: "",
|
|
1132
1132
|
value: ""
|
|
1133
1133
|
}),
|
|
1134
1134
|
children: [/* @__PURE__ */ P(I, {
|
|
1135
1135
|
icon: L,
|
|
1136
1136
|
className: "size-4"
|
|
1137
|
-
}), /* @__PURE__ */ P(
|
|
1137
|
+
}), /* @__PURE__ */ P(n, { id: "Add filter" })]
|
|
1138
1138
|
})
|
|
1139
1139
|
]
|
|
1140
1140
|
})
|
|
1141
1141
|
})]
|
|
1142
1142
|
});
|
|
1143
1143
|
}
|
|
1144
|
-
function Ke({ form:
|
|
1145
|
-
let { id:
|
|
1144
|
+
function Ke({ form: e }) {
|
|
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(n, { id: "Allowance" })
|
|
1152
1152
|
}),
|
|
1153
|
-
/* @__PURE__ */ P(
|
|
1153
|
+
/* @__PURE__ */ P(e.Field, {
|
|
1154
1154
|
name: "allowanceMode",
|
|
1155
1155
|
children: (e) => /* @__PURE__ */ F("div", {
|
|
1156
1156
|
className: "grid gap-1.5",
|
|
1157
1157
|
children: [/* @__PURE__ */ P(j, {
|
|
1158
|
-
htmlFor:
|
|
1159
|
-
children: /* @__PURE__ */ P(
|
|
1158
|
+
htmlFor: r("allowance-mode"),
|
|
1159
|
+
children: /* @__PURE__ */ P(n, { id: "Included usage" })
|
|
1160
1160
|
}), /* @__PURE__ */ F(C, {
|
|
1161
1161
|
value: e.state.value,
|
|
1162
1162
|
onValueChange: (t) => e.handleChange(t),
|
|
1163
1163
|
children: [/* @__PURE__ */ P(b, {
|
|
1164
|
-
id:
|
|
1164
|
+
id: r("allowance-mode"),
|
|
1165
1165
|
className: "w-full",
|
|
1166
1166
|
children: /* @__PURE__ */ P(y, {})
|
|
1167
1167
|
}), /* @__PURE__ */ F(x, { children: [/* @__PURE__ */ P(S, {
|
|
1168
1168
|
value: "none",
|
|
1169
|
-
children: /* @__PURE__ */ P(
|
|
1169
|
+
children: /* @__PURE__ */ P(n, { id: "No allowance" })
|
|
1170
1170
|
}), /* @__PURE__ */ P(S, {
|
|
1171
1171
|
value: "included",
|
|
1172
|
-
children: /* @__PURE__ */ P(
|
|
1172
|
+
children: /* @__PURE__ */ P(n, { id: "Fixed included units" })
|
|
1173
1173
|
})] })]
|
|
1174
1174
|
})]
|
|
1175
1175
|
})
|
|
1176
1176
|
}),
|
|
1177
|
-
/* @__PURE__ */ P(
|
|
1177
|
+
/* @__PURE__ */ P(e.Subscribe, {
|
|
1178
1178
|
selector: (e) => e.values.allowanceMode,
|
|
1179
|
-
children: (
|
|
1179
|
+
children: (t) => t === "included" ? /* @__PURE__ */ P(e.Field, {
|
|
1180
1180
|
name: "allowanceIncluded",
|
|
1181
1181
|
children: (e) => /* @__PURE__ */ P(K, {
|
|
1182
1182
|
id: "allowance-included",
|
|
1183
|
-
label:
|
|
1183
|
+
label: i("Included units per period"),
|
|
1184
1184
|
value: e.state.value,
|
|
1185
1185
|
onChange: e.handleChange,
|
|
1186
1186
|
inputMode: "numeric",
|
|
@@ -1202,35 +1202,35 @@ function qe({ values: e }) {
|
|
|
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(n, { id: "Rate preview" })
|
|
1206
1206
|
}), /* @__PURE__ */ P("p", {
|
|
1207
1207
|
className: "mt-1 text-sm font-medium tabular-nums",
|
|
1208
1208
|
children: t
|
|
1209
1209
|
})]
|
|
1210
1210
|
});
|
|
1211
1211
|
}
|
|
1212
|
-
function K({ id:
|
|
1213
|
-
let { id: s } =
|
|
1212
|
+
function K({ id: e, label: n, value: r, onChange: i, placeholder: a, inputMode: o }) {
|
|
1213
|
+
let { id: s } = t(), l = Je(e);
|
|
1214
1214
|
return /* @__PURE__ */ F("div", {
|
|
1215
1215
|
className: "grid gap-1.5",
|
|
1216
1216
|
children: [
|
|
1217
1217
|
/* @__PURE__ */ P(j, {
|
|
1218
|
-
htmlFor: s(
|
|
1218
|
+
htmlFor: s(e),
|
|
1219
1219
|
children: n
|
|
1220
1220
|
}),
|
|
1221
1221
|
/* @__PURE__ */ P(c, {
|
|
1222
|
-
id: s(
|
|
1222
|
+
id: s(e),
|
|
1223
1223
|
value: r,
|
|
1224
1224
|
onChange: (e) => i(e.target.value),
|
|
1225
1225
|
placeholder: a,
|
|
1226
1226
|
inputMode: o,
|
|
1227
1227
|
autoComplete: "off",
|
|
1228
|
-
...Y(
|
|
1229
|
-
fieldId:
|
|
1228
|
+
...Y(e, l ? {
|
|
1229
|
+
fieldId: e,
|
|
1230
1230
|
message: l
|
|
1231
1231
|
} : null)
|
|
1232
1232
|
}),
|
|
1233
|
-
/* @__PURE__ */ P(X, { fieldId:
|
|
1233
|
+
/* @__PURE__ */ P(X, { fieldId: e })
|
|
1234
1234
|
]
|
|
1235
1235
|
});
|
|
1236
1236
|
}
|
|
@@ -1240,29 +1240,29 @@ function q(e) {
|
|
|
1240
1240
|
inputMode: "decimal"
|
|
1241
1241
|
});
|
|
1242
1242
|
}
|
|
1243
|
-
function J({ id:
|
|
1244
|
-
let { id: s } =
|
|
1243
|
+
function J({ id: e, label: n, value: r, onChange: i, placeholder: a, inputMode: o }) {
|
|
1244
|
+
let { id: s } = t(), l = Je(e);
|
|
1245
1245
|
return /* @__PURE__ */ F("div", {
|
|
1246
1246
|
className: "grid gap-1.5",
|
|
1247
1247
|
children: [
|
|
1248
1248
|
/* @__PURE__ */ P(j, {
|
|
1249
|
-
htmlFor: s(
|
|
1249
|
+
htmlFor: s(e),
|
|
1250
1250
|
className: "text-xs text-muted-foreground sm:sr-only",
|
|
1251
1251
|
children: n
|
|
1252
1252
|
}),
|
|
1253
1253
|
/* @__PURE__ */ P(c, {
|
|
1254
|
-
id: s(
|
|
1254
|
+
id: s(e),
|
|
1255
1255
|
value: r,
|
|
1256
1256
|
onChange: (e) => i(e.target.value),
|
|
1257
1257
|
placeholder: a,
|
|
1258
1258
|
inputMode: o,
|
|
1259
1259
|
autoComplete: "off",
|
|
1260
|
-
...Y(
|
|
1261
|
-
fieldId:
|
|
1260
|
+
...Y(e, l ? {
|
|
1261
|
+
fieldId: e,
|
|
1262
1262
|
message: l
|
|
1263
1263
|
} : null)
|
|
1264
1264
|
}),
|
|
1265
|
-
/* @__PURE__ */ P(X, { fieldId:
|
|
1265
|
+
/* @__PURE__ */ P(X, { fieldId: e })
|
|
1266
1266
|
]
|
|
1267
1267
|
});
|
|
1268
1268
|
}
|
|
@@ -1277,10 +1277,10 @@ function Y(e, t) {
|
|
|
1277
1277
|
"aria-describedby": n ? `${e}-error` : void 0
|
|
1278
1278
|
};
|
|
1279
1279
|
}
|
|
1280
|
-
function X({ fieldId:
|
|
1281
|
-
let { id: n } =
|
|
1280
|
+
function X({ fieldId: e }) {
|
|
1281
|
+
let { id: n } = t(), r = Je(e);
|
|
1282
1282
|
return r ? /* @__PURE__ */ P("p", {
|
|
1283
|
-
id: n(`${
|
|
1283
|
+
id: n(`${e}-error`),
|
|
1284
1284
|
className: "text-xs text-destructive",
|
|
1285
1285
|
children: r
|
|
1286
1286
|
}) : null;
|
|
@@ -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: r } = t(), { adminQueries: a } = i(), [o, l] = M.useState(""), d = w("", Xe), { data: f, isPending: p, error: m, refetch: h } = me(a.usageMeters(d.size, d.cursor)), g = u(), _ = f?.data ?? [], v = o.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 e ? 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(n, { 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(n, { 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(n, { 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: r("Metering access is restricted"),
|
|
1337
|
+
description: r("Your role does not have permission to read the merchant catalog.")
|
|
1338
1338
|
}) : b === "error" ? /* @__PURE__ */ P($, {
|
|
1339
|
-
title:
|
|
1340
|
-
description:
|
|
1339
|
+
title: r("Metering could not be loaded"),
|
|
1340
|
+
description: r("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(n, { id: "Try again" })
|
|
1346
1346
|
})
|
|
1347
1347
|
}) : b === "empty" ? /* @__PURE__ */ P($, {
|
|
1348
|
-
title:
|
|
1349
|
-
description:
|
|
1348
|
+
title: r("No usage meters yet"),
|
|
1349
|
+
description: r("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,11 +1355,11 @@ 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: o,
|
|
1359
1359
|
onChange: (e) => l(e.target.value),
|
|
1360
1360
|
className: "pl-8",
|
|
1361
|
-
placeholder:
|
|
1362
|
-
"aria-label":
|
|
1361
|
+
placeholder: r("Filter this page…"),
|
|
1362
|
+
"aria-label": r("Filter meters on this page")
|
|
1363
1363
|
})]
|
|
1364
1364
|
}),
|
|
1365
1365
|
/* @__PURE__ */ P("div", {
|
|
@@ -1369,48 +1369,48 @@ function Ze() {
|
|
|
1369
1369
|
children: [
|
|
1370
1370
|
/* @__PURE__ */ P(E, {
|
|
1371
1371
|
className: "text-muted-foreground",
|
|
1372
|
-
children: /* @__PURE__ */ P(
|
|
1372
|
+
children: /* @__PURE__ */ P(n, { id: "Meter" })
|
|
1373
1373
|
}),
|
|
1374
1374
|
/* @__PURE__ */ P(E, {
|
|
1375
1375
|
className: "text-muted-foreground",
|
|
1376
|
-
children: /* @__PURE__ */ P(
|
|
1376
|
+
children: /* @__PURE__ */ P(n, { id: "Event" })
|
|
1377
1377
|
}),
|
|
1378
1378
|
/* @__PURE__ */ P(E, {
|
|
1379
1379
|
className: "text-muted-foreground",
|
|
1380
|
-
children: /* @__PURE__ */ P(
|
|
1380
|
+
children: /* @__PURE__ */ P(n, { id: "Aggregation" })
|
|
1381
1381
|
}),
|
|
1382
1382
|
/* @__PURE__ */ P(E, {
|
|
1383
1383
|
className: "text-muted-foreground",
|
|
1384
|
-
children: /* @__PURE__ */ P(
|
|
1384
|
+
children: /* @__PURE__ */ P(n, { id: "Default price" })
|
|
1385
1385
|
}),
|
|
1386
1386
|
/* @__PURE__ */ P(E, {
|
|
1387
1387
|
className: "text-muted-foreground",
|
|
1388
|
-
children: /* @__PURE__ */ P(
|
|
1388
|
+
children: /* @__PURE__ */ P(n, { id: "Product" })
|
|
1389
1389
|
}),
|
|
1390
1390
|
/* @__PURE__ */ P(E, {
|
|
1391
1391
|
className: "text-muted-foreground",
|
|
1392
|
-
children: /* @__PURE__ */ P(
|
|
1392
|
+
children: /* @__PURE__ */ P(n, { id: "Activity" })
|
|
1393
1393
|
}),
|
|
1394
1394
|
/* @__PURE__ */ P(E, {
|
|
1395
1395
|
className: "text-muted-foreground",
|
|
1396
|
-
children: /* @__PURE__ */ P(
|
|
1396
|
+
children: /* @__PURE__ */ P(n, { id: "Last event" })
|
|
1397
1397
|
}),
|
|
1398
1398
|
/* @__PURE__ */ P(E, { children: /* @__PURE__ */ P("span", {
|
|
1399
1399
|
className: "sr-only",
|
|
1400
|
-
children: /* @__PURE__ */ P(
|
|
1400
|
+
children: /* @__PURE__ */ P(n, { id: "Open" })
|
|
1401
1401
|
}) })
|
|
1402
1402
|
]
|
|
1403
1403
|
}) }), /* @__PURE__ */ F(ee, { children: [y.map((e) => /* @__PURE__ */ P(Qe, { meter: e }, e.key)), y.length === 0 && /* @__PURE__ */ P(O, { children: /* @__PURE__ */ F(D, {
|
|
1404
1404
|
colSpan: 9,
|
|
1405
1405
|
className: "h-24 text-center text-muted-foreground",
|
|
1406
1406
|
children: [
|
|
1407
|
-
/* @__PURE__ */ P(
|
|
1408
|
-
|
|
1407
|
+
/* @__PURE__ */ P(n, { id: "No meters on this page match “" }),
|
|
1408
|
+
o,
|
|
1409
1409
|
"”."
|
|
1410
1410
|
]
|
|
1411
1411
|
}) })] })] })
|
|
1412
1412
|
}),
|
|
1413
|
-
/* @__PURE__ */ P(
|
|
1413
|
+
/* @__PURE__ */ P(T, {
|
|
1414
1414
|
pages: d,
|
|
1415
1415
|
rows: f?.data?.length ?? 0,
|
|
1416
1416
|
nextCursor: f?.next_cursor,
|
|
@@ -1429,7 +1429,7 @@ function Qe({ meter: e }) {
|
|
|
1429
1429
|
return /* @__PURE__ */ F(ne, {
|
|
1430
1430
|
to: `/catalog/metering/${encodeURIComponent(e.key)}`,
|
|
1431
1431
|
children: [
|
|
1432
|
-
/* @__PURE__ */ F(D, { children: [/* @__PURE__ */ P(
|
|
1432
|
+
/* @__PURE__ */ F(D, { children: [/* @__PURE__ */ P(a, {
|
|
1433
1433
|
className: "font-medium underline-offset-3 hover:underline",
|
|
1434
1434
|
to: `/catalog/metering/${encodeURIComponent(e.key)}`,
|
|
1435
1435
|
children: e.key
|
|
@@ -1466,18 +1466,18 @@ function Qe({ meter: e }) {
|
|
|
1466
1466
|
});
|
|
1467
1467
|
}
|
|
1468
1468
|
function $e() {
|
|
1469
|
-
let { text:
|
|
1469
|
+
let { text: a } = t(), { adminQueries: c } = i(), { key: l = "" } = r(), d = l, f = o(), 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 t = p.error instanceof e && p.error.status === 404, n = p.error instanceof e && p.error.status === 403;
|
|
1473
1473
|
return /* @__PURE__ */ P($, {
|
|
1474
|
-
title: n ? "Metering access is restricted" :
|
|
1475
|
-
description: n ? "Your role does not have permission to read this meter." :
|
|
1474
|
+
title: n ? "Metering access is restricted" : t ? "Meter not found" : "Meter could not be loaded",
|
|
1475
|
+
description: n ? "Your role does not have permission to read this meter." : t ? "This meter does not exist in the active merchant catalog." : "Try loading the meter again.",
|
|
1476
1476
|
action: n ? void 0 : /* @__PURE__ */ P(s, {
|
|
1477
1477
|
variant: "outline",
|
|
1478
1478
|
size: "sm",
|
|
1479
|
-
onClick: () =>
|
|
1480
|
-
children:
|
|
1479
|
+
onClick: () => t ? f("/catalog/metering") : void p.refetch(),
|
|
1480
|
+
children: t ? "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": a("Back to metering"),
|
|
1498
1498
|
children: /* @__PURE__ */ P(I, {
|
|
1499
1499
|
icon: _e,
|
|
1500
1500
|
className: "size-4"
|
|
@@ -1509,7 +1509,7 @@ function $e() {
|
|
|
1509
1509
|
children: g.key
|
|
1510
1510
|
}), !m && /* @__PURE__ */ P(A, {
|
|
1511
1511
|
variant: "secondary",
|
|
1512
|
-
children: /* @__PURE__ */ P(
|
|
1512
|
+
children: /* @__PURE__ */ P(n, { 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 e && 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(n, { 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(n, { 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(n, { 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(n, { id: "/app/usage-events" })
|
|
1555
1555
|
}),
|
|
1556
|
-
/* @__PURE__ */ P(
|
|
1556
|
+
/* @__PURE__ */ P(n, { 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: a("Event type"),
|
|
1564
1564
|
value: g.event_type
|
|
1565
1565
|
}),
|
|
1566
1566
|
/* @__PURE__ */ P(Z, {
|
|
1567
|
-
label:
|
|
1567
|
+
label: a("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: a("Meter key"),
|
|
1572
1572
|
value: g.key
|
|
1573
1573
|
}),
|
|
1574
1574
|
/* @__PURE__ */ P(Z, {
|
|
1575
|
-
label:
|
|
1575
|
+
label: a("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:
|
|
1600
|
+
function et({ meter: e, writesAllowed: r }) {
|
|
1601
|
+
let { toast: a, toastApiError: o, adminMutations: c } = i(), { text: l } = t(), u = _(), d = he(), f = pe(c.deleteDefaultUsageRateCard(d)), p = e.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,9 +1606,9 @@ function et({ meter: t, writesAllowed: n }) {
|
|
|
1606
1606
|
cancelLabel: "Keep rate",
|
|
1607
1607
|
tone: "destructive"
|
|
1608
1608
|
})) try {
|
|
1609
|
-
await f.mutateAsync(
|
|
1609
|
+
await f.mutateAsync(e), a.success("Default rate removed");
|
|
1610
1610
|
} catch (e) {
|
|
1611
|
-
|
|
1611
|
+
o(e, "Remove default rate");
|
|
1612
1612
|
}
|
|
1613
1613
|
};
|
|
1614
1614
|
return /* @__PURE__ */ F("section", {
|
|
@@ -1617,11 +1617,11 @@ function et({ meter: t, writesAllowed: n }) {
|
|
|
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(n, { 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(n, { id: "Used for every customer." })
|
|
1624
|
+
})] }), p && r && /* @__PURE__ */ F(s, {
|
|
1625
1625
|
variant: "outline",
|
|
1626
1626
|
size: "sm",
|
|
1627
1627
|
disabled: f.isPending,
|
|
@@ -1631,7 +1631,7 @@ function et({ meter: t, writesAllowed: n }) {
|
|
|
1631
1631
|
className: "size-4"
|
|
1632
1632
|
}), f.isPending ? "Removing…" : "Remove default"]
|
|
1633
1633
|
})]
|
|
1634
|
-
}),
|
|
1634
|
+
}), e.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: t, writesAllowed: n }) {
|
|
|
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(n, { id: "No default rate. Usage is recorded but is not billed by this meter." })
|
|
1665
|
+
}) : /* @__PURE__ */ P(Q, { children: /* @__PURE__ */ P(n, { 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-D-e-37Jn.js.map
|