@getmicdrop/svelte-components 5.18.2 → 5.20.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.
Files changed (122) hide show
  1. package/dist/base.css +18 -0
  2. package/dist/calendar/Calendar/MiniMonthCalendar.svelte +10 -8
  3. package/dist/calendar/Calendar/MiniMonthCalendar.svelte.d.ts.map +1 -1
  4. package/dist/components/Heading.svelte +8 -2
  5. package/dist/components/Heading.svelte.d.ts +1 -0
  6. package/dist/components/Heading.svelte.d.ts.map +1 -1
  7. package/dist/components/Text.svelte +13 -2
  8. package/dist/components/Text.svelte.d.ts +2 -1
  9. package/dist/components/Text.svelte.d.ts.map +1 -1
  10. package/dist/constants/formOptions.d.ts +2 -5
  11. package/dist/constants/formOptions.d.ts.map +1 -1
  12. package/dist/constants/formOptions.js +6 -6
  13. package/dist/constants/formOptions.spec.js +2 -7
  14. package/dist/index.d.ts +6 -2
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +29 -2
  17. package/dist/patterns/forms/FormSection.svelte +2 -1
  18. package/dist/patterns/forms/FormSection.svelte.d.ts +2 -0
  19. package/dist/patterns/forms/FormSection.svelte.d.ts.map +1 -1
  20. package/dist/patterns/layout/SidebarTestWrapper.svelte.d.ts +1 -1
  21. package/dist/patterns/navigation/Header.svelte +3 -3
  22. package/dist/primitives/Input/Select.svelte +1 -1
  23. package/dist/primitives/Pagination/DotIndicator.svelte +66 -0
  24. package/dist/primitives/Pagination/DotIndicator.svelte.d.ts +18 -0
  25. package/dist/primitives/Pagination/DotIndicator.svelte.d.ts.map +1 -0
  26. package/dist/primitives/index.d.ts +1 -0
  27. package/dist/primitives/index.js +1 -0
  28. package/dist/recipes/inputs/phoneInput/CountrySelector.svelte +1 -1
  29. package/dist/recipes/modals/FeedbackModal.svelte +205 -0
  30. package/dist/recipes/modals/FeedbackModal.svelte.d.ts +24 -0
  31. package/dist/recipes/modals/FeedbackModal.svelte.d.ts.map +1 -0
  32. package/dist/recipes/modals/index.d.ts +1 -0
  33. package/dist/recipes/modals/index.js +1 -0
  34. package/dist/schemas/event.d.ts +4 -4
  35. package/dist/schemas/order.d.ts +2 -2
  36. package/dist/schemas/promo.d.ts +4 -4
  37. package/dist/services/event.service.d.ts +11 -0
  38. package/dist/services/event.service.d.ts.map +1 -0
  39. package/dist/services/event.service.js +64 -0
  40. package/dist/services/event.service.spec.d.ts +2 -0
  41. package/dist/services/event.service.spec.d.ts.map +1 -0
  42. package/dist/services/event.service.spec.js +168 -0
  43. package/dist/services/{ShowService.d.ts → show.service.d.ts} +1 -1
  44. package/dist/services/show.service.d.ts.map +1 -0
  45. package/dist/services/show.service.js +115 -0
  46. package/dist/services/show.service.spec.d.ts +2 -0
  47. package/dist/services/show.service.spec.d.ts.map +1 -0
  48. package/dist/services/show.service.spec.js +242 -0
  49. package/dist/tailwind/preset.cjs +5 -0
  50. package/dist/tailwind/preset.d.cts +2 -0
  51. package/dist/tailwind/preset.d.cts.map +1 -1
  52. package/dist/tokens/__tests__/spacing.test.js +2 -2
  53. package/dist/tokens/base-resets.css +124 -0
  54. package/dist/tokens/spacing.d.ts +2 -0
  55. package/dist/tokens/spacing.d.ts.map +1 -1
  56. package/dist/tokens/spacing.js +1 -0
  57. package/dist/tokens/tokens.css +1 -1
  58. package/dist/tokens/utilities.css +79 -2
  59. package/dist/utils/apiConfig.js +1 -1
  60. package/dist/utils/apiConfig.spec.js +34 -27
  61. package/dist/utils/assets.d.ts +3 -0
  62. package/dist/utils/assets.d.ts.map +1 -0
  63. package/dist/utils/assets.js +3 -0
  64. package/dist/utils/classNames.d.ts +10 -0
  65. package/dist/utils/classNames.d.ts.map +1 -0
  66. package/dist/utils/classNames.js +15 -0
  67. package/dist/utils/clickOutside.d.ts +4 -0
  68. package/dist/utils/clickOutside.d.ts.map +1 -0
  69. package/dist/utils/clickOutside.js +13 -0
  70. package/dist/utils/cookieHelpers.d.ts +40 -0
  71. package/dist/utils/cookieHelpers.d.ts.map +1 -0
  72. package/dist/utils/cookieHelpers.js +102 -0
  73. package/dist/utils/dateHelpers.d.ts +71 -0
  74. package/dist/utils/dateHelpers.d.ts.map +1 -0
  75. package/dist/utils/dateHelpers.js +253 -0
  76. package/dist/utils/eventFormatters.d.ts +9 -0
  77. package/dist/utils/eventFormatters.d.ts.map +1 -0
  78. package/dist/utils/eventFormatters.js +96 -0
  79. package/dist/utils/feedbackContext.d.ts +24 -0
  80. package/dist/utils/feedbackContext.d.ts.map +1 -0
  81. package/dist/utils/feedbackContext.js +19 -0
  82. package/dist/utils/fetchHelpers.d.ts +17 -0
  83. package/dist/utils/fetchHelpers.d.ts.map +1 -0
  84. package/dist/utils/fetchHelpers.js +45 -0
  85. package/dist/utils/focusTrap.d.ts +20 -0
  86. package/dist/utils/focusTrap.d.ts.map +1 -0
  87. package/dist/utils/focusTrap.js +130 -0
  88. package/dist/utils/formatters.d.ts +56 -0
  89. package/dist/utils/formatters.d.ts.map +1 -1
  90. package/dist/utils/formatters.js +121 -1
  91. package/dist/utils/formatters.spec.js +128 -1
  92. package/dist/utils/logger.d.ts +25 -1
  93. package/dist/utils/logger.d.ts.map +1 -1
  94. package/dist/utils/logger.js +59 -1
  95. package/dist/utils/logger.spec.js +99 -1
  96. package/dist/utils/permissions.d.ts +9 -0
  97. package/dist/utils/permissions.d.ts.map +1 -0
  98. package/dist/utils/permissions.js +93 -0
  99. package/dist/utils/stringHelpers.d.ts +17 -0
  100. package/dist/utils/stringHelpers.d.ts.map +1 -0
  101. package/dist/utils/stringHelpers.js +38 -0
  102. package/dist/utils/transitions.d.ts +99 -1
  103. package/dist/utils/transitions.d.ts.map +1 -1
  104. package/dist/utils/transitions.js +144 -2
  105. package/dist/utils/utils/utils.d.ts +2 -73
  106. package/dist/utils/utils/utils.d.ts.map +1 -1
  107. package/dist/utils/utils/utils.js +2 -2
  108. package/dist/utils/utils.d.ts +41 -98
  109. package/dist/utils/utils.d.ts.map +1 -1
  110. package/dist/utils/utils.js +58 -701
  111. package/package.json +16 -3
  112. package/dist/services/EventService.d.ts +0 -5
  113. package/dist/services/EventService.d.ts.map +0 -1
  114. package/dist/services/EventService.js +0 -79
  115. package/dist/services/EventService.spec.d.ts +0 -2
  116. package/dist/services/EventService.spec.d.ts.map +0 -1
  117. package/dist/services/EventService.spec.js +0 -217
  118. package/dist/services/ShowService.d.ts.map +0 -1
  119. package/dist/services/ShowService.js +0 -144
  120. package/dist/services/ShowService.spec.d.ts +0 -2
  121. package/dist/services/ShowService.spec.d.ts.map +0 -1
  122. package/dist/services/ShowService.spec.js +0 -345
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getmicdrop/svelte-components",
3
- "version": "5.18.2",
3
+ "version": "5.20.0",
4
4
  "description": "Shared component library for Micdrop applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -13,6 +13,10 @@
13
13
  "import": "./dist/index.js"
14
14
  },
15
15
  "./styles": "./dist/styles.css",
16
+ "./base": {
17
+ "style": "./dist/tokens/typography-base.css",
18
+ "default": "./dist/tokens/typography-base.css"
19
+ },
16
20
  "./tokens": {
17
21
  "types": "./dist/tokens/index.d.ts",
18
22
  "import": "./dist/tokens/index.js"
@@ -44,6 +48,7 @@
44
48
  "./tokens/css": "./dist/tokens/tokens.css",
45
49
  "./tokens/typography-base": "./dist/tokens/typography-base.css",
46
50
  "./tokens/utilities": "./dist/tokens/utilities.css",
51
+ "./base": "./dist/base.css",
47
52
  "./tailwind-preset": "./dist/tailwind/preset.cjs",
48
53
  "./primitives/*": {
49
54
  "svelte": "./dist/primitives/*",
@@ -99,7 +104,7 @@
99
104
  "import": "./dist/forms/createFieldTracker.svelte.js"
100
105
  },
101
106
  "./services/EventService": {
102
- "import": "./dist/services/EventService.js"
107
+ "import": "./dist/services/event.service.js"
103
108
  },
104
109
  "./utils/greetings": {
105
110
  "import": "./dist/utils/greetings.js"
@@ -111,6 +116,10 @@
111
116
  "types": "./dist/utils/phoneUtils.d.ts",
112
117
  "import": "./dist/utils/phoneUtils.js"
113
118
  },
119
+ "./utils/formatters": {
120
+ "types": "./dist/utils/formatters.d.ts",
121
+ "import": "./dist/utils/formatters.js"
122
+ },
114
123
  "./utils/portal": {
115
124
  "import": "./dist/utils/portal.js"
116
125
  },
@@ -135,6 +144,10 @@
135
144
  "types": "./dist/utils/auth.d.ts",
136
145
  "import": "./dist/utils/auth.js"
137
146
  },
147
+ "./utils/feedbackContext": {
148
+ "types": "./dist/utils/feedbackContext.d.ts",
149
+ "import": "./dist/utils/feedbackContext.js"
150
+ },
138
151
  "./constants/formOptions": {
139
152
  "import": "./dist/constants/formOptions.js"
140
153
  },
@@ -236,6 +249,7 @@
236
249
  "svelte-easy-crop": "^5.0.0",
237
250
  "svelte-filepond": "^0.2.2",
238
251
  "svelte-sonner": "^1.0.7",
252
+ "@tailwindcss/forms": "^0.5.11",
239
253
  "tailwind-merge": "^3.5.0",
240
254
  "zod": "^4.3.6"
241
255
  },
@@ -249,7 +263,6 @@
249
263
  "@sveltejs/kit": "^2.50.0",
250
264
  "@sveltejs/package": "^2.5.7",
251
265
  "@sveltejs/vite-plugin-svelte": "^6.2.4",
252
- "@tailwindcss/forms": "^0.5.11",
253
266
  "@tailwindcss/vite": "^4.0.0",
254
267
  "@testing-library/jest-dom": "^6.4.6",
255
268
  "@testing-library/svelte": "^5.2.0",
@@ -1,5 +0,0 @@
1
- export function fetchEventsFromAPI(venueId: any): Promise<any>;
2
- export function fetchEventsForMonth(year: any, month: any): Promise<any>;
3
- export function fetchEventsForWeek(date: any): Promise<any>;
4
- export function fetchEventsForDay(date: any): Promise<any>;
5
- //# sourceMappingURL=EventService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EventService.d.ts","sourceRoot":"","sources":["../../src/lib/services/EventService.js"],"names":[],"mappings":"AAKA,+DAqBC;AAED,yEAYC;AAED,4DAkBC;AAED,2DAgBC"}
@@ -1,79 +0,0 @@
1
- import { addDays, startOfWeek } from "date-fns";
2
- import { buildApiUrl } from "../utils/apiConfig";
3
-
4
- let mockEvents = [];
5
-
6
- export async function fetchEventsFromAPI(venueId) {
7
- try {
8
- const url = venueId
9
- ? buildApiUrl(`/api/v2/public/events/venue/${venueId}`)
10
- : buildApiUrl("/api/v2/public/events/venue");
11
- const response = await fetch(url);
12
- if (response.ok) {
13
- const events = await response.json();
14
- return events.map((event) => ({
15
- id: event.ID,
16
- date: event.startDateTime,
17
- title: event.title,
18
- }));
19
- } else {
20
- console.error("Failed to load events:", response.status);
21
- return [];
22
- }
23
- } catch (error) {
24
- console.error("Error fetching events:", error);
25
- return [];
26
- }
27
- }
28
-
29
- export async function fetchEventsForMonth(year, month) {
30
- mockEvents = await fetchEventsFromAPI();
31
-
32
- return new Promise((resolve) => {
33
- setTimeout(() => {
34
- resolve(
35
- mockEvents.filter((event) =>
36
- event.date.startsWith(`${year}-${String(month).padStart(2, "0")}`)
37
- )
38
- );
39
- }, 500);
40
- });
41
- }
42
-
43
- export async function fetchEventsForWeek(date) {
44
- mockEvents = await fetchEventsFromAPI();
45
-
46
- const startOfWeekDate = startOfWeek(date, { weekStartsOn: 1 });
47
- const endOfWeekDate = addDays(startOfWeekDate, 6);
48
-
49
- return new Promise((resolve) => {
50
- setTimeout(() => {
51
- const filteredEvents = mockEvents.filter((event) => {
52
- const eventDate = new Date(event.date).getTime();
53
- return (
54
- eventDate >= startOfWeekDate.getTime() &&
55
- eventDate <= endOfWeekDate.getTime()
56
- );
57
- });
58
- resolve(filteredEvents);
59
- }, 500);
60
- });
61
- }
62
-
63
- export async function fetchEventsForDay(date) {
64
- mockEvents = await fetchEventsFromAPI();
65
-
66
- return new Promise((resolve) => {
67
- setTimeout(() => {
68
- const filteredEvents = mockEvents.filter((event) => {
69
- const eventDate = new Date(event.date);
70
- return (
71
- eventDate.getUTCDate() === date.getUTCDate() &&
72
- eventDate.getUTCMonth() === date.getUTCMonth() &&
73
- eventDate.getUTCFullYear() === date.getUTCFullYear()
74
- );
75
- });
76
- resolve(filteredEvents);
77
- }, 500);
78
- });
79
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=EventService.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EventService.spec.d.ts","sourceRoot":"","sources":["../../src/lib/services/EventService.spec.js"],"names":[],"mappings":""}
@@ -1,217 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
-
3
- // Create mock functions we'll spy on
4
- const mockEvents = [
5
- { ID: 1, startDateTime: '2025-01-15T20:00:00', title: 'Comedy Night' },
6
- { ID: 2, startDateTime: '2025-01-15T21:00:00', title: 'Open Mic' },
7
- { ID: 3, startDateTime: '2025-02-10T19:00:00', title: 'Improv Show' },
8
- ];
9
-
10
- import {
11
- fetchEventsFromAPI,
12
- fetchEventsForMonth,
13
- fetchEventsForWeek,
14
- fetchEventsForDay,
15
- } from './EventService';
16
-
17
- describe('EventService', () => {
18
- beforeEach(() => {
19
- vi.clearAllMocks();
20
- global.fetch = vi.fn();
21
- });
22
-
23
- describe('fetchEventsFromAPI', () => {
24
- it('fetches events from the API', async () => {
25
- global.fetch.mockResolvedValue({
26
- ok: true,
27
- json: () => Promise.resolve(mockEvents),
28
- });
29
-
30
- const events = await fetchEventsFromAPI();
31
-
32
- expect(global.fetch).toHaveBeenCalledWith(
33
- 'https://get-micdrop.com/api/v2/public/events/venue'
34
- );
35
- expect(events).toHaveLength(3);
36
- });
37
-
38
- it('transforms event data correctly', async () => {
39
- global.fetch.mockResolvedValue({
40
- ok: true,
41
- json: () => Promise.resolve([mockEvents[0]]),
42
- });
43
-
44
- const events = await fetchEventsFromAPI();
45
-
46
- expect(events[0]).toEqual({
47
- id: 1,
48
- date: '2025-01-15T20:00:00',
49
- title: 'Comedy Night',
50
- });
51
- });
52
-
53
- it('returns empty array on failed response', async () => {
54
- const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
55
- global.fetch.mockResolvedValue({
56
- ok: false,
57
- status: 500,
58
- });
59
-
60
- const events = await fetchEventsFromAPI();
61
-
62
- expect(events).toEqual([]);
63
- consoleSpy.mockRestore();
64
- });
65
-
66
- it('returns empty array on network error', async () => {
67
- const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
68
- global.fetch.mockRejectedValue(new Error('Network error'));
69
-
70
- const events = await fetchEventsFromAPI();
71
-
72
- expect(events).toEqual([]);
73
- consoleSpy.mockRestore();
74
- });
75
- });
76
-
77
- describe('fetchEventsForMonth', () => {
78
- it('filters events by year and month', async () => {
79
- global.fetch.mockResolvedValue({
80
- ok: true,
81
- json: () => Promise.resolve(mockEvents),
82
- });
83
-
84
- const events = await fetchEventsForMonth(2025, 1);
85
-
86
- expect(events.length).toBe(2);
87
- expect(events[0].title).toBe('Comedy Night');
88
- expect(events[1].title).toBe('Open Mic');
89
- }, 10000);
90
-
91
- it('returns empty for month with no events', async () => {
92
- global.fetch.mockResolvedValue({
93
- ok: true,
94
- json: () => Promise.resolve(mockEvents),
95
- });
96
-
97
- const events = await fetchEventsForMonth(2025, 3);
98
-
99
- expect(events).toEqual([]);
100
- }, 10000);
101
-
102
- it('pads single digit months correctly', async () => {
103
- global.fetch.mockResolvedValue({
104
- ok: true,
105
- json: () => Promise.resolve(mockEvents),
106
- });
107
-
108
- const events = await fetchEventsForMonth(2025, 2);
109
-
110
- expect(events.length).toBe(1);
111
- expect(events[0].title).toBe('Improv Show');
112
- }, 10000);
113
-
114
- it('handles double digit months', async () => {
115
- const decemberEvents = [
116
- { ID: 4, startDateTime: '2025-12-25T20:00:00', title: 'Holiday Show' },
117
- ];
118
- global.fetch.mockResolvedValue({
119
- ok: true,
120
- json: () => Promise.resolve(decemberEvents),
121
- });
122
-
123
- const events = await fetchEventsForMonth(2025, 12);
124
-
125
- expect(events.length).toBe(1);
126
- }, 10000);
127
- });
128
-
129
- describe('fetchEventsForWeek', () => {
130
- it('filters events within the week', async () => {
131
- // Events on Jan 13-14, 2025 (Monday-Tuesday of that week)
132
- const weekEvents = [
133
- { ID: 1, startDateTime: '2025-01-13T20:00:00', title: 'Monday Show' },
134
- { ID: 2, startDateTime: '2025-01-14T19:00:00', title: 'Tuesday Show' },
135
- { ID: 3, startDateTime: '2025-01-20T20:00:00', title: 'Next Week Show' },
136
- ];
137
- global.fetch.mockResolvedValue({
138
- ok: true,
139
- json: () => Promise.resolve(weekEvents),
140
- });
141
-
142
- // Jan 15, 2025 is a Wednesday
143
- const date = new Date('2025-01-15');
144
- const events = await fetchEventsForWeek(date);
145
-
146
- // Should include Monday and Tuesday shows (same week)
147
- expect(events.length).toBe(2);
148
- }, 10000);
149
-
150
- it('uses Monday as week start', async () => {
151
- const events = [
152
- { ID: 1, startDateTime: '2025-01-12T20:00:00', title: 'Sunday Show' },
153
- { ID: 2, startDateTime: '2025-01-13T20:00:00', title: 'Monday Show' },
154
- ];
155
- global.fetch.mockResolvedValue({
156
- ok: true,
157
- json: () => Promise.resolve(events),
158
- });
159
-
160
- // Pass a date in the week starting Jan 13
161
- const date = new Date('2025-01-15');
162
- const result = await fetchEventsForWeek(date);
163
-
164
- // Sunday should be excluded, Monday included
165
- expect(result.some((e) => e.title === 'Monday Show')).toBe(true);
166
- }, 10000);
167
- });
168
-
169
- describe('fetchEventsForDay', () => {
170
- it('filters events for specific day', async () => {
171
- // Use Z suffix for UTC dates to avoid timezone issues
172
- const dayEvents = [
173
- { ID: 1, startDateTime: '2025-01-15T14:00:00Z', title: 'Afternoon Show' },
174
- { ID: 2, startDateTime: '2025-01-15T20:00:00Z', title: 'Evening Show' },
175
- { ID: 3, startDateTime: '2025-01-16T20:00:00Z', title: 'Next Day Show' },
176
- ];
177
- global.fetch.mockResolvedValue({
178
- ok: true,
179
- json: () => Promise.resolve(dayEvents),
180
- });
181
-
182
- const date = new Date(Date.UTC(2025, 0, 15)); // Jan 15, 2025 UTC
183
- const events = await fetchEventsForDay(date);
184
-
185
- expect(events.length).toBe(2);
186
- expect(events[0].title).toBe('Afternoon Show');
187
- expect(events[1].title).toBe('Evening Show');
188
- }, 10000);
189
-
190
- it('returns empty array for day with no events', async () => {
191
- global.fetch.mockResolvedValue({
192
- ok: true,
193
- json: () => Promise.resolve(mockEvents),
194
- });
195
-
196
- const date = new Date(Date.UTC(2025, 0, 20)); // Jan 20, 2025
197
- const events = await fetchEventsForDay(date);
198
-
199
- expect(events).toEqual([]);
200
- }, 10000);
201
-
202
- it('matches dates using UTC methods', async () => {
203
- const dayEvents = [
204
- { ID: 1, startDateTime: '2025-06-15T23:00:00Z', title: 'Late Show' },
205
- ];
206
- global.fetch.mockResolvedValue({
207
- ok: true,
208
- json: () => Promise.resolve(dayEvents),
209
- });
210
-
211
- const date = new Date(Date.UTC(2025, 5, 15)); // June 15, 2025 UTC
212
- const events = await fetchEventsForDay(date);
213
-
214
- expect(events.length).toBe(1);
215
- }, 10000);
216
- });
217
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShowService.d.ts","sourceRoot":"","sources":["ShowService.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,uCAJW,MAAM,GAAC,MAAM,YACb,MAAM,GACJ,OAAO,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CAAC,CAAC,CAwBhD;AAED;;;;;GAKG;AACH,wCAJW,MAAM,GAAC,MAAM,YACb,MAAM,GACJ,OAAO,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CAAC,CAAC,CAwBhD;AAED;;;;;GAKG;AACH,uCAJW,MAAM,GAAC,MAAM,YACb,MAAM,GACJ,OAAO,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CAAC,CAAC,CAwBhD;AAED;;;;;GAKG;AACH,2CAJW,MAAM,GAAC,MAAM,WACb,MAAM,GACJ,OAAO,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CAAC,CAAC,CAoChD;AAED;;;;GAIG;AACH,qCAHW,MAAM,GAAC,MAAM,GACX,MAAM,CAIlB"}
@@ -1,144 +0,0 @@
1
- import { API_BASE_URL, USE_V2_API, buildApiUrl, buildPerformerInviteUrl, getPerformerInviteMethod } from "../utils/apiConfig";
2
- import { getPerformerToken } from "../utils/utils";
3
-
4
- /**
5
- * Accept an event performer invitation
6
- * @param {string|number} inviteId - The invitation ID
7
- * @param {string} message - Optional message to include
8
- * @returns {Promise<{ok: boolean, result?: any}>}
9
- */
10
- export async function acceptInvite(inviteId, message = "") {
11
- try {
12
- const response = await fetch(
13
- buildPerformerInviteUrl(inviteId, "accept"),
14
- {
15
- method: getPerformerInviteMethod("accept"),
16
- headers: {
17
- "Content-Type": "application/json",
18
- },
19
- body: JSON.stringify({ message }),
20
- }
21
- );
22
-
23
- if (response.ok) {
24
- const result = await response.json();
25
- return { ok: true, result };
26
- }
27
- return { ok: false };
28
- } catch (error) {
29
- console.error("Error accepting invite:", error);
30
- return { ok: false };
31
- }
32
- }
33
-
34
- /**
35
- * Decline an event performer invitation
36
- * @param {string|number} inviteId - The invitation ID
37
- * @param {string} message - Optional message to include
38
- * @returns {Promise<{ok: boolean, result?: any}>}
39
- */
40
- export async function declineInvite(inviteId, message = "") {
41
- try {
42
- const response = await fetch(
43
- buildPerformerInviteUrl(inviteId, "decline"),
44
- {
45
- method: getPerformerInviteMethod("decline"),
46
- headers: {
47
- "Content-Type": "application/json",
48
- },
49
- body: JSON.stringify({ message }),
50
- }
51
- );
52
-
53
- if (response.ok) {
54
- const result = await response.json();
55
- return { ok: true, result };
56
- }
57
- return { ok: false };
58
- } catch (error) {
59
- console.error("Error declining invite:", error);
60
- return { ok: false };
61
- }
62
- }
63
-
64
- /**
65
- * Cancel an event performer invitation
66
- * @param {string|number} inviteId - The invitation ID
67
- * @param {string} message - Optional message to include
68
- * @returns {Promise<{ok: boolean, result?: any}>}
69
- */
70
- export async function cancelInvite(inviteId, message = "") {
71
- try {
72
- const response = await fetch(
73
- buildPerformerInviteUrl(inviteId, "cancel"),
74
- {
75
- method: getPerformerInviteMethod("cancel"),
76
- headers: {
77
- "Content-Type": "application/json",
78
- },
79
- body: JSON.stringify({ message }),
80
- }
81
- );
82
-
83
- if (response.ok) {
84
- const result = await response.json();
85
- return { ok: true, result };
86
- }
87
- return { ok: false };
88
- } catch (error) {
89
- console.error("Error cancelling invite:", error);
90
- return { ok: false };
91
- }
92
- }
93
-
94
- /**
95
- * Send a message to a venue
96
- * @param {string|number} inviteId - The invitation/event ID
97
- * @param {string} message - The message to send
98
- * @returns {Promise<{ok: boolean, result?: any}>}
99
- */
100
- export async function sendVenueMessage(inviteId, message) {
101
- try {
102
- const token = getPerformerToken();
103
-
104
- const url = USE_V2_API
105
- ? buildApiUrl(`/api/v2/performer/invites/${inviteId}/message`)
106
- : buildApiUrl(`/api/performer/sendVenueMessage/${inviteId}`);
107
- const response = await fetch(url, {
108
- method: "POST",
109
- headers: {
110
- "Content-Type": "application/json",
111
- Authorization: `Bearer ${token}`,
112
- },
113
- credentials: "include",
114
- body: JSON.stringify({ message }),
115
- }
116
- );
117
-
118
- if (response.ok) {
119
- const text = await response.text();
120
- let result = { message: "Email sent successfully" };
121
- if (text) {
122
- try {
123
- result = JSON.parse(text);
124
- } catch (_e) {
125
- // Empty response is fine
126
- }
127
- }
128
- return { ok: true, result };
129
- }
130
- return { ok: false };
131
- } catch (error) {
132
- console.error("Error sending venue message:", error);
133
- return { ok: false };
134
- }
135
- }
136
-
137
- /**
138
- * Get the ticketing event URL
139
- * @param {string|number} venueId - The venue/event ID
140
- * @returns {string}
141
- */
142
- export function getEventUrl(venueId) {
143
- return `${API_BASE_URL}/ticketing/events/${venueId}`;
144
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ShowService.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShowService.spec.d.ts","sourceRoot":"","sources":["../../src/lib/services/ShowService.spec.js"],"names":[],"mappings":""}