heartraite 1.0.220 → 1.0.221

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.
@@ -1,4 +1,4 @@
1
- import { CAStatus, Gender, MatchmakingMode } from "../enum";
1
+ import { CAStatus, Gender, Market, MatchmakingMode } from "../enum";
2
2
  import { CompatibilitySummary } from "./matchmaking.types";
3
3
  type UserId = string;
4
4
  export declare enum EventAccess {
@@ -26,10 +26,9 @@ export type Event = {
26
26
  lastUpdated: string;
27
27
  access: EventAccess;
28
28
  lastCAReminderAt?: string;
29
+ homeMarket?: Market;
29
30
  city?: string;
30
- eligibleStates?: string[];
31
- minAge?: number;
32
- maxAge?: number;
31
+ eligibility?: EventEligibility;
33
32
  priceOre?: number;
34
33
  currency?: EventCurrency;
35
34
  capacity?: EventCapacity;
@@ -39,6 +38,14 @@ export type Event = {
39
38
  salesCloseAt?: string;
40
39
  decisionAt?: string;
41
40
  };
41
+ export type EventEligibilityInterest = "opposite_gender";
42
+ export type EventEligibility = {
43
+ markets?: Market[];
44
+ states?: string[];
45
+ minAge?: number;
46
+ maxAge?: number;
47
+ interest?: EventEligibilityInterest;
48
+ };
42
49
  export type EventCurrency = "SEK";
43
50
  export type EventCapacity = {
44
51
  male: number;
@@ -52,13 +59,19 @@ export type EventSeats = {
52
59
  male: EventSeatCount;
53
60
  female: EventSeatCount;
54
61
  };
55
- export type EventSaleState = "on_sale" | "sold_out_for_you";
62
+ export type EventAvailability = "scheduled" | "on_sale" | "sold_out_for_you" | "sales_closed" | "not_eligible";
63
+ export type EventIneligibleReason = "outside_area" | "out_of_age_range" | "assessment_required";
56
64
  export type EventUserOrderStatus = "none" | "pending" | "paid";
57
- export type EventOffer = Pick<Event, "id" | "title" | "description" | "hostBrand" | "eventDateTime" | "matchRevealTime" | "location" | "city" | "minAge" | "maxAge" | "access"> & Required<Pick<Event, "priceOre" | "currency" | "salesOpenAt" | "salesCloseAt">> & {
58
- saleState: EventSaleState;
59
- seatsLeftForUser?: number;
65
+ type EventOfferDetails = Pick<Event, "id" | "title" | "description" | "hostBrand" | "eventDateTime" | "matchRevealTime" | "location" | "city" | "access"> & Required<Pick<Event, "priceOre" | "currency" | "salesOpenAt" | "salesCloseAt">> & Pick<EventEligibility, "minAge" | "maxAge"> & {
60
66
  userOrderStatus?: EventUserOrderStatus;
61
67
  };
68
+ export type EventOffer = EventOfferDetails & ({
69
+ availability: Exclude<EventAvailability, "not_eligible">;
70
+ ineligibleReason?: never;
71
+ } | {
72
+ availability: "not_eligible";
73
+ ineligibleReason: EventIneligibleReason;
74
+ });
62
75
  export type EventParticipation = {
63
76
  eventId: string;
64
77
  userId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartraite",
3
- "version": "1.0.220",
3
+ "version": "1.0.221",
4
4
  "description": "Heartraite npm package for common functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +1,4 @@
1
- import { CAStatus, Gender, MatchmakingMode } from "../enum";
1
+ import { CAStatus, Gender, Market, MatchmakingMode } from "../enum";
2
2
  import { CompatibilitySummary } from "./matchmaking.types";
3
3
 
4
4
  type UserId = string;
@@ -29,10 +29,9 @@ export type Event = {
29
29
  lastUpdated: string;
30
30
  access: EventAccess;
31
31
  lastCAReminderAt?: string;
32
+ homeMarket?: Market;
32
33
  city?: string;
33
- eligibleStates?: string[];
34
- minAge?: number;
35
- maxAge?: number;
34
+ eligibility?: EventEligibility;
36
35
  priceOre?: number;
37
36
  currency?: EventCurrency;
38
37
  capacity?: EventCapacity;
@@ -43,6 +42,16 @@ export type Event = {
43
42
  decisionAt?: string;
44
43
  };
45
44
 
45
+ export type EventEligibilityInterest = "opposite_gender";
46
+
47
+ export type EventEligibility = {
48
+ markets?: Market[];
49
+ states?: string[];
50
+ minAge?: number;
51
+ maxAge?: number;
52
+ interest?: EventEligibilityInterest;
53
+ };
54
+
46
55
  export type EventCurrency = "SEK";
47
56
 
48
57
  export type EventCapacity = {
@@ -60,11 +69,21 @@ export type EventSeats = {
60
69
  female: EventSeatCount;
61
70
  };
62
71
 
63
- export type EventSaleState = "on_sale" | "sold_out_for_you";
72
+ export type EventAvailability =
73
+ | "scheduled"
74
+ | "on_sale"
75
+ | "sold_out_for_you"
76
+ | "sales_closed"
77
+ | "not_eligible";
78
+
79
+ export type EventIneligibleReason =
80
+ | "outside_area"
81
+ | "out_of_age_range"
82
+ | "assessment_required";
64
83
 
65
84
  export type EventUserOrderStatus = "none" | "pending" | "paid";
66
85
 
67
- export type EventOffer = Pick<
86
+ type EventOfferDetails = Pick<
68
87
  Event,
69
88
  | "id"
70
89
  | "title"
@@ -74,18 +93,27 @@ export type EventOffer = Pick<
74
93
  | "matchRevealTime"
75
94
  | "location"
76
95
  | "city"
77
- | "minAge"
78
- | "maxAge"
79
96
  | "access"
80
97
  > &
81
98
  Required<
82
99
  Pick<Event, "priceOre" | "currency" | "salesOpenAt" | "salesCloseAt">
83
- > & {
84
- saleState: EventSaleState;
85
- seatsLeftForUser?: number;
100
+ > &
101
+ Pick<EventEligibility, "minAge" | "maxAge"> & {
86
102
  userOrderStatus?: EventUserOrderStatus;
87
103
  };
88
104
 
105
+ export type EventOffer = EventOfferDetails &
106
+ (
107
+ | {
108
+ availability: Exclude<EventAvailability, "not_eligible">;
109
+ ineligibleReason?: never;
110
+ }
111
+ | {
112
+ availability: "not_eligible";
113
+ ineligibleReason: EventIneligibleReason;
114
+ }
115
+ );
116
+
89
117
  export type EventParticipation = {
90
118
  eventId: string;
91
119
  userId: string;