@bash-app/bash-common 30.61.0 → 30.63.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.
@@ -63,7 +63,7 @@ export interface MembershipSubscriptionResult {
63
63
  clientSecret?: string;
64
64
  }
65
65
  export declare const MEMBERSHIP_PRICING: {
66
- Guest: {
66
+ Basic: {
67
67
  monthly: number;
68
68
  yearly: number;
69
69
  };
@@ -3,14 +3,14 @@ import { MembershipTier, ReferralTier, CreditTransactionType } from '@prisma/cli
3
3
  export { MembershipTier, ReferralTier, CreditTransactionType };
4
4
  // Pricing in cents (for Stripe)
5
5
  export const MEMBERSHIP_PRICING = {
6
- Guest: { monthly: 0, yearly: 0 },
6
+ Basic: { monthly: 0, yearly: 0 },
7
7
  Creator: { monthly: 2499, yearly: 20000 }, // $24.99/month, $200/year
8
8
  Pro: { monthly: 9900, yearly: 99900 }, // $99/month, $999/year
9
9
  Elite: { monthly: 49900, yearly: 500000 }, // $499/month, $5,000/year
10
10
  Legend: { monthly: 99900, yearly: 1000000 }, // $999/month, $10,000/year
11
11
  };
12
12
  export const MEMBERSHIP_TIER_HIERARCHY = [
13
- 'Guest', 'Creator', 'Pro', 'Elite', 'Legend'
13
+ 'Basic', 'Creator', 'Pro', 'Elite', 'Legend'
14
14
  ];
15
15
  export const MEMBERSHIP_FEATURES = {
16
16
  // Core Creator features
@@ -91,11 +91,11 @@ export function getRequiredTierForFeature(feature) {
91
91
  }
92
92
  // Complete tier definitions with features and pricing
93
93
  export const MEMBERSHIP_TIER_INFO = {
94
- Guest: {
95
- tier: 'Guest',
96
- name: 'Guest',
97
- monthlyPrice: MEMBERSHIP_PRICING.Guest.monthly,
98
- yearlyPrice: MEMBERSHIP_PRICING.Guest.yearly,
94
+ Basic: {
95
+ tier: 'Basic',
96
+ name: 'Basic',
97
+ monthlyPrice: MEMBERSHIP_PRICING.Basic.monthly,
98
+ yearlyPrice: MEMBERSHIP_PRICING.Basic.yearly,
99
99
  features: [
100
100
  'Browse and attend public events',
101
101
  'Host your own events with a $5 minimum ticket required',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash-app/bash-common",
3
- "version": "30.61.0",
3
+ "version": "30.63.0",
4
4
  "description": "Common data and scripts to use on the frontend and backend",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,36 @@
1
+ -- Rename/normalize MembershipTier values: Guest -> Basic
2
+ -- Idempotent: safe to run multiple times
3
+
4
+ -- Add Basic to MembershipTier (if not exists)
5
+ DO $
6
+ $
7
+ BEGIN
8
+ IF NOT EXISTS (
9
+ SELECT 1
10
+ FROM pg_enum
11
+ WHERE enumlabel = 'Basic'
12
+ AND enumtypid = (
13
+ SELECT oid
14
+ FROM pg_type
15
+ WHERE typname = 'MembershipTier'
16
+ )
17
+ ) THEN
18
+ ALTER TYPE "MembershipTier"
19
+ ADD VALUE 'Basic';
20
+ END
21
+ IF;
22
+ END $$;
23
+
24
+ -- Update existing Guest values to Basic
25
+ UPDATE "User"
26
+ SET "membershipTier" = 'Basic'
27
+ ::"MembershipTier"
28
+ WHERE "membershipTier" = 'Guest'::"MembershipTier";
29
+
30
+ -- Update default value
31
+ ALTER TABLE "User"
32
+ ALTER COLUMN "membershipTier"
33
+ SET
34
+ DEFAULT 'Basic'::"MembershipTier";
35
+
36
+
@@ -0,0 +1,91 @@
1
+ -- Add new Privacy enum values and migrate ConnectionsOnly -> ContactsOnly
2
+
3
+ DO $
4
+ $
5
+ BEGIN
6
+ IF NOT EXISTS (
7
+ SELECT 1
8
+ FROM pg_enum
9
+ WHERE enumlabel = 'ContactsOnly'
10
+ AND enumtypid = (SELECT oid
11
+ FROM pg_type
12
+ WHERE typname = 'Privacy')
13
+ ) THEN
14
+ ALTER TYPE "Privacy"
15
+ ADD VALUE 'ContactsOnly';
16
+ END
17
+ IF;
18
+
19
+ IF NOT EXISTS (
20
+ SELECT 1
21
+ FROM pg_enum
22
+ WHERE enumlabel = 'CreatorOnly'
23
+ AND enumtypid = (SELECT oid
24
+ FROM pg_type
25
+ WHERE typname = 'Privacy')
26
+ ) THEN
27
+ ALTER TYPE "Privacy"
28
+ ADD VALUE 'CreatorOnly';
29
+ END
30
+ IF;
31
+
32
+ IF NOT EXISTS (
33
+ SELECT 1
34
+ FROM pg_enum
35
+ WHERE enumlabel = 'ProOnly'
36
+ AND enumtypid = (SELECT oid
37
+ FROM pg_type
38
+ WHERE typname = 'Privacy')
39
+ ) THEN
40
+ ALTER TYPE "Privacy"
41
+ ADD VALUE 'ProOnly';
42
+ END
43
+ IF;
44
+
45
+ IF NOT EXISTS (
46
+ SELECT 1
47
+ FROM pg_enum
48
+ WHERE enumlabel = 'EliteOnly'
49
+ AND enumtypid = (SELECT oid
50
+ FROM pg_type
51
+ WHERE typname = 'Privacy')
52
+ ) THEN
53
+ ALTER TYPE "Privacy"
54
+ ADD VALUE 'EliteOnly';
55
+ END
56
+ IF;
57
+
58
+ IF NOT EXISTS (
59
+ SELECT 1
60
+ FROM pg_enum
61
+ WHERE enumlabel = 'LegendOnly'
62
+ AND enumtypid = (SELECT oid
63
+ FROM pg_type
64
+ WHERE typname = 'Privacy')
65
+ ) THEN
66
+ ALTER TYPE "Privacy"
67
+ ADD VALUE 'LegendOnly';
68
+ END
69
+ IF;
70
+ END $$;
71
+
72
+ -- Migrate ConnectionsOnly to ContactsOnly if present
73
+ DO $$
74
+ BEGIN
75
+ IF EXISTS (
76
+ SELECT 1
77
+ FROM pg_enum
78
+ WHERE enumlabel = 'ConnectionsOnly'
79
+ AND enumtypid = (SELECT oid
80
+ FROM pg_type
81
+ WHERE typname = 'Privacy')
82
+ ) THEN
83
+ UPDATE "BashEvent"
84
+ SET "privacy" = 'ContactsOnly'
85
+ ::"Privacy"
86
+ WHERE "privacy" = 'ConnectionsOnly'::"Privacy";
87
+ END
88
+ IF;
89
+ END $$;
90
+
91
+
@@ -0,0 +1,20 @@
1
+ -- Add 'Model' to PromotionAndMarketingSubType enum
2
+
3
+ DO $
4
+ $
5
+ BEGIN
6
+ IF NOT EXISTS (
7
+ SELECT 1
8
+ FROM pg_enum
9
+ WHERE enumlabel = 'Model'
10
+ AND enumtypid = (SELECT oid
11
+ FROM pg_type
12
+ WHERE typname = 'PromotionAndMarketingSubType')
13
+ ) THEN
14
+ ALTER TYPE "PromotionAndMarketingSubType"
15
+ ADD VALUE 'Model';
16
+ END
17
+ IF;
18
+ END $$;
19
+
20
+
@@ -0,0 +1,68 @@
1
+ -- Create VoucherStatus enum and Voucher table
2
+
3
+ DO $
4
+ $
5
+ BEGIN
6
+ IF NOT EXISTS (SELECT 1
7
+ FROM pg_type
8
+ WHERE typname = 'VoucherStatus') THEN
9
+ CREATE TYPE "VoucherStatus" AS ENUM
10
+ ('Active', 'Used', 'Cancelled');
11
+ END
12
+ IF;
13
+ END $$;
14
+
15
+ CREATE TABLE
16
+ IF NOT EXISTS "Voucher"
17
+ (
18
+ "id" TEXT NOT NULL,
19
+ "codeHash" TEXT NOT NULL,
20
+ "issuedToEmail" TEXT,
21
+ "shopifyOrderId" TEXT,
22
+ "createdAt" TIMESTAMP
23
+ (3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
24
+ "redeemedAt" TIMESTAMP
25
+ (3),
26
+ "redeemedById" TEXT,
27
+ "status" "VoucherStatus" NOT NULL DEFAULT 'Active',
28
+ "stripePromotionCodeId" TEXT,
29
+ "stripeCouponId" TEXT,
30
+ CONSTRAINT "Voucher_pkey" PRIMARY KEY
31
+ ("id")
32
+ );
33
+
34
+ CREATE UNIQUE INDEX
35
+ IF NOT EXISTS "Voucher_codeHash_key" ON "Voucher"
36
+ ("codeHash");
37
+ CREATE INDEX
38
+ IF NOT EXISTS "Voucher_issuedToEmail_idx" ON "Voucher"
39
+ ("issuedToEmail");
40
+ CREATE INDEX
41
+ IF NOT EXISTS "Voucher_shopifyOrderId_idx" ON "Voucher"
42
+ ("shopifyOrderId");
43
+ CREATE INDEX
44
+ IF NOT EXISTS "Voucher_status_idx" ON "Voucher"
45
+ ("status");
46
+ CREATE INDEX
47
+ IF NOT EXISTS "Voucher_createdAt_idx" ON "Voucher"
48
+ ("createdAt");
49
+
50
+ DO $$
51
+ BEGIN
52
+ IF NOT EXISTS (
53
+ SELECT 1
54
+ FROM information_schema.table_constraints
55
+ WHERE constraint_name = 'Voucher_redeemedById_fkey'
56
+ AND table_name = 'Voucher'
57
+ ) THEN
58
+ ALTER TABLE "Voucher"
59
+ ADD CONSTRAINT "Voucher_redeemedById_fkey"
60
+ FOREIGN KEY ("redeemedById")
61
+ REFERENCES "User"("id")
62
+ ON DELETE SET NULL
63
+ ON UPDATE CASCADE;
64
+ END
65
+ IF;
66
+ END $$;
67
+
68
+
@@ -768,8 +768,12 @@ model AmountOfGuests {
768
768
 
769
769
  enum Privacy {
770
770
  Public
771
- ConnectionsOnly
771
+ ContactsOnly
772
772
  InviteOnly
773
+ CreatorOnly
774
+ ProOnly
775
+ EliteOnly
776
+ LegendOnly
773
777
  }
774
778
 
775
779
  model TargetAudience {
@@ -1153,6 +1157,7 @@ model User {
1153
1157
  remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
1154
1158
  eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
1155
1159
  contacts Contact[]
1160
+ vouchersRedeemed Voucher[] @relation("UserVouchersRedeemed")
1156
1161
  contactLists ContactList[] @relation("UserContactLists")
1157
1162
  contactlist ContactList[]
1158
1163
 
@@ -1209,7 +1214,7 @@ model User {
1209
1214
  artistsToSee String[] @default([])
1210
1215
 
1211
1216
  // Membership system fields
1212
- membershipTier MembershipTier @default(Guest)
1217
+ membershipTier MembershipTier @default(Basic)
1213
1218
  membershipExpiresAt DateTime?
1214
1219
  membershipAutoRenew Boolean @default(false)
1215
1220
  membershipBillingInterval String? // Monthly, Yearly
@@ -1973,6 +1978,7 @@ enum PromotionAndMarketingSubType {
1973
1978
  Influencer
1974
1979
  Promoter
1975
1980
  CelebrityAppearance
1981
+ Model
1976
1982
  }
1977
1983
 
1978
1984
  enum StaffingSubType {
@@ -3656,7 +3662,7 @@ enum CommentStatus {
3656
3662
  }
3657
3663
 
3658
3664
  enum MembershipTier {
3659
- Guest
3665
+ Basic
3660
3666
  Creator
3661
3667
  Pro
3662
3668
  Elite
@@ -3675,3 +3681,24 @@ enum ReferralTier {
3675
3681
  Influencer // 6-9 referrals: $20/referral
3676
3682
  Ambashador // 10+ referrals: $25/referral
3677
3683
  }
3684
+
3685
+ // Vouchers sold via external stores (e.g., Shopify) to discount memberships
3686
+ model Voucher {
3687
+ id String @id @default(cuid())
3688
+ codeHash String @unique
3689
+ issuedToEmail String?
3690
+ shopifyOrderId String?
3691
+ createdAt DateTime @default(now())
3692
+ redeemedAt DateTime?
3693
+ redeemedById String?
3694
+ redeemedBy User? @relation("UserVouchersRedeemed", fields: [redeemedById], references: [id], onDelete: SetNull)
3695
+ status VoucherStatus @default(Active)
3696
+ stripePromotionCodeId String?
3697
+ stripeCouponId String?
3698
+ }
3699
+
3700
+ enum VoucherStatus {
3701
+ Active
3702
+ Used
3703
+ Cancelled
3704
+ }
@@ -77,7 +77,7 @@ export interface MembershipSubscriptionResult {
77
77
 
78
78
  // Pricing in cents (for Stripe)
79
79
  export const MEMBERSHIP_PRICING = {
80
- Guest: { monthly: 0, yearly: 0 },
80
+ Basic: { monthly: 0, yearly: 0 },
81
81
  Creator: { monthly: 2499, yearly: 20000 }, // $24.99/month, $200/year
82
82
  Pro: { monthly: 9900, yearly: 99900 }, // $99/month, $999/year
83
83
  Elite: { monthly: 49900, yearly: 500000 }, // $499/month, $5,000/year
@@ -85,7 +85,7 @@ export const MEMBERSHIP_PRICING = {
85
85
  };
86
86
 
87
87
  export const MEMBERSHIP_TIER_HIERARCHY: MembershipTier[] = [
88
- 'Guest', 'Creator', 'Pro', 'Elite', 'Legend'
88
+ 'Basic', 'Creator', 'Pro', 'Elite', 'Legend'
89
89
  ];
90
90
 
91
91
  export const MEMBERSHIP_FEATURES = {
@@ -178,11 +178,11 @@ export function getRequiredTierForFeature(feature: string): MembershipTier | nul
178
178
 
179
179
  // Complete tier definitions with features and pricing
180
180
  export const MEMBERSHIP_TIER_INFO: Record<MembershipTier, MembershipTierInfo> = {
181
- Guest: {
182
- tier: 'Guest',
183
- name: 'Guest',
184
- monthlyPrice: MEMBERSHIP_PRICING.Guest.monthly,
185
- yearlyPrice: MEMBERSHIP_PRICING.Guest.yearly,
181
+ Basic: {
182
+ tier: 'Basic',
183
+ name: 'Basic',
184
+ monthlyPrice: MEMBERSHIP_PRICING.Basic.monthly,
185
+ yearlyPrice: MEMBERSHIP_PRICING.Basic.yearly,
186
186
  features: [
187
187
  'Browse and attend public events',
188
188
  'Host your own events with a $5 minimum ticket required',