@bash-app/bash-common 30.95.0 → 30.97.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/definitions.d.ts +3 -36
- package/dist/definitions.d.ts.map +1 -1
- package/dist/definitions.js +1 -45
- package/dist/definitions.js.map +1 -1
- package/dist/extendedSchemas.d.ts +82 -1
- package/dist/extendedSchemas.d.ts.map +1 -1
- package/dist/extendedSchemas.js +11 -0
- 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/membershipDefinitions.d.ts +138 -0
- package/dist/membershipDefinitions.d.ts.map +1 -1
- package/dist/membershipDefinitions.js +416 -0
- package/dist/membershipDefinitions.js.map +1 -1
- package/dist/utils/bashCashPaymentUtils.d.ts +72 -0
- package/dist/utils/bashCashPaymentUtils.d.ts.map +1 -0
- package/dist/utils/bashCashPaymentUtils.js +115 -0
- package/dist/utils/bashCashPaymentUtils.js.map +1 -0
- package/dist/utils/paymentUtils.d.ts +6 -2
- package/dist/utils/paymentUtils.d.ts.map +1 -1
- package/dist/utils/paymentUtils.js +27 -86
- package/dist/utils/paymentUtils.js.map +1 -1
- package/dist/utils/service/apiServiceBookingApiUtils.d.ts.map +1 -1
- package/dist/utils/service/apiServiceBookingApiUtils.js +1 -0
- package/dist/utils/service/apiServiceBookingApiUtils.js.map +1 -1
- package/dist/utils/service/frontendServiceBookingUtils.d.ts +2 -1
- package/dist/utils/service/frontendServiceBookingUtils.d.ts.map +1 -1
- package/dist/utils/service/frontendServiceBookingUtils.js +4 -3
- package/dist/utils/service/frontendServiceBookingUtils.js.map +1 -1
- package/package.json +1 -1
- package/prisma/schema.prisma +44 -5
- package/src/definitions.ts +3 -54
- package/src/extendedSchemas.ts +18 -0
- package/src/index.ts +1 -0
- package/src/membershipDefinitions.ts +549 -0
- package/src/utils/bashCashPaymentUtils.ts +146 -0
- package/src/utils/paymentUtils.ts +34 -124
- package/src/utils/service/apiServiceBookingApiUtils.ts +1 -0
- package/src/utils/service/frontendServiceBookingUtils.ts +5 -3
package/prisma/schema.prisma
CHANGED
|
@@ -77,18 +77,51 @@ model CompetitionSponsor {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
model EventTask {
|
|
80
|
-
id String
|
|
80
|
+
id String @id @default(cuid())
|
|
81
81
|
creatorId String
|
|
82
82
|
bashEventId String
|
|
83
83
|
title String
|
|
84
84
|
description String?
|
|
85
85
|
assignedToId String?
|
|
86
86
|
status TaskStatus?
|
|
87
|
-
createdAt DateTime?
|
|
88
|
-
assignedTo User?
|
|
89
|
-
bashEvent BashEvent
|
|
90
|
-
creator User
|
|
87
|
+
createdAt DateTime? @default(now())
|
|
88
|
+
assignedTo User? @relation("TasksAssignedToMe", fields: [assignedToId], references: [id], onDelete: Cascade)
|
|
89
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
90
|
+
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
91
91
|
notificationsReferencingMe Notification[]
|
|
92
|
+
comments TaskComment[]
|
|
93
|
+
invitations TaskInvitation[]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
model TaskComment {
|
|
97
|
+
id String @id @default(cuid())
|
|
98
|
+
taskId String
|
|
99
|
+
authorId String
|
|
100
|
+
content String @db.Text
|
|
101
|
+
createdAt DateTime @default(now())
|
|
102
|
+
task EventTask @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
|
103
|
+
author User @relation("TaskCommentsAuthored", fields: [authorId], references: [id], onDelete: Cascade)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
model TaskInvitation {
|
|
107
|
+
id String @id @default(cuid())
|
|
108
|
+
taskId String
|
|
109
|
+
invitedEmail String
|
|
110
|
+
token String @unique @default(cuid()) // CUID for security
|
|
111
|
+
invitedName String? // Optional name hint from host
|
|
112
|
+
personalMessage String? // Optional message from host
|
|
113
|
+
createdAt DateTime @default(now())
|
|
114
|
+
expiresAt DateTime // Event date + 1 day
|
|
115
|
+
acceptedAt DateTime?
|
|
116
|
+
acceptedById String? // User who accepted (might be newly created)
|
|
117
|
+
createdById String // Host who sent invitation
|
|
118
|
+
task EventTask @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
|
119
|
+
acceptedBy User? @relation("TaskInvitationsAccepted", fields: [acceptedById], references: [id], onDelete: SetNull)
|
|
120
|
+
createdBy User @relation("TaskInvitationsSent", fields: [createdById], references: [id], onDelete: Cascade)
|
|
121
|
+
|
|
122
|
+
@@index([token])
|
|
123
|
+
@@index([invitedEmail])
|
|
124
|
+
@@index([taskId])
|
|
92
125
|
}
|
|
93
126
|
|
|
94
127
|
model Reminder {
|
|
@@ -902,6 +935,9 @@ model User {
|
|
|
902
935
|
documentID DocumentID?
|
|
903
936
|
eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
|
|
904
937
|
eventTasks EventTask[]
|
|
938
|
+
taskCommentsAuthored TaskComment[] @relation("TaskCommentsAuthored")
|
|
939
|
+
taskInvitationsSent TaskInvitation[] @relation("TaskInvitationsSent")
|
|
940
|
+
taskInvitationsAccepted TaskInvitation[] @relation("TaskInvitationsAccepted")
|
|
905
941
|
exhibitorBookingRequestsAsHost ExhibitorBookingRequest[] @relation("ExhibitorBookingHost")
|
|
906
942
|
investments Investment[]
|
|
907
943
|
invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
|
|
@@ -1303,6 +1339,7 @@ model Service {
|
|
|
1303
1339
|
isFreeFirstListing Boolean @default(false)
|
|
1304
1340
|
monthlyPrice Decimal @default(0)
|
|
1305
1341
|
serviceListingStripeSubscriptionId String?
|
|
1342
|
+
acceptsBashCash Boolean @default(true) // NEW: Allow BashCash payments
|
|
1306
1343
|
associatedServicesReferencingMe AssociatedService[]
|
|
1307
1344
|
exhibitorBookingRequests ExhibitorBookingRequest[] @relation("ExhibitorBookingService")
|
|
1308
1345
|
notification Notification[]
|
|
@@ -1848,6 +1885,8 @@ model ServiceBooking {
|
|
|
1848
1885
|
isVendorBid Boolean @default(false)
|
|
1849
1886
|
vendorBidAmountCents Int?
|
|
1850
1887
|
vendorEventDetails String?
|
|
1888
|
+
bashCashApplied Int? // BashCash credits applied to this booking
|
|
1889
|
+
bashCashTransactionId String? // Link to BashCreditTransaction
|
|
1851
1890
|
notification Notification[]
|
|
1852
1891
|
bashEvent BashEvent? @relation(fields: [bashEventId], references: [id])
|
|
1853
1892
|
creator User @relation("BookingCreator", fields: [creatorId], references: [id])
|
package/src/definitions.ts
CHANGED
|
@@ -85,60 +85,6 @@ export const URL_PARAMS_TICKETS_DATE_DELIM = ";;" as const;
|
|
|
85
85
|
export const URL_INCLUDE_QUERY_PARAM_DELIM = "," as const;
|
|
86
86
|
export const URL_INCLUDE_PRISMA_DATA_KEYS_DELIM = "." as const;
|
|
87
87
|
|
|
88
|
-
// Platform fee structure
|
|
89
|
-
export const BASH_FEE_PERCENTAGE = 0.10; // 10% base platform fee for bash tickets/donations
|
|
90
|
-
export const SERVICE_FEE_PERCENTAGE = 0.15; // 15% platform fee for service bookings (Allies, Patrons)
|
|
91
|
-
export const PARTNER_FEE_PERCENTAGE = 0.08; // 8% platform fee for Partner payments (Vendors, Exhibitors, Sponsors)
|
|
92
|
-
|
|
93
|
-
// Minimum pricing (ensures quality events + sustainable model)
|
|
94
|
-
export const BASH_EVENT_TICKET_MINIMUM = 5.00; // $5 minimum ticket price (quality signal, prevents race to bottom)
|
|
95
|
-
export const BASH_EVENT_FEE_MINIMUM = 0.50; // $0.50 minimum platform fee (prevents gaming, covers Stripe fees)
|
|
96
|
-
|
|
97
|
-
// Free trial settings
|
|
98
|
-
export const CREATOR_TIER_TRIAL_DAYS = 30; // 30-day free trial for Creator tier (encourages conversions)
|
|
99
|
-
|
|
100
|
-
// Membership tier fee discounts (for bash tickets/donations)
|
|
101
|
-
// Note: BASH_EVENT_FEE_MINIMUM ($0.50) applies to all tiers, so effective minimums are higher on low-priced tickets
|
|
102
|
-
export const BASH_FEE_BASIC = 0.10; // 10% - Basic (free) members (min $0.50)
|
|
103
|
-
export const BASH_FEE_PRO = 0.08; // 8% - Pro members (20% discount, min $0.50)
|
|
104
|
-
export const BASH_FEE_CREATOR = 0.06; // 6% - Creator members (40% discount, min $0.50)
|
|
105
|
-
export const BASH_FEE_ELITE = 0.04; // 4% - Elite members (60% discount, min $0.50)
|
|
106
|
-
export const BASH_FEE_LEGEND = 0.02; // 2% - Legend members (80% discount, min $0.50 = 10% effective minimum on $5 tickets)
|
|
107
|
-
|
|
108
|
-
// Service fee discounts (for Allies/Patrons service bookings)
|
|
109
|
-
export const SERVICE_FEE_BASIC = 0.15; // 15% - Basic (free) members
|
|
110
|
-
export const SERVICE_FEE_PRO = 0.12; // 12% - Pro members (20% discount)
|
|
111
|
-
export const SERVICE_FEE_CREATOR = 0.09; // 9% - Creator members (40% discount)
|
|
112
|
-
export const SERVICE_FEE_ELITE = 0.06; // 6% - Elite members (60% discount)
|
|
113
|
-
export const SERVICE_FEE_LEGEND = 0.05; // 5% - Legend members (67% discount, sustainable floor)
|
|
114
|
-
|
|
115
|
-
// Partner fee discounts (for Vendors/Exhibitors/Sponsors payments)
|
|
116
|
-
export const PARTNER_FEE_BASIC = 0.08; // 8% - Basic (free) members
|
|
117
|
-
export const PARTNER_FEE_PRO = 0.06; // 6% - Pro members (25% discount)
|
|
118
|
-
export const PARTNER_FEE_CREATOR = 0.05; // 5% - Creator members (37.5% discount, sustainable floor)
|
|
119
|
-
export const PARTNER_FEE_ELITE = 0.05; // 5% - Elite members (same as Creator, sustainable floor)
|
|
120
|
-
export const PARTNER_FEE_LEGEND = 0.05; // 5% - Legend members (same as Creator/Elite, sustainable floor)
|
|
121
|
-
|
|
122
|
-
// Platform fee caps by membership tier (in cents)
|
|
123
|
-
export const BASH_FEE_CAP_BASIC = 25000; // $250 cap for Basic
|
|
124
|
-
export const BASH_FEE_CAP_PRO = 20000; // $200 cap for Pro
|
|
125
|
-
export const BASH_FEE_CAP_CREATOR = 15000; // $150 cap for Creator
|
|
126
|
-
export const BASH_FEE_CAP_ELITE = 10000; // $100 cap for Elite
|
|
127
|
-
export const BASH_FEE_CAP_LEGEND = 5000; // $50 cap for Legend
|
|
128
|
-
|
|
129
|
-
export const SERVICE_FEE_CAP_BASIC = 37500; // $375 cap for Basic
|
|
130
|
-
export const SERVICE_FEE_CAP_PRO = 30000; // $300 cap for Pro
|
|
131
|
-
export const SERVICE_FEE_CAP_CREATOR = 22500; // $225 cap for Creator
|
|
132
|
-
export const SERVICE_FEE_CAP_ELITE = 15000; // $150 cap for Elite
|
|
133
|
-
export const SERVICE_FEE_CAP_LEGEND = 7500; // $75 cap for Legend
|
|
134
|
-
|
|
135
|
-
// Partner payment fee caps (Partners pay less since they bring value to hosts)
|
|
136
|
-
export const PARTNER_FEE_CAP_BASIC = 20000; // $200 cap for Basic (8%)
|
|
137
|
-
export const PARTNER_FEE_CAP_PRO = 15000; // $150 cap for Pro (6%)
|
|
138
|
-
export const PARTNER_FEE_CAP_CREATOR = 12500; // $125 cap for Creator (5%)
|
|
139
|
-
export const PARTNER_FEE_CAP_ELITE = 7500; // $75 cap for Elite (3%)
|
|
140
|
-
export const PARTNER_FEE_CAP_LEGEND = 7500; // $75 cap for Legend (3%)
|
|
141
|
-
|
|
142
88
|
// ============================================
|
|
143
89
|
// SERVICE SUBSCRIPTION TIERS
|
|
144
90
|
// ============================================
|
|
@@ -346,6 +292,7 @@ export const MONTHS_PREVIOUS_THAT_STRIPE_ACCOUNTS_WILL_BE_SEARCHED_BY_EMAIL =
|
|
|
346
292
|
1 as const;
|
|
347
293
|
|
|
348
294
|
export const HTTP_CODE_OK = 200 as const;
|
|
295
|
+
export const HTTP_CODE_CREATED = 201 as const;
|
|
349
296
|
export const HTTP_CODE_TEMPORARY_REDIRECT = 307 as const;
|
|
350
297
|
export const HTTP_CODE_INTERNAL_SERVER_ERR = 500 as const;
|
|
351
298
|
export const HTTP_CODE_BAD_REQUEST = 400 as const;
|
|
@@ -646,6 +593,8 @@ export interface ApiResult<T, P extends ErrorDataType = ErrorDataType> {
|
|
|
646
593
|
errorType?: ApiErrorType;
|
|
647
594
|
errorData?: P;
|
|
648
595
|
rawResponse?: any;
|
|
596
|
+
requiresPayment?: boolean; // For service listing payment flow
|
|
597
|
+
serviceId?: string; // For service listing payment flow
|
|
649
598
|
}
|
|
650
599
|
|
|
651
600
|
export function removeDataFromResult<
|
package/src/extendedSchemas.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
Review,
|
|
29
29
|
Service,
|
|
30
30
|
ServiceAddon,
|
|
31
|
+
TaskComment,
|
|
31
32
|
ServiceBooking,
|
|
32
33
|
ServiceBookingAddOn,
|
|
33
34
|
ServiceBookingCheckout,
|
|
@@ -741,9 +742,20 @@ export const BASH_NOTIFICATION_DATA_TO_INCLUDE = {
|
|
|
741
742
|
},
|
|
742
743
|
} satisfies Prisma.NotificationInclude;
|
|
743
744
|
|
|
745
|
+
export interface TaskCommentExt extends TaskComment {
|
|
746
|
+
author: PublicUser;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
export const TASK_COMMENT_DATA_TO_INCLUDE = {
|
|
750
|
+
author: {
|
|
751
|
+
select: FRONT_END_USER_DATA_TO_SELECT,
|
|
752
|
+
},
|
|
753
|
+
} satisfies Prisma.TaskCommentInclude;
|
|
754
|
+
|
|
744
755
|
export interface EventTaskExt extends EventTask {
|
|
745
756
|
creator: PublicUser;
|
|
746
757
|
assignedTo?: PublicUser | null;
|
|
758
|
+
comments?: TaskCommentExt[];
|
|
747
759
|
}
|
|
748
760
|
|
|
749
761
|
export const EVENT_TASK_DATA_TO_INCLUDE = {
|
|
@@ -753,6 +765,12 @@ export const EVENT_TASK_DATA_TO_INCLUDE = {
|
|
|
753
765
|
assignedTo: {
|
|
754
766
|
select: FRONT_END_USER_DATA_TO_SELECT,
|
|
755
767
|
},
|
|
768
|
+
comments: {
|
|
769
|
+
include: TASK_COMMENT_DATA_TO_INCLUDE,
|
|
770
|
+
orderBy: {
|
|
771
|
+
createdAt: 'desc' as const,
|
|
772
|
+
},
|
|
773
|
+
},
|
|
756
774
|
} satisfies Prisma.EventTaskInclude;
|
|
757
775
|
|
|
758
776
|
export interface InvitationExt extends Invitation {
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./utils/addressUtils";
|
|
|
5
5
|
export * from "./utils/apiUtils";
|
|
6
6
|
export * from "./utils/arrayUtils";
|
|
7
7
|
export * from "./utils/awsS3Utils";
|
|
8
|
+
export * from "./utils/bashCashPaymentUtils";
|
|
8
9
|
export * from "./utils/contentFilterUtils";
|
|
9
10
|
export * from "./utils/dateTimeUtils";
|
|
10
11
|
export * from "./utils/objUtils";
|