@oneuptime/common 12.0.17 → 12.0.18

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.
@@ -2074,6 +2074,14 @@ export class BillingService extends BaseService {
2074
2074
  return "price_1U0iWJANuQdJ93r7iVAXwhdP";
2075
2075
  }
2076
2076
 
2077
+ if (productType === ProductType.SecurityEvents) {
2078
+ if (this.isTestEnvironment()) {
2079
+ return "price_1U7efaANuQdJ93r74hFVOgdS";
2080
+ }
2081
+
2082
+ return "price_1U7edTANuQdJ93r7hR9jpBfv";
2083
+ }
2084
+
2077
2085
  throw new BadDataException(
2078
2086
  "Plan with productType " + productType + " not found",
2079
2087
  );
@@ -120,6 +120,23 @@ describe("Pay as you go notices", () => {
120
120
  expect(card).toHaveTextContent("Starting at");
121
121
  });
122
122
 
123
+ it("names security events among the pillars billed at the telemetry rate", () => {
124
+ /*
125
+ * Security events ingest on the same key and meter at the same
126
+ * $0.10/GB as the other telemetry pillars. This sentence is the body of
127
+ * the consent checkbox a user has to tick to create a key, so a pillar
128
+ * missing from it is a pillar the user is charged for without ever
129
+ * having been told.
130
+ */
131
+ render(<TelemetryPayAsYouGoCard />);
132
+
133
+ expect(
134
+ screen.getByTestId("telemetry-pay-as-you-go-card"),
135
+ ).toHaveTextContent(
136
+ "Logs, traces, metrics, profiles and security events are billed at",
137
+ );
138
+ });
139
+
123
140
  it("says the charge stops when the key is deleted, so the notice is not just a threat", () => {
124
141
  render(<TelemetryPayAsYouGoCard />);
125
142
 
@@ -882,6 +882,9 @@ describe("BillingService", () => {
882
882
  expect(service.hasMeteredPlanPriceId(ProductType.SessionReplay)).toBe(
883
883
  true,
884
884
  );
885
+ expect(service.hasMeteredPlanPriceId(ProductType.SecurityEvents)).toBe(
886
+ true,
887
+ );
885
888
  });
886
889
 
887
890
  it("should return false for a product type with no Stripe price", () => {
@@ -901,6 +904,23 @@ describe("BillingService", () => {
901
904
  expect(LogDataIngestMeteredPlan.hasPriceId()).toBe(true);
902
905
  expect(SessionReplayDataIngestMeteredPlan.hasPriceId()).toBe(true);
903
906
  });
907
+
908
+ /*
909
+ * Security Events shipped its ingest, metering and staging without a
910
+ * Stripe price, so usage accrued in TelemetryUsageBilling and was never
911
+ * invoiced - silently, because the callers treat a missing price as
912
+ * "skip this plan". Enumerate the enum rather than listing types by
913
+ * hand so the next pillar added cannot repeat that.
914
+ */
915
+ it("should have a Stripe price for every ProductType", () => {
916
+ const unpriced: Array<ProductType> = Object.values(ProductType).filter(
917
+ (productType: ProductType) => {
918
+ return !service.hasMeteredPlanPriceId(productType);
919
+ },
920
+ );
921
+
922
+ expect(unpriced).toEqual([]);
923
+ });
904
924
  });
905
925
 
906
926
  describe("isPromoCodeValid", () => {