@venue-family/sdk 1.0.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.
- package/README.md +123 -0
- package/dist/client.d.ts +117 -0
- package/dist/client.js +231 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/types.d.ts +201 -0
- package/dist/types.js +2 -0
- package/dist/webhooks.d.ts +21 -0
- package/dist/webhooks.js +63 -0
- package/package.json +29 -0
- package/src/client.ts +275 -0
- package/src/index.ts +3 -0
- package/src/types.ts +218 -0
- package/src/webhooks.ts +102 -0
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# @venue-family/sdk
|
|
2
|
+
|
|
3
|
+
Official TypeScript & JavaScript SDK for [Venue Family](https://venuefamily.com) — schedules, ticketing, dynamic forms, digital signatures, user authentication, and dynamic iframe embeds.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @venue-family/sdk
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @venue-family/sdk
|
|
13
|
+
# or
|
|
14
|
+
yarn add @venue-family/sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### 1. User Authentication & Profile
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { VenueFamilyClient } from '@venue-family/sdk';
|
|
25
|
+
|
|
26
|
+
const venue = new VenueFamilyClient({
|
|
27
|
+
organization: 'the-418-project',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Login and obtain a session token
|
|
31
|
+
const { token, user } = await venue.auth.login('artist@example.com', 'mypassword');
|
|
32
|
+
|
|
33
|
+
// Initialize client with authenticated user token
|
|
34
|
+
const authClient = new VenueFamilyClient({ apiKey: token });
|
|
35
|
+
const me = await authClient.users.me();
|
|
36
|
+
console.log(`Logged in as ${me.name} (Staff: ${me.is_staff})`);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Events & Locations
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// Fetch upcoming dance & workshop events
|
|
43
|
+
const { data: events } = await venue.events.upcoming(['dance', 'workshop'], 'main-theater');
|
|
44
|
+
|
|
45
|
+
events.forEach((event) => {
|
|
46
|
+
console.log(event.title, event.cover_image_url);
|
|
47
|
+
event.upcoming_dates?.forEach((date) => {
|
|
48
|
+
console.log(`- ${date.date} at ${date.start_time} (${date.tickets_remaining} tickets left)`);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Form Submissions & Digital Signatures
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
// Submit a dynamic intake waiver
|
|
57
|
+
await venue.forms.submit('liability-waiver', {
|
|
58
|
+
full_name: 'Jane Doe',
|
|
59
|
+
emergency_phone: '831-555-0199',
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Check status of a signature request
|
|
63
|
+
const { data: signature } = await venue.signatures.find('sig_token_xyz');
|
|
64
|
+
console.log('Status:', signature.status); // 'pending', 'signed', 'countersigned'
|
|
65
|
+
|
|
66
|
+
// Sign with native drawn/base64 signature
|
|
67
|
+
if (signature.status === 'pending') {
|
|
68
|
+
await venue.signatures.signNative('sig_token_xyz', 'data:image/png;base64,...', 'Jane Doe');
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 4. Auto-Resizing Dynamic Iframe Embeds & Conversion Tracking
|
|
73
|
+
|
|
74
|
+
Venue Family embeds dynamically adapt their height via `postMessage`. Use the bundled helper in React, Vue, Svelte, or Vanilla JS:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { attachEmbedListener } from '@venue-family/sdk';
|
|
78
|
+
|
|
79
|
+
const unsubscribe = attachEmbedListener('venue-family-embed', {
|
|
80
|
+
onResize: (height) => {
|
|
81
|
+
console.log('Embed height updated:', height);
|
|
82
|
+
},
|
|
83
|
+
onTicketPurchase: (order) => {
|
|
84
|
+
console.log('Ticket Purchased!', order.orderNumber, order.total, order.eventName);
|
|
85
|
+
|
|
86
|
+
// Example: Trigger Google Ads or Meta Pixel conversion
|
|
87
|
+
if (typeof gtag === 'function') {
|
|
88
|
+
gtag('event', 'purchase', {
|
|
89
|
+
transaction_id: order.orderNumber,
|
|
90
|
+
value: order.total / 100,
|
|
91
|
+
currency: order.currency,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 5. Webhook Signature Verification (Node.js / Edge / Serverless)
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { verifyWebhookSignature } from '@venue-family/sdk';
|
|
102
|
+
|
|
103
|
+
export async function POST(request: Request) {
|
|
104
|
+
const payload = await request.text();
|
|
105
|
+
const signature = request.headers.get('x-vf-signature') || '';
|
|
106
|
+
const secret = process.env.VENUE_FAMILY_WEBHOOK_SECRET || '';
|
|
107
|
+
|
|
108
|
+
const isValid = await verifyWebhookSignature(payload, signature, secret);
|
|
109
|
+
|
|
110
|
+
if (!isValid) {
|
|
111
|
+
return new Response('Invalid signature', { status: 401 });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const event = JSON.parse(payload);
|
|
115
|
+
return Response.json({ received: true });
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT License.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { EventData, EventDateData, EventsFilterOptions, FormData, FormSignatureData, LocationData, LocationsFilterOptions, ReviewData, RoleData, UserData, VenueFamilyConfig, VolunteerRoleData } from './types.js';
|
|
2
|
+
export declare class VenueFamilyClient {
|
|
3
|
+
private readonly baseUrl;
|
|
4
|
+
private readonly apiKey?;
|
|
5
|
+
private readonly organization?;
|
|
6
|
+
private readonly customFetch;
|
|
7
|
+
constructor(config?: VenueFamilyConfig);
|
|
8
|
+
forOrganization(organization: string): VenueFamilyClient;
|
|
9
|
+
private getOrgSlug;
|
|
10
|
+
private request;
|
|
11
|
+
readonly auth: {
|
|
12
|
+
login: (email: string, password: string, organizationSlug?: string, deviceName?: string) => Promise<{
|
|
13
|
+
token: string;
|
|
14
|
+
user: UserData;
|
|
15
|
+
}>;
|
|
16
|
+
register: (userData: Record<string, unknown>) => Promise<{
|
|
17
|
+
token: string;
|
|
18
|
+
user: UserData;
|
|
19
|
+
}>;
|
|
20
|
+
user: () => Promise<UserData>;
|
|
21
|
+
updateProfile: (attributes: Partial<UserData>) => Promise<UserData>;
|
|
22
|
+
updatePassword: (currentPassword: string, password: string, passwordConfirmation: string) => Promise<{
|
|
23
|
+
message: string;
|
|
24
|
+
}>;
|
|
25
|
+
logout: () => Promise<{
|
|
26
|
+
message: string;
|
|
27
|
+
}>;
|
|
28
|
+
};
|
|
29
|
+
readonly users: {
|
|
30
|
+
me: () => Promise<UserData>;
|
|
31
|
+
updateProfile: (attributes: Partial<UserData>) => Promise<UserData>;
|
|
32
|
+
myVolunteerRoles: () => Promise<{
|
|
33
|
+
data: VolunteerRoleData[];
|
|
34
|
+
}>;
|
|
35
|
+
volunteerOpportunities: () => Promise<{
|
|
36
|
+
data: VolunteerRoleData[];
|
|
37
|
+
}>;
|
|
38
|
+
signUpForVolunteerRole: (roleId: number) => Promise<{
|
|
39
|
+
success: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
readonly roles: {
|
|
43
|
+
all: () => Promise<{
|
|
44
|
+
data: RoleData[];
|
|
45
|
+
}>;
|
|
46
|
+
find: (roleIdOrSlug: number | string) => Promise<{
|
|
47
|
+
data: RoleData;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
readonly signatures: {
|
|
51
|
+
find: (signingToken: string) => Promise<{
|
|
52
|
+
data: FormSignatureData;
|
|
53
|
+
}>;
|
|
54
|
+
signNative: (signingToken: string, signatureData: string, name: string, email?: string) => Promise<{
|
|
55
|
+
success: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
getSigningUrl: (signingToken: string) => string;
|
|
58
|
+
};
|
|
59
|
+
readonly events: {
|
|
60
|
+
all: (filters?: EventsFilterOptions) => Promise<{
|
|
61
|
+
data: EventData[];
|
|
62
|
+
}>;
|
|
63
|
+
upcoming: (tags?: string | string[], location?: string) => Promise<{
|
|
64
|
+
data: EventData[];
|
|
65
|
+
}>;
|
|
66
|
+
search: (queryTerm: string) => Promise<{
|
|
67
|
+
data: EventData[];
|
|
68
|
+
}>;
|
|
69
|
+
find: (eventIdOrSlug: number | string) => Promise<{
|
|
70
|
+
data: EventData;
|
|
71
|
+
}>;
|
|
72
|
+
dates: (eventIdOrSlug: number | string) => Promise<{
|
|
73
|
+
data: EventDateData[];
|
|
74
|
+
}>;
|
|
75
|
+
date: (eventDateId: number) => Promise<{
|
|
76
|
+
data: EventDateData;
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
readonly locations: {
|
|
80
|
+
all: (filters?: LocationsFilterOptions) => Promise<{
|
|
81
|
+
data: LocationData[];
|
|
82
|
+
}>;
|
|
83
|
+
find: (locationIdOrStub: number | string) => Promise<{
|
|
84
|
+
data: LocationData;
|
|
85
|
+
}>;
|
|
86
|
+
mapData: () => Promise<unknown>;
|
|
87
|
+
};
|
|
88
|
+
readonly forms: {
|
|
89
|
+
all: () => Promise<{
|
|
90
|
+
data: FormData[];
|
|
91
|
+
}>;
|
|
92
|
+
find: (formIdOrSlug: number | string) => Promise<{
|
|
93
|
+
data: FormData;
|
|
94
|
+
}>;
|
|
95
|
+
submit: (formIdOrSlug: number | string, data: Record<string, unknown>) => Promise<{
|
|
96
|
+
success: boolean;
|
|
97
|
+
submission_id?: number;
|
|
98
|
+
}>;
|
|
99
|
+
signature: (signingToken: string) => Promise<{
|
|
100
|
+
data: FormSignatureData;
|
|
101
|
+
}>;
|
|
102
|
+
sign: (signingToken: string, signatureData: string, name: string, email?: string) => Promise<{
|
|
103
|
+
success: boolean;
|
|
104
|
+
}>;
|
|
105
|
+
};
|
|
106
|
+
readonly reviews: {
|
|
107
|
+
all: () => Promise<{
|
|
108
|
+
data: ReviewData[];
|
|
109
|
+
}>;
|
|
110
|
+
create: (data: Record<string, unknown>) => Promise<{
|
|
111
|
+
data: ReviewData;
|
|
112
|
+
}>;
|
|
113
|
+
updateStatus: (reviewId: number, status: string) => Promise<{
|
|
114
|
+
success: boolean;
|
|
115
|
+
}>;
|
|
116
|
+
};
|
|
117
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VenueFamilyClient = void 0;
|
|
4
|
+
class VenueFamilyClient {
|
|
5
|
+
baseUrl;
|
|
6
|
+
apiKey;
|
|
7
|
+
organization;
|
|
8
|
+
customFetch;
|
|
9
|
+
constructor(config = {}) {
|
|
10
|
+
this.baseUrl = (config.baseUrl ?? 'https://venuefamily.com/api').replace(/\/+$/, '');
|
|
11
|
+
this.apiKey = config.apiKey;
|
|
12
|
+
this.organization = config.organization;
|
|
13
|
+
this.customFetch = config.fetch ?? fetch.bind(globalThis);
|
|
14
|
+
}
|
|
15
|
+
forOrganization(organization) {
|
|
16
|
+
return new VenueFamilyClient({
|
|
17
|
+
baseUrl: this.baseUrl,
|
|
18
|
+
apiKey: this.apiKey,
|
|
19
|
+
organization,
|
|
20
|
+
fetch: this.customFetch,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
getOrgSlug() {
|
|
24
|
+
if (!this.organization) {
|
|
25
|
+
throw new Error('Organization slug is required. Pass organization in config or use client.forOrganization("slug").');
|
|
26
|
+
}
|
|
27
|
+
return this.organization;
|
|
28
|
+
}
|
|
29
|
+
async request(path, options = {}) {
|
|
30
|
+
const url = `${this.baseUrl}/${path.replace(/^\/+/, '')}`;
|
|
31
|
+
const headers = {
|
|
32
|
+
Accept: 'application/json',
|
|
33
|
+
...(options.headers || {}),
|
|
34
|
+
};
|
|
35
|
+
if (this.apiKey) {
|
|
36
|
+
headers['Authorization'] = `Bearer ${this.apiKey}`;
|
|
37
|
+
headers['X-API-Key'] = this.apiKey;
|
|
38
|
+
}
|
|
39
|
+
const response = await this.customFetch(url, {
|
|
40
|
+
...options,
|
|
41
|
+
headers,
|
|
42
|
+
});
|
|
43
|
+
if (!response.ok) {
|
|
44
|
+
const errorBody = await response.text();
|
|
45
|
+
let parsed = null;
|
|
46
|
+
try {
|
|
47
|
+
parsed = JSON.parse(errorBody);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// use raw body
|
|
51
|
+
}
|
|
52
|
+
throw new Error(parsed?.message || parsed?.error || `Venue Family API Error: ${response.status} ${response.statusText}`);
|
|
53
|
+
}
|
|
54
|
+
return response.json();
|
|
55
|
+
}
|
|
56
|
+
// --- Auth & User Management ---
|
|
57
|
+
auth = {
|
|
58
|
+
login: async (email, password, organizationSlug, deviceName = 'TS SDK') => {
|
|
59
|
+
const body = { email, password, device_name: deviceName };
|
|
60
|
+
if (organizationSlug)
|
|
61
|
+
body.organization_slug = organizationSlug;
|
|
62
|
+
return this.request('auth/login', {
|
|
63
|
+
method: 'POST',
|
|
64
|
+
headers: { 'Content-Type': 'application/json' },
|
|
65
|
+
body: JSON.stringify(body),
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
register: async (userData) => {
|
|
69
|
+
return this.request('auth/register', {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
headers: { 'Content-Type': 'application/json' },
|
|
72
|
+
body: JSON.stringify(userData),
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
user: async () => {
|
|
76
|
+
const res = await this.request('auth/user');
|
|
77
|
+
return res.user;
|
|
78
|
+
},
|
|
79
|
+
updateProfile: async (attributes) => {
|
|
80
|
+
const res = await this.request('auth/profile', {
|
|
81
|
+
method: 'PUT',
|
|
82
|
+
headers: { 'Content-Type': 'application/json' },
|
|
83
|
+
body: JSON.stringify(attributes),
|
|
84
|
+
});
|
|
85
|
+
return res.user;
|
|
86
|
+
},
|
|
87
|
+
updatePassword: async (currentPassword, password, passwordConfirmation) => {
|
|
88
|
+
return this.request('auth/password', {
|
|
89
|
+
method: 'PUT',
|
|
90
|
+
headers: { 'Content-Type': 'application/json' },
|
|
91
|
+
body: JSON.stringify({
|
|
92
|
+
current_password: currentPassword,
|
|
93
|
+
password,
|
|
94
|
+
password_confirmation: passwordConfirmation,
|
|
95
|
+
}),
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
logout: async () => {
|
|
99
|
+
return this.request('auth/logout', { method: 'POST' });
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
users = {
|
|
103
|
+
me: async () => this.auth.user(),
|
|
104
|
+
updateProfile: async (attributes) => this.auth.updateProfile(attributes),
|
|
105
|
+
myVolunteerRoles: async () => this.request('volunteer-roles/my-roles'),
|
|
106
|
+
volunteerOpportunities: async () => this.request('volunteer-opportunities'),
|
|
107
|
+
signUpForVolunteerRole: async (roleId) => {
|
|
108
|
+
return this.request('volunteer-roles/sign-up', {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
headers: { 'Content-Type': 'application/json' },
|
|
111
|
+
body: JSON.stringify({ role_id: roleId }),
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
roles = {
|
|
116
|
+
all: async () => this.request('roles'),
|
|
117
|
+
find: async (roleIdOrSlug) => this.request(`roles/${roleIdOrSlug}`),
|
|
118
|
+
};
|
|
119
|
+
signatures = {
|
|
120
|
+
find: async (signingToken) => this.request(`signatures/${signingToken}`),
|
|
121
|
+
signNative: async (signingToken, signatureData, name, email) => {
|
|
122
|
+
return this.request(`signatures/${signingToken}/sign`, {
|
|
123
|
+
method: 'POST',
|
|
124
|
+
headers: { 'Content-Type': 'application/json' },
|
|
125
|
+
body: JSON.stringify({
|
|
126
|
+
signature_data: signatureData,
|
|
127
|
+
name,
|
|
128
|
+
email,
|
|
129
|
+
mechanism: 'native',
|
|
130
|
+
}),
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
getSigningUrl: (signingToken) => {
|
|
134
|
+
const rootUrl = this.baseUrl.replace(/\/api\/?$/, '');
|
|
135
|
+
return `${rootUrl}/forms/countersign/${signingToken}`;
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
// --- Events ---
|
|
139
|
+
events = {
|
|
140
|
+
all: async (filters = {}) => {
|
|
141
|
+
const params = new URLSearchParams();
|
|
142
|
+
for (const [k, v] of Object.entries(filters)) {
|
|
143
|
+
if (v !== undefined)
|
|
144
|
+
params.append(k, Array.isArray(v) ? v.join(',') : String(v));
|
|
145
|
+
}
|
|
146
|
+
const qs = params.toString() ? `?${params.toString()}` : '';
|
|
147
|
+
return this.request(`public/${this.getOrgSlug()}/events${qs}`);
|
|
148
|
+
},
|
|
149
|
+
upcoming: async (tags, location) => {
|
|
150
|
+
const filters = { filter: 'upcoming' };
|
|
151
|
+
if (tags)
|
|
152
|
+
filters.tags = tags;
|
|
153
|
+
if (location)
|
|
154
|
+
filters.location = location;
|
|
155
|
+
return this.events.all(filters);
|
|
156
|
+
},
|
|
157
|
+
search: async (queryTerm) => {
|
|
158
|
+
return this.request(`public/${this.getOrgSlug()}/events/search?q=${encodeURIComponent(queryTerm)}`);
|
|
159
|
+
},
|
|
160
|
+
find: async (eventIdOrSlug) => {
|
|
161
|
+
return this.request(`public/${this.getOrgSlug()}/events/${eventIdOrSlug}`);
|
|
162
|
+
},
|
|
163
|
+
dates: async (eventIdOrSlug) => {
|
|
164
|
+
return this.request(`public/${this.getOrgSlug()}/events/${eventIdOrSlug}/dates`);
|
|
165
|
+
},
|
|
166
|
+
date: async (eventDateId) => {
|
|
167
|
+
return this.request(`public/${this.getOrgSlug()}/eventDates/${eventDateId}`);
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
// --- Locations ---
|
|
171
|
+
locations = {
|
|
172
|
+
all: async (filters = {}) => {
|
|
173
|
+
const params = new URLSearchParams();
|
|
174
|
+
for (const [k, v] of Object.entries(filters)) {
|
|
175
|
+
if (v !== undefined)
|
|
176
|
+
params.append(k, Array.isArray(v) ? v.join(',') : String(v));
|
|
177
|
+
}
|
|
178
|
+
const qs = params.toString() ? `?${params.toString()}` : '';
|
|
179
|
+
return this.request(`public/${this.getOrgSlug()}/locations${qs}`);
|
|
180
|
+
},
|
|
181
|
+
find: async (locationIdOrStub) => {
|
|
182
|
+
return this.request(`public/${this.getOrgSlug()}/locations/${locationIdOrStub}`);
|
|
183
|
+
},
|
|
184
|
+
mapData: async () => {
|
|
185
|
+
return this.request(`public/${this.getOrgSlug()}/locations/map`);
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
// --- Forms ---
|
|
189
|
+
forms = {
|
|
190
|
+
all: async () => {
|
|
191
|
+
return this.request(`public/${this.getOrgSlug()}/forms`);
|
|
192
|
+
},
|
|
193
|
+
find: async (formIdOrSlug) => {
|
|
194
|
+
return this.request(`public/${this.getOrgSlug()}/forms/${formIdOrSlug}`);
|
|
195
|
+
},
|
|
196
|
+
submit: async (formIdOrSlug, data) => {
|
|
197
|
+
return this.request(`public/${this.getOrgSlug()}/forms/${formIdOrSlug}/submit`, {
|
|
198
|
+
method: 'POST',
|
|
199
|
+
headers: { 'Content-Type': 'application/json' },
|
|
200
|
+
body: JSON.stringify({ fields: data, data }),
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
signature: async (signingToken) => {
|
|
204
|
+
return this.signatures.find(signingToken);
|
|
205
|
+
},
|
|
206
|
+
sign: async (signingToken, signatureData, name, email) => {
|
|
207
|
+
return this.signatures.signNative(signingToken, signatureData, name, email);
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
// --- Reviews ---
|
|
211
|
+
reviews = {
|
|
212
|
+
all: async () => {
|
|
213
|
+
return this.request('reviews');
|
|
214
|
+
},
|
|
215
|
+
create: async (data) => {
|
|
216
|
+
return this.request('reviews', {
|
|
217
|
+
method: 'POST',
|
|
218
|
+
headers: { 'Content-Type': 'application/json' },
|
|
219
|
+
body: JSON.stringify(data),
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
updateStatus: async (reviewId, status) => {
|
|
223
|
+
return this.request(`reviews/${reviewId}/status`, {
|
|
224
|
+
method: 'PATCH',
|
|
225
|
+
headers: { 'Content-Type': 'application/json' },
|
|
226
|
+
body: JSON.stringify({ status }),
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
exports.VenueFamilyClient = VenueFamilyClient;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types.js"), exports);
|
|
18
|
+
__exportStar(require("./client.js"), exports);
|
|
19
|
+
__exportStar(require("./webhooks.js"), exports);
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
export interface VenueFamilyConfig {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
organization?: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
fetch?: typeof fetch;
|
|
6
|
+
}
|
|
7
|
+
export interface TagData {
|
|
8
|
+
id?: number;
|
|
9
|
+
name: string;
|
|
10
|
+
slug: string;
|
|
11
|
+
}
|
|
12
|
+
export interface LocationStub {
|
|
13
|
+
id: number;
|
|
14
|
+
name: string;
|
|
15
|
+
stub?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface UserOrganizationData {
|
|
18
|
+
id: number;
|
|
19
|
+
name: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
}
|
|
22
|
+
export interface UserData {
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
email: string;
|
|
26
|
+
first_name?: string;
|
|
27
|
+
last_name?: string;
|
|
28
|
+
chosen_name?: string;
|
|
29
|
+
artist_name?: string;
|
|
30
|
+
phone?: string;
|
|
31
|
+
bio?: string;
|
|
32
|
+
interests?: Array<{
|
|
33
|
+
id: number;
|
|
34
|
+
name: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
icon?: string;
|
|
37
|
+
}>;
|
|
38
|
+
organizations?: UserOrganizationData[];
|
|
39
|
+
is_staff?: boolean;
|
|
40
|
+
profile_photo_url?: string;
|
|
41
|
+
created_at?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface RoleData {
|
|
44
|
+
id: number;
|
|
45
|
+
name: string;
|
|
46
|
+
slug: string;
|
|
47
|
+
scope: 'all' | 'own';
|
|
48
|
+
abilities?: string[];
|
|
49
|
+
status?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface VolunteerRoleData {
|
|
52
|
+
id: number;
|
|
53
|
+
name: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
date?: string;
|
|
56
|
+
start_time?: string;
|
|
57
|
+
end_time?: string;
|
|
58
|
+
spots_needed?: number;
|
|
59
|
+
spots_filled?: number;
|
|
60
|
+
status?: string;
|
|
61
|
+
organization_slug?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface FormSignatureData {
|
|
64
|
+
id: number;
|
|
65
|
+
token: string;
|
|
66
|
+
status: 'pending' | 'signed' | 'countersigned' | 'cancelled' | 'expired';
|
|
67
|
+
mechanism: 'native' | 'certified';
|
|
68
|
+
name?: string;
|
|
69
|
+
email?: string;
|
|
70
|
+
signer_type?: string;
|
|
71
|
+
signed_at?: string;
|
|
72
|
+
signing_url?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface EventDateData {
|
|
75
|
+
id: number;
|
|
76
|
+
date: string;
|
|
77
|
+
start_time: string;
|
|
78
|
+
end_time?: string;
|
|
79
|
+
door_time?: string;
|
|
80
|
+
status: string;
|
|
81
|
+
is_sold_out: boolean;
|
|
82
|
+
tickets_remaining?: number;
|
|
83
|
+
locations?: LocationStub[];
|
|
84
|
+
}
|
|
85
|
+
export interface EventData {
|
|
86
|
+
id: number;
|
|
87
|
+
title: string;
|
|
88
|
+
slug: string;
|
|
89
|
+
subtitle?: string;
|
|
90
|
+
summary?: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
type?: string;
|
|
93
|
+
status?: string;
|
|
94
|
+
cover_image_url?: string;
|
|
95
|
+
ticket_price?: string;
|
|
96
|
+
tags?: TagData[];
|
|
97
|
+
locations?: LocationStub[];
|
|
98
|
+
upcoming_dates?: EventDateData[];
|
|
99
|
+
}
|
|
100
|
+
export interface SpaceData {
|
|
101
|
+
id: number;
|
|
102
|
+
name: string;
|
|
103
|
+
stub?: string;
|
|
104
|
+
capacity?: number;
|
|
105
|
+
price_per_hour?: string;
|
|
106
|
+
}
|
|
107
|
+
export interface LocationData {
|
|
108
|
+
id: number;
|
|
109
|
+
name: string;
|
|
110
|
+
stub?: string;
|
|
111
|
+
capacity?: number;
|
|
112
|
+
price_per_hour?: string;
|
|
113
|
+
address?: string;
|
|
114
|
+
city?: string;
|
|
115
|
+
state?: string;
|
|
116
|
+
zip?: string;
|
|
117
|
+
spaces?: SpaceData[];
|
|
118
|
+
features?: string[];
|
|
119
|
+
}
|
|
120
|
+
export interface FormFieldData {
|
|
121
|
+
id: string;
|
|
122
|
+
type: string;
|
|
123
|
+
label: string;
|
|
124
|
+
required?: boolean;
|
|
125
|
+
options?: string[];
|
|
126
|
+
placeholder?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface FormData {
|
|
129
|
+
id: number;
|
|
130
|
+
title: string;
|
|
131
|
+
slug: string;
|
|
132
|
+
description?: string;
|
|
133
|
+
fields: FormFieldData[];
|
|
134
|
+
}
|
|
135
|
+
export interface ReviewData {
|
|
136
|
+
id: number;
|
|
137
|
+
rating?: number;
|
|
138
|
+
author_name?: string;
|
|
139
|
+
author_email?: string;
|
|
140
|
+
content?: string;
|
|
141
|
+
status?: string;
|
|
142
|
+
created_at?: string;
|
|
143
|
+
}
|
|
144
|
+
export interface EventsFilterOptions {
|
|
145
|
+
filter?: 'upcoming' | 'past' | 'recurring' | 'all';
|
|
146
|
+
start_date?: string;
|
|
147
|
+
end_date?: string;
|
|
148
|
+
location?: string;
|
|
149
|
+
type?: string;
|
|
150
|
+
tags?: string | string[];
|
|
151
|
+
search?: string;
|
|
152
|
+
q?: string;
|
|
153
|
+
limit?: number;
|
|
154
|
+
per_page?: number;
|
|
155
|
+
page?: number;
|
|
156
|
+
}
|
|
157
|
+
export interface LocationsFilterOptions {
|
|
158
|
+
city?: string;
|
|
159
|
+
state?: string;
|
|
160
|
+
capacity_min?: number;
|
|
161
|
+
capacity_max?: number;
|
|
162
|
+
price_min?: number;
|
|
163
|
+
price_max?: number;
|
|
164
|
+
features?: string | string[];
|
|
165
|
+
search?: string;
|
|
166
|
+
sort_by?: 'name' | 'capacity' | 'price_per_hour' | 'created_at';
|
|
167
|
+
sort_order?: 'asc' | 'desc';
|
|
168
|
+
}
|
|
169
|
+
export interface ResizeEmbedEvent {
|
|
170
|
+
type: 'resize';
|
|
171
|
+
height: number;
|
|
172
|
+
}
|
|
173
|
+
export interface ScrollIntoViewEmbedEvent {
|
|
174
|
+
type: 'scroll-into-view';
|
|
175
|
+
top: number;
|
|
176
|
+
}
|
|
177
|
+
export interface TicketPurchaseCompleteEmbedEvent {
|
|
178
|
+
type: 'ticket-purchase-complete';
|
|
179
|
+
orderNumber: string;
|
|
180
|
+
orderId: number;
|
|
181
|
+
status: string;
|
|
182
|
+
total: number;
|
|
183
|
+
quantity: number;
|
|
184
|
+
currency: string;
|
|
185
|
+
eventId: number;
|
|
186
|
+
eventName: string;
|
|
187
|
+
}
|
|
188
|
+
export interface FormSubmittedEmbedEvent {
|
|
189
|
+
type: 'form-submitted';
|
|
190
|
+
slug: string;
|
|
191
|
+
formId: number;
|
|
192
|
+
submissionId: number;
|
|
193
|
+
}
|
|
194
|
+
export type VenueFamilyEmbedEvent = ResizeEmbedEvent | ScrollIntoViewEmbedEvent | TicketPurchaseCompleteEmbedEvent | FormSubmittedEmbedEvent | {
|
|
195
|
+
type: 'scroll-to-error';
|
|
196
|
+
} | {
|
|
197
|
+
type: 'signin_success';
|
|
198
|
+
event?: unknown;
|
|
199
|
+
organization?: unknown;
|
|
200
|
+
eventDate?: unknown;
|
|
201
|
+
};
|
package/dist/types.js
ADDED