@bash-app/bash-common 30.230.0 → 30.232.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/__tests__/userReportTypes.test.d.ts +2 -0
- package/dist/__tests__/userReportTypes.test.d.ts.map +1 -0
- package/dist/__tests__/userReportTypes.test.js +81 -0
- package/dist/__tests__/userReportTypes.test.js.map +1 -0
- package/dist/bashFeedTypes.d.ts +10 -0
- package/dist/bashFeedTypes.d.ts.map +1 -1
- package/dist/definitions.d.ts +10 -0
- package/dist/definitions.d.ts.map +1 -1
- package/dist/definitions.js +8 -0
- package/dist/definitions.js.map +1 -1
- package/dist/extendedSchemas.d.ts +18 -1
- package/dist/extendedSchemas.d.ts.map +1 -1
- package/dist/extendedSchemas.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/userReportTypes.d.ts +117 -0
- package/dist/userReportTypes.d.ts.map +1 -0
- package/dist/userReportTypes.js +99 -0
- package/dist/userReportTypes.js.map +1 -0
- package/dist/utils/__tests__/getBackendHost.test.js +21 -1
- package/dist/utils/__tests__/getBackendHost.test.js.map +1 -1
- package/dist/utils/__tests__/getFrontendHost.native.test.d.ts +14 -0
- package/dist/utils/__tests__/getFrontendHost.native.test.d.ts.map +1 -0
- package/dist/utils/__tests__/getFrontendHost.native.test.js +51 -0
- package/dist/utils/__tests__/getFrontendHost.native.test.js.map +1 -0
- package/dist/utils/slugUtils.d.ts +4 -0
- package/dist/utils/slugUtils.d.ts.map +1 -1
- package/dist/utils/slugUtils.js +9 -1
- package/dist/utils/slugUtils.js.map +1 -1
- package/dist/utils/urlUtils.d.ts.map +1 -1
- package/dist/utils/urlUtils.js +7 -0
- package/dist/utils/urlUtils.js.map +1 -1
- package/package.json +3 -1
- package/prisma/schema.prisma +23 -0
- package/src/__tests__/userReportTypes.test.ts +103 -0
- package/src/bashFeedTypes.ts +13 -1
- package/src/definitions.ts +13 -0
- package/src/extendedSchemas.ts +23 -0
- package/src/index.ts +1 -0
- package/src/userReportTypes.ts +252 -0
- package/src/utils/__tests__/getBackendHost.test.ts +28 -1
- package/src/utils/__tests__/getFrontendHost.native.test.ts +75 -0
- package/src/utils/slugUtils.ts +24 -1
- package/src/utils/urlUtils.ts +9 -0
package/src/utils/slugUtils.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import slugify from 'slugify';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
BASH_DETAIL_URL,
|
|
4
|
+
BASH_EVENT_WIZARD_HOW_MAJOR_STEP,
|
|
5
|
+
BASH_EVENT_WIZARD_HOW_SUBSTEP_PAYOUT,
|
|
6
|
+
BASH_EVENT_WIZARD_PATH_PREFIX,
|
|
7
|
+
} from '../definitions.js';
|
|
3
8
|
|
|
4
9
|
export function generateSlug(title: string): string {
|
|
5
10
|
return slugify(title, {
|
|
@@ -47,6 +52,24 @@ export function getPublicBashDetailPath(
|
|
|
47
52
|
return `${BASH_DETAIL_URL}/${bashEventId}`;
|
|
48
53
|
}
|
|
49
54
|
|
|
55
|
+
/** Wizard URL with explicit step (see bash-app `/bash-event-wizard/$id/$major/$sub`). */
|
|
56
|
+
export function getBashEventWizardStepPath(
|
|
57
|
+
bashEventId: string,
|
|
58
|
+
majorStep: number,
|
|
59
|
+
subStep: number
|
|
60
|
+
): string {
|
|
61
|
+
return `${BASH_EVENT_WIZARD_PATH_PREFIX}/${bashEventId}/${majorStep}/${subStep}`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Host redirect target: "How" → Payout (Stripe Connect / ticket proceeds). */
|
|
65
|
+
export function getBashEventWizardPayoutStepPath(bashEventId: string): string {
|
|
66
|
+
return getBashEventWizardStepPath(
|
|
67
|
+
bashEventId,
|
|
68
|
+
BASH_EVENT_WIZARD_HOW_MAJOR_STEP,
|
|
69
|
+
BASH_EVENT_WIZARD_HOW_SUBSTEP_PAYOUT
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
50
73
|
export function parseBashUrlParams(param: string): { id: string; slug: string | null } | null {
|
|
51
74
|
// Expected format: "id-slug" where id is first part before first dash
|
|
52
75
|
const dashIndex = param.indexOf('-');
|
package/src/utils/urlUtils.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { BASH_DETAIL_URL, STRIPE_CHECKOUT_TIMEOUT_MS, STRIPE_REDIRECT_TIMEOUT_MS
|
|
|
2
2
|
import { generateBashDetailUrl } from "./slugUtils.js";
|
|
3
3
|
|
|
4
4
|
const API_HOST = process.env.REACT_APP_API ?? "http://localhost:3500";
|
|
5
|
+
const DEFAULT_PUBLIC_FRONTEND_HOST = "https://bash.community";
|
|
5
6
|
|
|
6
7
|
/** True when running inside Capacitor iOS/Android (WebView hostname is still `localhost`). */
|
|
7
8
|
function isCapacitorNativePlatform(): boolean {
|
|
@@ -39,6 +40,14 @@ export function getFrontendHost(): string {
|
|
|
39
40
|
if (typeof window === "undefined") {
|
|
40
41
|
return "";
|
|
41
42
|
}
|
|
43
|
+
|
|
44
|
+
// Capacitor's WebView presents a localhost-like origin. Public URLs generated
|
|
45
|
+
// from native builds must still point at the real web host for sharing,
|
|
46
|
+
// Stripe redirects, QR codes, and reviewer deep-link tests.
|
|
47
|
+
if (isCapacitorNativePlatform()) {
|
|
48
|
+
return process.env.REACT_APP_FRONTEND_URL ?? DEFAULT_PUBLIC_FRONTEND_HOST;
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
const { protocol, hostname, host, port } = window.location;
|
|
43
52
|
if (isLocalDevHostname(hostname)) {
|
|
44
53
|
return `${protocol}//${hostname}:${port || "3000"}`;
|