@bash-app/bash-common 29.64.0 → 29.66.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bash-app/bash-common",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.66.0",
|
|
4
4
|
"description": "Common data and scripts to use on the frontend and backend",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@types/shelljs": "^0.8.15",
|
|
41
41
|
"jest": "^29.7.0",
|
|
42
42
|
"shelljs": "^0.8.5",
|
|
43
|
+
"stripe": "^16.12.0",
|
|
43
44
|
"ts-jest": "^29.1.1",
|
|
44
45
|
"ts-node": "^10.9.1",
|
|
45
46
|
"tslib": "^2.6.2",
|
package/prisma/schema.prisma
CHANGED
|
@@ -191,8 +191,7 @@ model BashEvent {
|
|
|
191
191
|
title String
|
|
192
192
|
creatorId String
|
|
193
193
|
creator User @relation("CreatedEvent", fields: [creatorId], references: [id], onDelete: Cascade)
|
|
194
|
-
|
|
195
|
-
isApproved Boolean? @default(false)
|
|
194
|
+
isApproved Boolean?
|
|
196
195
|
description String?
|
|
197
196
|
eventType String @default("Other")
|
|
198
197
|
startDateTime DateTime? @default(now())
|
|
@@ -245,6 +244,7 @@ model BashEvent {
|
|
|
245
244
|
venue Venue? @relation(fields: [venueId], references: [id])
|
|
246
245
|
userPromoCodeRedemption UserPromoCodeRedemption[]
|
|
247
246
|
averageRating Float? @default(0)
|
|
247
|
+
createdAt DateTime @default(now()) // Timestamp for when the review was created
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
model Coordinates {
|
|
@@ -614,9 +614,9 @@ enum Education {
|
|
|
614
614
|
|
|
615
615
|
enum BashStatus {
|
|
616
616
|
Draft
|
|
617
|
-
Pending
|
|
618
617
|
PreSale
|
|
619
618
|
Published
|
|
619
|
+
Pending
|
|
620
620
|
Finished
|
|
621
621
|
}
|
|
622
622
|
|
|
@@ -630,6 +630,7 @@ enum ServiceCondition {
|
|
|
630
630
|
Published
|
|
631
631
|
Suspended
|
|
632
632
|
Deactivated
|
|
633
|
+
Unpublished
|
|
633
634
|
}
|
|
634
635
|
|
|
635
636
|
enum ServiceSubscriptionStatus {
|
package/src/definitions.ts
CHANGED
|
@@ -113,6 +113,14 @@ export const URL_PARAMS_SETUP_PAYMENT_OPTIONS = {
|
|
|
113
113
|
export type UrlParamsSetupPayment =
|
|
114
114
|
(typeof URL_PARAMS_SETUP_PAYMENT_OPTIONS)[keyof typeof URL_PARAMS_SETUP_PAYMENT_OPTIONS];
|
|
115
115
|
|
|
116
|
+
export const URL_PARAMS_SETUP_STAGE = "setupStage" as const;
|
|
117
|
+
export const URL_PARAMS_SETUP_STAGE_OPTIONS = {
|
|
118
|
+
paymentMethod: "payment-method",
|
|
119
|
+
complete: "complete",
|
|
120
|
+
} as const;
|
|
121
|
+
export type UrlParamsSetupStage =
|
|
122
|
+
(typeof URL_PARAMS_SETUP_STAGE_OPTIONS)[keyof typeof URL_PARAMS_SETUP_STAGE_OPTIONS];
|
|
123
|
+
|
|
116
124
|
export const URL_PARAMS_TICKET_LIST_DELIM = "," as const;
|
|
117
125
|
export const URL_PARAMS_TICKET_TIER_ID_NUMBER_OF_TICKETS_DATE_DELIM =
|
|
118
126
|
"__" as const;
|
|
@@ -349,6 +357,7 @@ export interface StripePaymentMethod {
|
|
|
349
357
|
expMonth: number;
|
|
350
358
|
expYear: number;
|
|
351
359
|
country: string;
|
|
360
|
+
brand: string;
|
|
352
361
|
}
|
|
353
362
|
|
|
354
363
|
export interface StripeCreateBashEventTicketsCheckoutSessionArgs {
|
|
@@ -372,6 +381,18 @@ export interface StripeCreateSetupPaymentMethodSessionArgs {
|
|
|
372
381
|
cancelUrl: string;
|
|
373
382
|
}
|
|
374
383
|
|
|
384
|
+
export interface StripeSetDefaultPaymentMethodArgs {
|
|
385
|
+
paymentMethodId: string;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export interface StripeAddPaymentMethodArgs {
|
|
389
|
+
paymentMethodId: string;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export interface StripeDeletePaymentMethodArgs {
|
|
393
|
+
paymentMethodId: string;
|
|
394
|
+
}
|
|
395
|
+
|
|
375
396
|
export interface StripeCreateAccountPortalSessionArgs {
|
|
376
397
|
stripeAccountId: string;
|
|
377
398
|
returnUrl: string;
|
|
@@ -435,10 +456,12 @@ export type StripeBusinessDataOwned = {
|
|
|
435
456
|
stripeAccountDBId: string;
|
|
436
457
|
|
|
437
458
|
bankAccount?: string;
|
|
438
|
-
linkingStatus
|
|
459
|
+
linkingStatus?: StripeLinkingStatus;
|
|
439
460
|
|
|
440
461
|
createdDate: string;
|
|
441
462
|
updatedDate: string;
|
|
463
|
+
|
|
464
|
+
paymentMethods: StripePaymentMethod[];
|
|
442
465
|
} & StripeBusinessDataPublic;
|
|
443
466
|
|
|
444
467
|
export interface StripeConfirmPayment {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// import { DayOfWeek } from "@prisma/client";
|
|
2
|
+
// import { DateTime, Interval } from "luxon";
|
|
3
|
+
// import { DayOfWeekIdx, DayOfWeekToIdx } from "../definitions";
|
|
4
|
+
|
|
5
|
+
// export function dayOfWeekToIdx(dayOfWeek: DayOfWeek | DayOfWeekIdx): number {
|
|
6
|
+
// if (typeof dayOfWeek === "number") {
|
|
7
|
+
// return dayOfWeek;
|
|
8
|
+
// } else if (typeof dayOfWeek === "string") {
|
|
9
|
+
// return DayOfWeekToIdx[dayOfWeek];
|
|
10
|
+
// } else {
|
|
11
|
+
// throw new Error(`dayOfWeekToIdx: unhandled case`);
|
|
12
|
+
// }
|
|
13
|
+
// }
|
|
14
|
+
|
|
15
|
+
// export function dateTimeFromDayTime(
|
|
16
|
+
// dayOfWeek: DayOfWeek | DayOfWeekIdx,
|
|
17
|
+
// hour: number = 0,
|
|
18
|
+
// minute: number = 0
|
|
19
|
+
// ): DateTime {
|
|
20
|
+
// //use date where first day of month is a known sunday
|
|
21
|
+
// return DateTime.fromObject({
|
|
22
|
+
// year: 2020,
|
|
23
|
+
// month: 1,
|
|
24
|
+
// day: dayOfWeekToIdx(dayOfWeek),
|
|
25
|
+
// hour: hour,
|
|
26
|
+
// minute: minute,
|
|
27
|
+
// });
|
|
28
|
+
// }
|
|
29
|
+
|
|
30
|
+
// export type DateTimeTime = Pick<DateTime, "hour" | "minute">;
|
|
31
|
+
// export type DateTimeDate = Pick<DateTime, "year" | "month" | "day">;
|
|
32
|
+
|
|
33
|
+
// export function dateTimeToTimeComponents(dateTime: DateTime): DateTimeTime {
|
|
34
|
+
// return {
|
|
35
|
+
// hour: dateTime.hour,
|
|
36
|
+
// minute: dateTime.minute,
|
|
37
|
+
// };
|
|
38
|
+
// }
|
|
39
|
+
|
|
40
|
+
// export function dateTimeToDateComponents(dateTime: DateTime): DateTimeDate {
|
|
41
|
+
// return {
|
|
42
|
+
// year: dateTime.year,
|
|
43
|
+
// month: dateTime.month,
|
|
44
|
+
// day: dateTime.day,
|
|
45
|
+
// };
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
// export function objectHasDate(obj: object) {
|
|
49
|
+
// return "year" in obj;
|
|
50
|
+
// }
|
|
51
|
+
|
|
52
|
+
// export function objectHasTime(obj: object) {
|
|
53
|
+
// return "hour" in obj;
|
|
54
|
+
// }
|
|
55
|
+
|
|
56
|
+
// export function dateTimeSetTime(
|
|
57
|
+
// dateTime: DateTime,
|
|
58
|
+
// time: DateTimeTime | DateTime = { hour: 0, minute: 0 }
|
|
59
|
+
// ): DateTime {
|
|
60
|
+
// const timeComp = objectHasTime(time)
|
|
61
|
+
// ? dateTimeToTimeComponents(time as DateTime)
|
|
62
|
+
// : time;
|
|
63
|
+
// return dateTime.set(timeComp);
|
|
64
|
+
// }
|
|
65
|
+
|
|
66
|
+
// export function dateTimeSetDate(
|
|
67
|
+
// dateTime: DateTime,
|
|
68
|
+
// date: DateTimeDate | DateTime = { year: 2020, month: 1, day: 1 }
|
|
69
|
+
// ): DateTime {
|
|
70
|
+
// const dateComp = objectHasDate(date)
|
|
71
|
+
// ? dateTimeToTimeComponents(date as DateTime)
|
|
72
|
+
// : date;
|
|
73
|
+
// return dateTime.set(dateComp);
|
|
74
|
+
// }
|
|
75
|
+
|
|
76
|
+
// export function dateTimeLocalFromUTCDate(date: Date) {
|
|
77
|
+
// return DateTime.fromJSDate(date).toLocal();
|
|
78
|
+
// }
|
|
79
|
+
|
|
80
|
+
// export function dateTimeLocalToUTCDate(dateTime: DateTime) {
|
|
81
|
+
// return dateTime.toUTC().toJSDate();
|
|
82
|
+
// }
|
|
83
|
+
|
|
84
|
+
// export function dateTimeFormatTime(dateTime: DateTime) {
|
|
85
|
+
// return dateTime.toFormat("HH:MM");
|
|
86
|
+
// }
|
|
@@ -125,7 +125,12 @@ Object.keys(SERVICE_CANCELATION_POLICY_DATA)
|
|
|
125
125
|
export function serviceSubscriptionIsActive(
|
|
126
126
|
status: ServiceSubscriptionStatus
|
|
127
127
|
): boolean {
|
|
128
|
-
return
|
|
128
|
+
return (
|
|
129
|
+
[
|
|
130
|
+
ServiceSubscriptionStatus.Normal,
|
|
131
|
+
ServiceSubscriptionStatus.Trialing,
|
|
132
|
+
] as ServiceSubscriptionStatus[]
|
|
133
|
+
).includes(status);
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
export function serviceDetailUrl(
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { StripeLinkingStatus } from "../definitions";
|
|
2
2
|
import { isProduction } from "./apiUtils";
|
|
3
3
|
|
|
4
|
-
export const stripeAccountFullyLinked = (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
export const stripeAccountFullyLinked = (
|
|
5
|
+
linkingStatus: StripeLinkingStatus
|
|
6
|
+
): boolean => {
|
|
7
|
+
return (
|
|
8
|
+
!linkingStatus.hasOutstandingRequirements &&
|
|
9
|
+
linkingStatus.isOnboarded &&
|
|
10
|
+
linkingStatus.paymentsEnabled &&
|
|
11
|
+
(!isProduction() || linkingStatus.taxMonitoringEnabled)
|
|
12
|
+
);
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ValueOf<T> = T[keyof T];
|