@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.
Files changed (46) hide show
  1. package/dist/__tests__/userReportTypes.test.d.ts +2 -0
  2. package/dist/__tests__/userReportTypes.test.d.ts.map +1 -0
  3. package/dist/__tests__/userReportTypes.test.js +81 -0
  4. package/dist/__tests__/userReportTypes.test.js.map +1 -0
  5. package/dist/bashFeedTypes.d.ts +10 -0
  6. package/dist/bashFeedTypes.d.ts.map +1 -1
  7. package/dist/definitions.d.ts +10 -0
  8. package/dist/definitions.d.ts.map +1 -1
  9. package/dist/definitions.js +8 -0
  10. package/dist/definitions.js.map +1 -1
  11. package/dist/extendedSchemas.d.ts +18 -1
  12. package/dist/extendedSchemas.d.ts.map +1 -1
  13. package/dist/extendedSchemas.js.map +1 -1
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +1 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/userReportTypes.d.ts +117 -0
  19. package/dist/userReportTypes.d.ts.map +1 -0
  20. package/dist/userReportTypes.js +99 -0
  21. package/dist/userReportTypes.js.map +1 -0
  22. package/dist/utils/__tests__/getBackendHost.test.js +21 -1
  23. package/dist/utils/__tests__/getBackendHost.test.js.map +1 -1
  24. package/dist/utils/__tests__/getFrontendHost.native.test.d.ts +14 -0
  25. package/dist/utils/__tests__/getFrontendHost.native.test.d.ts.map +1 -0
  26. package/dist/utils/__tests__/getFrontendHost.native.test.js +51 -0
  27. package/dist/utils/__tests__/getFrontendHost.native.test.js.map +1 -0
  28. package/dist/utils/slugUtils.d.ts +4 -0
  29. package/dist/utils/slugUtils.d.ts.map +1 -1
  30. package/dist/utils/slugUtils.js +9 -1
  31. package/dist/utils/slugUtils.js.map +1 -1
  32. package/dist/utils/urlUtils.d.ts.map +1 -1
  33. package/dist/utils/urlUtils.js +7 -0
  34. package/dist/utils/urlUtils.js.map +1 -1
  35. package/package.json +3 -1
  36. package/prisma/schema.prisma +23 -0
  37. package/src/__tests__/userReportTypes.test.ts +103 -0
  38. package/src/bashFeedTypes.ts +13 -1
  39. package/src/definitions.ts +13 -0
  40. package/src/extendedSchemas.ts +23 -0
  41. package/src/index.ts +1 -0
  42. package/src/userReportTypes.ts +252 -0
  43. package/src/utils/__tests__/getBackendHost.test.ts +28 -1
  44. package/src/utils/__tests__/getFrontendHost.native.test.ts +75 -0
  45. package/src/utils/slugUtils.ts +24 -1
  46. package/src/utils/urlUtils.ts +9 -0
@@ -1,5 +1,10 @@
1
1
  import slugify from 'slugify';
2
- import { BASH_DETAIL_URL } from '../definitions.js';
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('-');
@@ -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"}`;