Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,9 @@
|
||||
import { PortalDto } from "../dtos/PortalDto";
|
||||
|
||||
function getUrl(item: PortalDto, path: string) {
|
||||
return `${item.url}${path}`;
|
||||
}
|
||||
|
||||
export default {
|
||||
getUrl,
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
const stripeConnectCountries = [
|
||||
{ value: "AU", name: "Australia" },
|
||||
{ value: "LV", name: "Latvia" },
|
||||
{ value: "AT", name: "Austria" },
|
||||
{ value: "LT", name: "Lithuania" },
|
||||
{ value: "BE", name: "Belgium" },
|
||||
{ value: "LU", name: "Luxembourg" },
|
||||
{ value: "MY", name: "Malaysia" },
|
||||
{ value: "BG", name: "Bulgaria" },
|
||||
{ value: "BR", name: "Brazil" },
|
||||
{ value: "MT", name: "Malta" },
|
||||
{ value: "CA", name: "Canada" },
|
||||
{ value: "MX", name: "Mexico" },
|
||||
{ value: "CY", name: "Cyprus" },
|
||||
{ value: "NL", name: "Netherlands" },
|
||||
{ value: "CZ", name: "Czech Republic" },
|
||||
{ value: "NZ", name: "New Zealand" },
|
||||
{ value: "DK", name: "Denmark" },
|
||||
{ value: "NO", name: "Norway" },
|
||||
{ value: "EE", name: "Estonia" },
|
||||
{ value: "PL", name: "Poland" },
|
||||
{ value: "FI", name: "Finland" },
|
||||
{ value: "PT", name: "Portugal" },
|
||||
{ value: "FR", name: "France" },
|
||||
{ value: "RO", name: "Romania" },
|
||||
{ value: "DE", name: "Germany" },
|
||||
{ value: "SG", name: "Singapore" },
|
||||
{ value: "GR", name: "Greece" },
|
||||
{ value: "SK", name: "Slovakia" },
|
||||
{ value: "HK", name: "Hong Kong" },
|
||||
{ value: "SI", name: "Slovenia" },
|
||||
{ value: "HU", name: "Hungary" },
|
||||
{ value: "ES", name: "Spain" },
|
||||
{ value: "SE", name: "Sweden" },
|
||||
{ value: "IN", name: "India" },
|
||||
{ value: "IE", name: "Ireland" },
|
||||
{ value: "CH", name: "Switzerland" },
|
||||
{ value: "IT", name: "Italy" },
|
||||
{ value: "GB", name: "United Kingdom" },
|
||||
{ value: "JP", name: "Japan" },
|
||||
{ value: "US", name: "United States" },
|
||||
{ value: "AE", name: "United Arab Emirates" },
|
||||
];
|
||||
|
||||
function getLocalizedStripeConnectCountries(locale: string | undefined) {
|
||||
const displayNames = typeof Intl.DisplayNames === "function" ? new Intl.DisplayNames([locale || "en"], { type: "region" }) : null;
|
||||
return stripeConnectCountries.map((country) => ({
|
||||
...country,
|
||||
name: displayNames?.of(country.value) ?? country.name,
|
||||
}));
|
||||
}
|
||||
|
||||
export default {
|
||||
stripeConnectCountries,
|
||||
getLocalizedStripeConnectCountries,
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { redactAnalyticsCookie, redactAnalyticsUrl } from "./analytics-redaction";
|
||||
|
||||
describe("analytics redaction", () => {
|
||||
it("removes query strings from absolute and relative URLs", () => {
|
||||
expect(redactAnalyticsUrl("https://example.com/path?token=secret&email=a@example.com#section")).toBe("https://example.com/path#section");
|
||||
expect(redactAnalyticsUrl("/checkout?session_id=secret")).toBe("/checkout");
|
||||
});
|
||||
|
||||
it("does not expose raw visitor cookies", () => {
|
||||
expect(redactAnalyticsCookie("abcdef123456")).toBe("abcde...");
|
||||
expect(redactAnalyticsCookie("abc")).toBe("[redacted]");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
export function redactAnalyticsUrl(value: string | null): string | null {
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
try {
|
||||
const url = new URL(value);
|
||||
return `${url.origin}${url.pathname}${url.hash}`;
|
||||
} catch {
|
||||
try {
|
||||
const url = new URL(value, "https://redaction.local");
|
||||
return `${url.pathname}${url.hash}`;
|
||||
} catch {
|
||||
return value.split("?")[0] ?? value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function redactAnalyticsCookie(value: string): string {
|
||||
return value.length <= 5 ? "[redacted]" : `${value.slice(0, 5)}...`;
|
||||
}
|
||||
Reference in new issue
Block a user