@getmicdrop/svelte-components 2.0.8 → 2.0.9

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,143 +1,143 @@
1
- import { API_BASE_URL, API_ENDPOINTS, buildApiUrl } 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
- buildApiUrl(`${API_ENDPOINTS.ACCEPT_EVENT_PERFORMER_INVITE}/${inviteId}`),
14
- {
15
- method: "PUT",
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
- buildApiUrl(`${API_ENDPOINTS.DECLINE_EVENT_PERFORMER_INVITE}/${inviteId}`),
44
- {
45
- method: "PUT",
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
- buildApiUrl(`${API_ENDPOINTS.CANCEL_EVENT_PERFORMER_INVITE}/${inviteId}`),
74
- {
75
- method: "PUT",
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 response = await fetch(
105
- buildApiUrl(`${API_ENDPOINTS.SEND_VENUE_MESSAGE}/${inviteId}`),
106
- {
107
- method: "POST",
108
- headers: {
109
- "Content-Type": "application/json",
110
- Authorization: `Bearer ${token}`,
111
- },
112
- credentials: "include",
113
- body: JSON.stringify({ message }),
114
- }
115
- );
116
-
117
- if (response.ok) {
118
- const text = await response.text();
119
- let result = { message: "Email sent successfully" };
120
- if (text) {
121
- try {
122
- result = JSON.parse(text);
123
- } catch (e) {
124
- // Empty response is fine
125
- }
126
- }
127
- return { ok: true, result };
128
- }
129
- return { ok: false };
130
- } catch (error) {
131
- console.error("Error sending venue message:", error);
132
- return { ok: false };
133
- }
134
- }
135
-
136
- /**
137
- * Get the ticketing event URL
138
- * @param {string|number} venueId - The venue/event ID
139
- * @returns {string}
140
- */
141
- export function getEventUrl(venueId) {
142
- return `${API_BASE_URL}/ticketing/events/${venueId}`;
143
- }
1
+ import { API_BASE_URL, API_ENDPOINTS, buildApiUrl } 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
+ buildApiUrl(`${API_ENDPOINTS.ACCEPT_EVENT_PERFORMER_INVITE}/${inviteId}`),
14
+ {
15
+ method: "PUT",
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
+ buildApiUrl(`${API_ENDPOINTS.DECLINE_EVENT_PERFORMER_INVITE}/${inviteId}`),
44
+ {
45
+ method: "PUT",
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
+ buildApiUrl(`${API_ENDPOINTS.CANCEL_EVENT_PERFORMER_INVITE}/${inviteId}`),
74
+ {
75
+ method: "PUT",
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 response = await fetch(
105
+ buildApiUrl(`${API_ENDPOINTS.SEND_VENUE_MESSAGE}/${inviteId}`),
106
+ {
107
+ method: "POST",
108
+ headers: {
109
+ "Content-Type": "application/json",
110
+ Authorization: `Bearer ${token}`,
111
+ },
112
+ credentials: "include",
113
+ body: JSON.stringify({ message }),
114
+ }
115
+ );
116
+
117
+ if (response.ok) {
118
+ const text = await response.text();
119
+ let result = { message: "Email sent successfully" };
120
+ if (text) {
121
+ try {
122
+ result = JSON.parse(text);
123
+ } catch (e) {
124
+ // Empty response is fine
125
+ }
126
+ }
127
+ return { ok: true, result };
128
+ }
129
+ return { ok: false };
130
+ } catch (error) {
131
+ console.error("Error sending venue message:", error);
132
+ return { ok: false };
133
+ }
134
+ }
135
+
136
+ /**
137
+ * Get the ticketing event URL
138
+ * @param {string|number} venueId - The venue/event ID
139
+ * @returns {string}
140
+ */
141
+ export function getEventUrl(venueId) {
142
+ return `${API_BASE_URL}/ticketing/events/${venueId}`;
143
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getmicdrop/svelte-components",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Shared component library for Micdrop applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",