wedance-shared 1.0.37 → 1.0.39

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/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./types";
2
- export * from "./utils/date";
1
+ export * from "./types/index.js";
2
+ export * from "./utils/date.js";
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./types";
2
- export * from "./utils/date";
1
+ export * from "./types/index.js";
2
+ export * from "./utils/date.js";
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { Timestamp } from "firebase/firestore";
2
- import { City } from "./city";
3
- import { OrganizerName } from "./organizer";
4
- import { EventTicket } from "./ticket";
5
- import { UserBadge } from "./user";
2
+ import { City } from "./city.js";
3
+ import { OrganizerName } from "./organizer.js";
4
+ import { EventTicket } from "./ticket.js";
5
+ import { UserBadge } from "./user.js";
6
6
  export type DanceTag = "salsa" | "kizomba" | "bachata" | "zouk";
7
7
  export type Organizer = {
8
8
  name: OrganizerName;
@@ -30,6 +30,7 @@ export type ImageData = {
30
30
  * */
31
31
  export type EventData = {
32
32
  id: string;
33
+ externalId: string | null | undefined;
33
34
  title: string;
34
35
  from: string;
35
36
  until: string;
@@ -1,6 +1,6 @@
1
1
  import { Timestamp } from "firebase/firestore";
2
- import { Links } from "../event";
3
- import { EventTicket } from "wedance-shared";
2
+ import { Links } from "../event.js";
3
+ import { EventTicket } from "../ticket.js";
4
4
  /**
5
5
  * This is the type of the data we get from the server
6
6
  * */
@@ -1,2 +1,2 @@
1
- export * from "./festival";
2
- export * from "./user";
1
+ export * from "./festival.js";
2
+ export * from "./user.js";
@@ -1,3 +1,3 @@
1
- export * from "./festival";
2
- export * from "./user";
1
+ export * from "./festival.js";
2
+ export * from "./user.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/festivals/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/festivals/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Timestamp } from "firebase/firestore";
2
- import { Role } from "../user";
2
+ import { Role } from "../user.js";
3
3
  export type FestivalUser = {
4
4
  id: string;
5
5
  email: string;
@@ -1,8 +1,8 @@
1
- export * from "./event";
2
- export * from "./ticket";
3
- export * from "./city";
4
- export * from "./organizer";
5
- export * from "./user";
6
- export * from "./other";
7
- export * from "./analytics";
8
- export * from "./festivals";
1
+ export * from "./event.js";
2
+ export * from "./ticket.js";
3
+ export * from "./city.js";
4
+ export * from "./organizer.js";
5
+ export * from "./user.js";
6
+ export * from "./other.js";
7
+ export * from "./analytics.js";
8
+ export * from "./festivals/index.js";
@@ -1,11 +1,11 @@
1
1
  // Re-export all types from individual files
2
- export * from "./event";
3
- export * from "./ticket";
4
- export * from "./city";
5
- export * from "./organizer";
6
- export * from "./user";
7
- export * from "./other";
8
- export * from "./analytics";
2
+ export * from "./event.js";
3
+ export * from "./ticket.js";
4
+ export * from "./city.js";
5
+ export * from "./organizer.js";
6
+ export * from "./user.js";
7
+ export * from "./other.js";
8
+ export * from "./analytics.js";
9
9
  // Re-export from subdirectories
10
- export * from "./festivals";
10
+ export * from "./festivals/index.js";
11
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAE5B,gCAAgC;AAChC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAE/B,gCAAgC;AAChC,cAAc,sBAAsB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { City } from "./city";
1
+ import { City } from "./city.js";
2
2
  export type OrganizerName = "SOB Productions" | "Helsinki SBK" | "Avec Dance Club" | "Still Dancing" | "Tanssikoulu SalsaLatina" | "Helsinki Salsa Academy" | "BabaGen" | "Bachata Studio" | "Tanssikoulu BailaBaila" | "Petra & Otso" | "Bachata Helsinki" | "Anton Kargaltsev" | "Salsa Borealis" | "Helsinki Dance Central" | "Urbankiz Helsinki" | "S-Dance" | "Helsinki Kizomba Studio" | "idance Helsinki" | "Dance Social" | "Tinku Latin Flavours" | "Latin Garden Helsinki" | "Tampere Social Dancing" | "Azúcar" | "Kizomba Social Tampere" | "KizLab Tampere" | "Bachata & Kizomba Oulu" | "SALSA Klubi" | "Tanssikoulu Vamos" | "Feels Oulu" | "Bachata Sensual Lovers" | "Tanssikoulu Matleena" | "Merja Tanjunen" | "Fever Dance Oslo" | "Pure Dance Official" | "Dancecity" | "Bachata Monthly" | "Salsakompaniet" | "Bachata Studio Tallinn" | "Casa De Baile" | "Havana Moderna" | "Crazy Lion Events" | "Other";
3
3
  export type OrganizerData = {
4
4
  id: string;
@@ -12,11 +12,17 @@ export type Ticket = {
12
12
  eventId: string;
13
13
  eventName: string;
14
14
  eventDate: string;
15
+ /**
16
+ * Date of purchase in ISO format
17
+ */
15
18
  purchaseDate: string;
16
19
  quantity: number;
17
- ticketPrice: number;
20
+ paidAmount: MonetaryAmount;
21
+ originalAmount: MonetaryAmount;
18
22
  ticketType: string;
19
- previousOwner: string[];
23
+ /**
24
+ * ID of the user who originally purchased the ticket
25
+ */
20
26
  originalOwnerId: string;
21
27
  /**
22
28
  * ID of the user who owns the ticket
@@ -31,14 +37,24 @@ export type Ticket = {
31
37
  discountAmount: number;
32
38
  discountType: "fixed" | "percentage";
33
39
  };
34
- originalPrice: number;
35
- orderNumber: string;
36
40
  checkedInAt?: string;
37
41
  notes?: string;
38
42
  transferredAt?: string;
39
43
  refundedAt?: string;
40
44
  createdAt: Timestamp;
41
45
  updatedAt: Timestamp;
46
+ /**
47
+ * @deprecated Replaced by originalOwnerId
48
+ */
49
+ previousOwner: string[];
50
+ /**
51
+ * @deprecated Replaced by price.amount
52
+ */
53
+ originalPrice?: number;
54
+ /**
55
+ * @deprecated Replaced by price.amount
56
+ */
57
+ ticketPrice?: number;
42
58
  };
43
59
  export type TicketTransfer = {
44
60
  type: "transfer";
@@ -48,30 +64,54 @@ export type TicketTransfer = {
48
64
  };
49
65
  export type CouponCode = {
50
66
  code: string;
51
- discountAmount: number;
52
67
  discountType: "fixed" | "percentage";
53
- minPurchaseQuantity?: number;
54
- maxUsage?: number;
55
- expiryDate?: string;
68
+ discountAmount: number;
69
+ startDate: string | null;
70
+ expiryDate: string | null;
56
71
  };
57
72
  export type EventTicket = {
58
73
  id: string;
59
74
  price: number;
60
- ticketType: string;
75
+ price_details: MonetaryAmount;
61
76
  eventId: string;
62
77
  quantity: number;
63
78
  amountSold: number;
64
- coupons?: CouponCode[];
79
+ coupons: CouponCode[] | null;
65
80
  name: string;
66
81
  description?: string;
67
82
  maxQuantityPerPurchase?: number;
68
83
  minQuantityPerPurchase?: number;
69
- saleStartDate?: string;
70
- saleEndDate?: string;
71
- isEarlyBird?: boolean;
84
+ startDate: string | null;
85
+ endDate: string | null;
72
86
  isTransferable: boolean;
73
87
  isRefundable: boolean;
74
- status: "published" | "draft";
88
+ status: "published" | "draft" | "sold-out" | "unavailable";
89
+ /**
90
+ * Promotional period for the ticket
91
+ */
92
+ promotionalPeriod: PromotionalPeriod | null;
93
+ /**
94
+ * @deprecated Replaced by name
95
+ */
96
+ ticketType: string;
97
+ };
98
+ export type PromotionalPeriod = {
99
+ /**
100
+ * Discount amount during the promotional period. Can't be more than the price. unit: MAJOR
101
+ */
102
+ discountAmount: number;
103
+ /**
104
+ * Start date of the promotional period (ISO string)
105
+ */
106
+ startDate: string;
107
+ /**
108
+ * End date of the promotional period (ISO string)
109
+ */
110
+ endDate: string;
111
+ /**
112
+ * Optional description of the promotion (e.g., "Early Bird", "Flash Sale")
113
+ */
114
+ description?: string;
75
115
  };
76
116
  export type Payment = {
77
117
  amount: number;
@@ -127,3 +167,8 @@ export type Payment = {
127
167
  transfer_data: string | null;
128
168
  transfer_group: string | null;
129
169
  };
170
+ export type MonetaryAmount = {
171
+ amount: number;
172
+ currency: string;
173
+ unit: "MAJOR" | "MINOR";
174
+ };
@@ -1,7 +1,7 @@
1
- import { City } from "./city";
2
- import { DanceTag } from "./event";
3
- import { OrganizerName } from "./organizer";
4
- import { Ticket } from "./ticket";
1
+ import { City } from "./city.js";
2
+ import { DanceTag } from "./event.js";
3
+ import { OrganizerName } from "./organizer.js";
4
+ import { Ticket } from "./ticket.js";
5
5
  export type Role = "admin" | "manager" | "organiser" | "user";
6
6
  export type User = {
7
7
  id: string;
@@ -1,5 +1,5 @@
1
1
  import dayjs from "dayjs";
2
- import relativeTime from "dayjs/plugin/relativeTime";
2
+ import relativeTime from "dayjs/plugin/relativeTime.js";
3
3
  import { Timestamp } from "firebase/firestore";
4
4
  // Register the relativeTime pl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,iCAAiC;IACjC,OAAO,KAAK,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,CAAC;AAC1C,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "wedance-shared",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "This repository contains shared TypeScript types and interfaces used across multiple WeDance applications:",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.js"
12
+ }
13
+ },
7
14
  "scripts": {
8
15
  "build": "tsc",
9
16
  "build:watch": "tsc --watch",
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./types";
2
- export * from "./utils/date";
1
+ export * from "./types/index.js";
2
+ export * from "./utils/date.js";
@@ -1,8 +1,8 @@
1
1
  import { Timestamp } from "firebase/firestore";
2
- import { City } from "./city";
3
- import { OrganizerName } from "./organizer";
4
- import { EventTicket } from "./ticket";
5
- import { UserBadge } from "./user";
2
+ import { City } from "./city.js";
3
+ import { OrganizerName } from "./organizer.js";
4
+ import { EventTicket } from "./ticket.js";
5
+ import { UserBadge } from "./user.js";
6
6
 
7
7
  export type DanceTag = "salsa" | "kizomba" | "bachata" | "zouk";
8
8
 
@@ -37,6 +37,8 @@ export type ImageData = {
37
37
  * */
38
38
  export type EventData = {
39
39
  id: string;
40
+ // Id from an event added by a partner.
41
+ externalId: string | null | undefined;
40
42
  title: string;
41
43
  // Date in iso format
42
44
  from: string;
@@ -1,6 +1,6 @@
1
1
  import { Timestamp } from "firebase/firestore";
2
- import { Links } from "../event";
3
- import { DanceTag, EventTicket } from "wedance-shared";
2
+ import { Links } from "../event.js";
3
+ import { EventTicket } from "../ticket.js";
4
4
 
5
5
  /**
6
6
  * This is the type of the data we get from the server
@@ -1,2 +1,2 @@
1
- export * from "./festival";
2
- export * from "./user";
1
+ export * from "./festival.js";
2
+ export * from "./user.js";
@@ -1,5 +1,5 @@
1
1
  import { Timestamp } from "firebase/firestore";
2
- import { Role } from "../user";
2
+ import { Role } from "../user.js";
3
3
 
4
4
  export type FestivalUser = {
5
5
  id: string;
@@ -1,11 +1,11 @@
1
1
  // Re-export all types from individual files
2
- export * from "./event";
3
- export * from "./ticket";
4
- export * from "./city";
5
- export * from "./organizer";
6
- export * from "./user";
7
- export * from "./other";
8
- export * from "./analytics";
2
+ export * from "./event.js";
3
+ export * from "./ticket.js";
4
+ export * from "./city.js";
5
+ export * from "./organizer.js";
6
+ export * from "./user.js";
7
+ export * from "./other.js";
8
+ export * from "./analytics.js";
9
9
 
10
10
  // Re-export from subdirectories
11
- export * from "./festivals";
11
+ export * from "./festivals/index.js";
@@ -1,4 +1,4 @@
1
- import { City } from "./city";
1
+ import { City } from "./city.js";
2
2
 
3
3
  export type OrganizerName =
4
4
  // HELSINKI
@@ -20,12 +20,17 @@ export type Ticket = {
20
20
  eventId: string;
21
21
  eventName: string;
22
22
  eventDate: string;
23
+ /**
24
+ * Date of purchase in ISO format
25
+ */
23
26
  purchaseDate: string;
24
27
  quantity: number;
25
- ticketPrice: number;
28
+ paidAmount: MonetaryAmount;
29
+ originalAmount: MonetaryAmount;
26
30
  ticketType: string;
27
- // @deprecated Replaced by originalOwnerId
28
- previousOwner: string[];
31
+ /**
32
+ * ID of the user who originally purchased the ticket
33
+ */
29
34
  originalOwnerId: string;
30
35
  /**
31
36
  * ID of the user who owns the ticket
@@ -40,14 +45,24 @@ export type Ticket = {
40
45
  discountAmount: number;
41
46
  discountType: "fixed" | "percentage";
42
47
  };
43
- originalPrice: number;
44
- orderNumber: string;
45
48
  checkedInAt?: string;
46
49
  notes?: string;
47
50
  transferredAt?: string;
48
51
  refundedAt?: string;
49
52
  createdAt: Timestamp;
50
53
  updatedAt: Timestamp;
54
+ /**
55
+ * @deprecated Replaced by originalOwnerId
56
+ */
57
+ previousOwner: string[];
58
+ /**
59
+ * @deprecated Replaced by price.amount
60
+ */
61
+ originalPrice?: number;
62
+ /**
63
+ * @deprecated Replaced by price.amount
64
+ */
65
+ ticketPrice?: number;
51
66
  };
52
67
 
53
68
  export type TicketTransfer = {
@@ -59,32 +74,56 @@ export type TicketTransfer = {
59
74
 
60
75
  export type CouponCode = {
61
76
  code: string;
62
- discountAmount: number; // Amount to subtract from original price
63
- discountType: "fixed" | "percentage"; // Whether it's a fixed amount or percentage
64
- minPurchaseQuantity?: number; // Minimum tickets required for this specific code
65
- maxUsage?: number; // Maximum number of times this code can be used
66
- expiryDate?: string; // Optional expiry date for the coupon
77
+ discountType: "fixed" | "percentage";
78
+ discountAmount: number;
79
+ startDate: string | null;
80
+ expiryDate: string | null;
67
81
  };
68
82
 
69
83
  export type EventTicket = {
70
84
  id: string;
71
85
  price: number;
72
- // ticketType is deprecated, use name instead
73
- ticketType: string;
86
+ price_details: MonetaryAmount;
74
87
  eventId: string;
75
- quantity: number; // Total tickets allocated
76
- amountSold: number; // Number of tickets sold
77
- coupons?: CouponCode[];
88
+ quantity: number;
89
+ amountSold: number;
90
+ coupons: CouponCode[] | null;
78
91
  name: string;
79
92
  description?: string;
80
93
  maxQuantityPerPurchase?: number;
81
94
  minQuantityPerPurchase?: number;
82
- saleStartDate?: string;
83
- saleEndDate?: string;
84
- isEarlyBird?: boolean;
95
+ startDate: string | null;
96
+ endDate: string | null;
85
97
  isTransferable: boolean;
86
98
  isRefundable: boolean;
87
- status: "published" | "draft";
99
+ status: "published" | "draft" | "sold-out" | "unavailable";
100
+ /**
101
+ * Promotional period for the ticket
102
+ */
103
+ promotionalPeriod: PromotionalPeriod | null;
104
+ /**
105
+ * @deprecated Replaced by name
106
+ */
107
+ ticketType: string;
108
+ };
109
+
110
+ export type PromotionalPeriod = {
111
+ /**
112
+ * Discount amount during the promotional period. Can't be more than the price. unit: MAJOR
113
+ */
114
+ discountAmount: number;
115
+ /**
116
+ * Start date of the promotional period (ISO string)
117
+ */
118
+ startDate: string;
119
+ /**
120
+ * End date of the promotional period (ISO string)
121
+ */
122
+ endDate: string;
123
+ /**
124
+ * Optional description of the promotion (e.g., "Early Bird", "Flash Sale")
125
+ */
126
+ description?: string;
88
127
  };
89
128
 
90
129
  export type Payment = {
@@ -141,3 +180,9 @@ export type Payment = {
141
180
  transfer_data: string | null;
142
181
  transfer_group: string | null;
143
182
  };
183
+
184
+ export type MonetaryAmount = {
185
+ amount: number;
186
+ currency: string;
187
+ unit: "MAJOR" | "MINOR";
188
+ };
package/src/types/user.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { City } from "./city";
2
- import { DanceTag } from "./event";
3
- import { OrganizerName } from "./organizer";
4
- import { Ticket } from "./ticket";
1
+ import { City } from "./city.js";
2
+ import { DanceTag } from "./event.js";
3
+ import { OrganizerName } from "./organizer.js";
4
+ import { Ticket } from "./ticket.js";
5
5
 
6
6
  export type Role = "admin" | "manager" | "organiser" | "user";
7
7
 
package/src/utils/date.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import dayjs from "dayjs";
2
- import relativeTime from "dayjs/plugin/relativeTime";
2
+ import relativeTime from "dayjs/plugin/relativeTime.js";
3
3
  import { Timestamp } from "firebase/firestore";
4
4
 
5
5
  // Register the relativeTime plugin
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "ES2020",
4
- "module": "ESNext",
4
+ "module": "NodeNext",
5
5
  "rootDir": "./src",
6
6
  "sourceMap": true,
7
7
  "outDir": "./dist",
@@ -12,7 +12,7 @@
12
12
  "forceConsistentCasingInFileNames": true,
13
13
  "strict": true,
14
14
  "skipLibCheck": true,
15
- "moduleResolution": "node"
15
+ "moduleResolution": "nodenext"
16
16
  },
17
17
  "include": ["src/**/*"],
18
18
  "exclude": ["node_modules", "dist"]