@foxscheduling/sdk 0.1.1 → 0.2.2
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 +111 -2
- package/dist/cjs/index.cjs +3 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/resources/index.cjs +67 -16
- package/dist/cjs/resources/index.d.ts +34 -30
- package/dist/cjs/resources/index.d.ts.map +1 -1
- package/dist/cjs/types.cjs +9 -1
- package/dist/cjs/types.d.ts +96 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/resources/index.d.ts +34 -30
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +67 -16
- package/dist/types.d.ts +96 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +7 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -69,7 +69,116 @@ After creating a client, use:
|
|
|
69
69
|
- `fox.customers` — customers
|
|
70
70
|
- `fox.webhooks` — webhook subscriptions
|
|
71
71
|
|
|
72
|
-
All methods
|
|
72
|
+
All methods are fully typed (no `unknown` inputs or outputs) and throw a
|
|
73
|
+
`FoxSchedulingError` on API errors.
|
|
74
|
+
|
|
75
|
+
### Lists are paginated (max 100 per page)
|
|
76
|
+
|
|
77
|
+
Pagination is enforced by the API — every `list()` method sends `limit`/`offset`
|
|
78
|
+
to the server and returns a typed `Page<T>`, never a raw array:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
interface Page<T> {
|
|
82
|
+
items: T[]; // at most 100
|
|
83
|
+
total: number; // total across all pages
|
|
84
|
+
limit: number; // effective page size
|
|
85
|
+
offset: number; // current offset
|
|
86
|
+
hasMore: boolean; // true if more items exist
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Pass `limit` (1–100, default 100) and `offset` to page through results:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
const first = await fox.customers.list({ limit: 50, offset: 0 });
|
|
94
|
+
console.log(first.items.length, first.total, first.hasMore);
|
|
95
|
+
|
|
96
|
+
if (first.hasMore) {
|
|
97
|
+
const next = await fox.customers.list({ limit: 50, offset: 50 });
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`limit` is clamped to a maximum of 100.
|
|
102
|
+
|
|
103
|
+
### Bookings require a month
|
|
104
|
+
|
|
105
|
+
`fox.bookings.list()` **requires** a `month` (format `YYYY-MM`) so responses stay
|
|
106
|
+
small. Other filters are optional and typed:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const page = await fox.bookings.list({
|
|
110
|
+
month: "2026-06", // required
|
|
111
|
+
status: "booked", // optional, typed union
|
|
112
|
+
serviceId: "…", // optional
|
|
113
|
+
limit: 100, // optional
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Omitting or malformatting `month` throws a `FoxSchedulingError` before any
|
|
118
|
+
request is sent.
|
|
119
|
+
|
|
120
|
+
### Typed create & update
|
|
121
|
+
|
|
122
|
+
Create and update bodies are typed — for example:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
// Create a customer
|
|
126
|
+
const customer = await fox.customers.create({
|
|
127
|
+
name: "Jane Doe",
|
|
128
|
+
email: "jane@example.com",
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Create a booking
|
|
132
|
+
const result = await fox.bookings.create({
|
|
133
|
+
serviceId: "…",
|
|
134
|
+
name: "Jane Doe",
|
|
135
|
+
email: "jane@example.com",
|
|
136
|
+
slots: [{ date: "2026-06-12", start: "09:00", end: "09:30" }],
|
|
137
|
+
});
|
|
138
|
+
console.log(result.bookingSummary, result.customerId);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Get booking embed code
|
|
142
|
+
|
|
143
|
+
`fox.business.getEmbedCode()` returns ready-to-paste embed snippets for the
|
|
144
|
+
connected business: an inline `iframe`, a popup `<script>` widget, and the raw
|
|
145
|
+
`bookingUrl`. All options are optional and typed:
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
const embed = await fox.business.getEmbedCode({
|
|
149
|
+
theme: "dark", // "light" | "dark" | "auto" (default)
|
|
150
|
+
servicePath: "haircut", // optional: link straight to one service
|
|
151
|
+
hidePageDetails: false, // hide business header inside the embed
|
|
152
|
+
heightPx: 760, // inline iframe height
|
|
153
|
+
iframeBorderRadius: "medium", // none | sm | medium | lg | xl | 2xl
|
|
154
|
+
openMode: "popup", // "popup" | "newTab" for the script widget
|
|
155
|
+
buttonText: "Book now", // popup button label
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
console.log(embed.bookingUrl); // shareable URL
|
|
159
|
+
console.log(embed.iframe); // <style>…</style><div>…<iframe …></div>
|
|
160
|
+
console.log(embed.popupScript); // <script … data-booking-url="…"></script>
|
|
161
|
+
console.log(embed.appliedOptions); // options after defaults applied
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
By default the popup widget renders its own button. To open the popup from a
|
|
165
|
+
button that already exists on your page, set `buttonMode: "existing"` and pass
|
|
166
|
+
the element's `id` (without `#`) as `triggerId`:
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
// For an element like <button id="book-appointment">Book</button>
|
|
170
|
+
const embed = await fox.business.getEmbedCode({
|
|
171
|
+
buttonMode: "existing",
|
|
172
|
+
triggerId: "book-appointment",
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// embed.popupScript now wires the popup to your element instead of injecting a button.
|
|
176
|
+
// embed.appliedOptions.buttonMode === "existing"
|
|
177
|
+
// embed.appliedOptions.triggerId === "book-appointment"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
An invalid or missing `triggerId` while `buttonMode` is `"existing"` is rejected
|
|
181
|
+
by the API.
|
|
73
182
|
|
|
74
183
|
---
|
|
75
184
|
|
|
@@ -165,7 +274,7 @@ Once `exchangeCode` succeeds, the SDK stores tokens and attaches them to every r
|
|
|
165
274
|
|
|
166
275
|
```typescript
|
|
167
276
|
const business = await fox.business.get();
|
|
168
|
-
const bookings = await fox.bookings.list();
|
|
277
|
+
const bookings = await fox.bookings.list({ month: "2026-06" });
|
|
169
278
|
```
|
|
170
279
|
|
|
171
280
|
The SDK refreshes access tokens automatically before they expire.
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_BASE_URL = exports.verifyFoxWebhookSignature = exports.generateState = exports.generateCodeChallengeS256 = exports.generateCodeVerifier = exports.FileTokenStore = exports.MemoryTokenStore = exports.isFoxSchedulingError = exports.FoxSchedulingError = exports.FoxScheduling = void 0;
|
|
3
|
+
exports.isValidMonth = exports.MAX_PAGE_SIZE = exports.DEFAULT_BASE_URL = exports.verifyFoxWebhookSignature = exports.generateState = exports.generateCodeChallengeS256 = exports.generateCodeVerifier = exports.FileTokenStore = exports.MemoryTokenStore = exports.isFoxSchedulingError = exports.FoxSchedulingError = exports.FoxScheduling = void 0;
|
|
4
4
|
var client_js_1 = require("./client.cjs");
|
|
5
5
|
Object.defineProperty(exports, "FoxScheduling", { enumerable: true, get: function () { return client_js_1.FoxScheduling; } });
|
|
6
6
|
var errors_js_1 = require("./errors.cjs");
|
|
@@ -17,3 +17,5 @@ var verify_js_1 = require("./webhooks/verify.cjs");
|
|
|
17
17
|
Object.defineProperty(exports, "verifyFoxWebhookSignature", { enumerable: true, get: function () { return verify_js_1.verifyFoxWebhookSignature; } });
|
|
18
18
|
var types_js_1 = require("./types.cjs");
|
|
19
19
|
Object.defineProperty(exports, "DEFAULT_BASE_URL", { enumerable: true, get: function () { return types_js_1.DEFAULT_BASE_URL; } });
|
|
20
|
+
Object.defineProperty(exports, "MAX_PAGE_SIZE", { enumerable: true, get: function () { return types_js_1.MAX_PAGE_SIZE; } });
|
|
21
|
+
Object.defineProperty(exports, "isValidMonth", { enumerable: true, get: function () { return types_js_1.isValidMonth; } });
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export { FoxSchedulingError, isFoxSchedulingError } from "./errors.js";
|
|
|
3
3
|
export { MemoryTokenStore, FileTokenStore, type TokenStore, } from "./auth/tokenStore.js";
|
|
4
4
|
export { generateCodeVerifier, generateCodeChallengeS256, generateState, } from "./auth/pkce.js";
|
|
5
5
|
export { verifyFoxWebhookSignature } from "./webhooks/verify.js";
|
|
6
|
-
export
|
|
6
|
+
export type { WebhookSubscriptionPublic, CreateWebhookResult, } from "./resources/index.js";
|
|
7
|
+
export { DEFAULT_BASE_URL, MAX_PAGE_SIZE, isValidMonth, type FoxSchedulingConfig, type FoxSchedulingAuth, type FoxSchedulingApiKeyAuth, type FoxSchedulingOAuthAuth, type TokenSet, type AuthorizationUrlResult, type ListQuery, type Page, type BookingStatus, type BookingListQuery, type CreateAvailabilityInput, type UpdateAvailabilityInput, type BookingSlotInput, type CreateBookingInput, type BookingCreatedResult, type CreateCustomerInput, type UpdateCustomerInput, type CreateWebhookInput, type UpdateWebhookInput, type PartnerEmbedOptions, type PartnerEmbedCodeDto, type PartnerEmbedTheme, type PartnerEmbedOpenMode, type PartnerEmbedButtonMode, } from "./types.js";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,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AAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,YAAY,CAAC"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WebhooksResource = exports.CustomersResource = exports.BookingsResource = exports.AvailabilityResource = exports.StaffResource = exports.ServicesResource = exports.BusinessResource = void 0;
|
|
4
|
+
const types_js_1 = require("../types.js");
|
|
5
|
+
const errors_js_1 = require("../errors.js");
|
|
6
|
+
/** Convert pagination options to string query params. */
|
|
7
|
+
function pageQuery(query) {
|
|
8
|
+
return {
|
|
9
|
+
limit: query?.limit != null ? String(query.limit) : undefined,
|
|
10
|
+
offset: query?.offset != null ? String(query.offset) : undefined,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
4
13
|
class BusinessResource {
|
|
5
14
|
http;
|
|
6
15
|
constructor(http) {
|
|
@@ -9,6 +18,29 @@ class BusinessResource {
|
|
|
9
18
|
get() {
|
|
10
19
|
return this.http.get("/partner/business");
|
|
11
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Get booking embed code (inline iframe + popup script + raw URL) for this
|
|
23
|
+
* business, with optional theming and button styling.
|
|
24
|
+
*/
|
|
25
|
+
getEmbedCode(options = {}) {
|
|
26
|
+
return this.http.get("/partner/business/embed", {
|
|
27
|
+
servicePath: options.servicePath,
|
|
28
|
+
theme: options.theme,
|
|
29
|
+
hidePageDetails: options.hidePageDetails != null ? String(options.hidePageDetails) : undefined,
|
|
30
|
+
showThemeToggle: options.showThemeToggle != null ? String(options.showThemeToggle) : undefined,
|
|
31
|
+
heightPx: options.heightPx != null ? String(options.heightPx) : undefined,
|
|
32
|
+
iframeBorderRadius: options.iframeBorderRadius,
|
|
33
|
+
openMode: options.openMode,
|
|
34
|
+
buttonMode: options.buttonMode,
|
|
35
|
+
triggerId: options.triggerId,
|
|
36
|
+
buttonText: options.buttonText,
|
|
37
|
+
buttonBackgroundColor: options.buttonBackgroundColor,
|
|
38
|
+
buttonTextColor: options.buttonTextColor,
|
|
39
|
+
buttonBorderRadiusPx: options.buttonBorderRadiusPx != null
|
|
40
|
+
? String(options.buttonBorderRadiusPx)
|
|
41
|
+
: undefined,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
12
44
|
}
|
|
13
45
|
exports.BusinessResource = BusinessResource;
|
|
14
46
|
class ServicesResource {
|
|
@@ -16,8 +48,8 @@ class ServicesResource {
|
|
|
16
48
|
constructor(http) {
|
|
17
49
|
this.http = http;
|
|
18
50
|
}
|
|
19
|
-
list() {
|
|
20
|
-
return this.http.get("/partner/services");
|
|
51
|
+
list(query) {
|
|
52
|
+
return this.http.get("/partner/services", pageQuery(query));
|
|
21
53
|
}
|
|
22
54
|
get(id) {
|
|
23
55
|
return this.http.get(`/partner/services/${id}`);
|
|
@@ -29,8 +61,8 @@ class StaffResource {
|
|
|
29
61
|
constructor(http) {
|
|
30
62
|
this.http = http;
|
|
31
63
|
}
|
|
32
|
-
list() {
|
|
33
|
-
return this.http.get("/partner/staff");
|
|
64
|
+
list(query) {
|
|
65
|
+
return this.http.get("/partner/staff", pageQuery(query));
|
|
34
66
|
}
|
|
35
67
|
get(id) {
|
|
36
68
|
return this.http.get(`/partner/staff/${id}`);
|
|
@@ -42,8 +74,8 @@ class AvailabilityResource {
|
|
|
42
74
|
constructor(http) {
|
|
43
75
|
this.http = http;
|
|
44
76
|
}
|
|
45
|
-
list() {
|
|
46
|
-
return this.http.get("/partner/availability");
|
|
77
|
+
list(query) {
|
|
78
|
+
return this.http.get("/partner/availability", pageQuery(query));
|
|
47
79
|
}
|
|
48
80
|
get(id) {
|
|
49
81
|
return this.http.get(`/partner/availability/${id}`);
|
|
@@ -64,19 +96,38 @@ class BookingsResource {
|
|
|
64
96
|
constructor(http) {
|
|
65
97
|
this.http = http;
|
|
66
98
|
}
|
|
67
|
-
|
|
68
|
-
|
|
99
|
+
/**
|
|
100
|
+
* List bookings for a single month.
|
|
101
|
+
*
|
|
102
|
+
* `query.month` is required (format `YYYY-MM`, e.g. "2026-06") to keep the
|
|
103
|
+
* response small.
|
|
104
|
+
*/
|
|
105
|
+
async list(query) {
|
|
106
|
+
if (!query || !query.month) {
|
|
107
|
+
throw new errors_js_1.FoxSchedulingError("MONTH_REQUIRED", 'bookings.list requires a "month" in YYYY-MM format, e.g. "2026-06".');
|
|
108
|
+
}
|
|
109
|
+
if (!(0, types_js_1.isValidMonth)(query.month)) {
|
|
110
|
+
throw new errors_js_1.FoxSchedulingError("INVALID_MONTH", `Invalid month "${query.month}". Expected YYYY-MM, e.g. "2026-06".`);
|
|
111
|
+
}
|
|
112
|
+
return this.http.get("/partner/bookings", {
|
|
113
|
+
yearMonth: query.month,
|
|
114
|
+
serviceId: query.serviceId,
|
|
115
|
+
providerId: query.providerId,
|
|
116
|
+
status: query.status,
|
|
117
|
+
search: query.search,
|
|
118
|
+
...pageQuery(query),
|
|
119
|
+
});
|
|
69
120
|
}
|
|
70
121
|
get(id, serviceId) {
|
|
71
|
-
return this.http.get(`/partner/bookings/${id}`, {
|
|
122
|
+
return this.http.get(`/partner/bookings/${id}`, {
|
|
123
|
+
serviceId,
|
|
124
|
+
});
|
|
72
125
|
}
|
|
73
126
|
create(body) {
|
|
74
127
|
return this.http.post("/partner/bookings", body);
|
|
75
128
|
}
|
|
76
129
|
cancel(id, serviceId) {
|
|
77
|
-
return this.http.post(`/partner/bookings/${id}/cancel`, undefined, {
|
|
78
|
-
serviceId,
|
|
79
|
-
});
|
|
130
|
+
return this.http.post(`/partner/bookings/${id}/cancel`, undefined, { serviceId });
|
|
80
131
|
}
|
|
81
132
|
}
|
|
82
133
|
exports.BookingsResource = BookingsResource;
|
|
@@ -85,8 +136,8 @@ class CustomersResource {
|
|
|
85
136
|
constructor(http) {
|
|
86
137
|
this.http = http;
|
|
87
138
|
}
|
|
88
|
-
list() {
|
|
89
|
-
return this.http.get("/partner/customers");
|
|
139
|
+
list(query) {
|
|
140
|
+
return this.http.get("/partner/customers", pageQuery(query));
|
|
90
141
|
}
|
|
91
142
|
get(id) {
|
|
92
143
|
return this.http.get(`/partner/customers/${id}`);
|
|
@@ -104,8 +155,8 @@ class WebhooksResource {
|
|
|
104
155
|
constructor(http) {
|
|
105
156
|
this.http = http;
|
|
106
157
|
}
|
|
107
|
-
list() {
|
|
108
|
-
return this.http.get("/partner/webhooks");
|
|
158
|
+
list(query) {
|
|
159
|
+
return this.http.get("/partner/webhooks", pageQuery(query));
|
|
109
160
|
}
|
|
110
161
|
create(body) {
|
|
111
162
|
return this.http.post("/partner/webhooks", body);
|
|
@@ -1,49 +1,58 @@
|
|
|
1
|
-
import type { BusinessProfileDto, PartnerBookingDto, PartnerCustomerDto, PartnerServiceDto, PartnerStaffDto, PartnerWebhookEvent } from "@foxscheduling/shared";
|
|
1
|
+
import type { Availability, BusinessProfileDto, PartnerBookingDto, PartnerCustomerDto, PartnerEmbedCodeDto, PartnerEmbedOptions, PartnerServiceDto, PartnerStaffDto, PartnerWebhookEvent } from "@foxscheduling/shared";
|
|
2
2
|
import type { HttpClient } from "../http/client.js";
|
|
3
|
+
import { type BookingCreatedResult, type BookingListQuery, type CreateAvailabilityInput, type CreateBookingInput, type CreateCustomerInput, type CreateWebhookInput, type ListQuery, type Page, type UpdateAvailabilityInput, type UpdateCustomerInput, type UpdateWebhookInput } from "../types.js";
|
|
3
4
|
export declare class BusinessResource {
|
|
4
5
|
private readonly http;
|
|
5
6
|
constructor(http: HttpClient);
|
|
6
7
|
get(): Promise<BusinessProfileDto>;
|
|
8
|
+
/**
|
|
9
|
+
* Get booking embed code (inline iframe + popup script + raw URL) for this
|
|
10
|
+
* business, with optional theming and button styling.
|
|
11
|
+
*/
|
|
12
|
+
getEmbedCode(options?: PartnerEmbedOptions): Promise<PartnerEmbedCodeDto>;
|
|
7
13
|
}
|
|
8
14
|
export declare class ServicesResource {
|
|
9
15
|
private readonly http;
|
|
10
16
|
constructor(http: HttpClient);
|
|
11
|
-
list(): Promise<PartnerServiceDto
|
|
17
|
+
list(query?: ListQuery): Promise<Page<PartnerServiceDto>>;
|
|
12
18
|
get(id: string): Promise<PartnerServiceDto>;
|
|
13
19
|
}
|
|
14
20
|
export declare class StaffResource {
|
|
15
21
|
private readonly http;
|
|
16
22
|
constructor(http: HttpClient);
|
|
17
|
-
list(): Promise<PartnerStaffDto
|
|
23
|
+
list(query?: ListQuery): Promise<Page<PartnerStaffDto>>;
|
|
18
24
|
get(id: string): Promise<PartnerStaffDto>;
|
|
19
25
|
}
|
|
20
26
|
export declare class AvailabilityResource {
|
|
21
27
|
private readonly http;
|
|
22
28
|
constructor(http: HttpClient);
|
|
23
|
-
list(): Promise<
|
|
24
|
-
get(id: string): Promise<
|
|
25
|
-
create(body:
|
|
26
|
-
update(id: string, body:
|
|
27
|
-
delete(id: string): Promise<
|
|
29
|
+
list(query?: ListQuery): Promise<Page<Availability>>;
|
|
30
|
+
get(id: string): Promise<Availability>;
|
|
31
|
+
create(body: CreateAvailabilityInput): Promise<Availability>;
|
|
32
|
+
update(id: string, body: UpdateAvailabilityInput): Promise<Availability>;
|
|
33
|
+
delete(id: string): Promise<boolean>;
|
|
28
34
|
}
|
|
29
35
|
export declare class BookingsResource {
|
|
30
36
|
private readonly http;
|
|
31
37
|
constructor(http: HttpClient);
|
|
32
|
-
|
|
38
|
+
/**
|
|
39
|
+
* List bookings for a single month.
|
|
40
|
+
*
|
|
41
|
+
* `query.month` is required (format `YYYY-MM`, e.g. "2026-06") to keep the
|
|
42
|
+
* response small.
|
|
43
|
+
*/
|
|
44
|
+
list(query: BookingListQuery): Promise<Page<PartnerBookingDto>>;
|
|
33
45
|
get(id: string, serviceId: string): Promise<PartnerBookingDto>;
|
|
34
|
-
create(body:
|
|
35
|
-
cancel(id: string, serviceId: string): Promise<
|
|
46
|
+
create(body: CreateBookingInput): Promise<BookingCreatedResult>;
|
|
47
|
+
cancel(id: string, serviceId: string): Promise<PartnerBookingDto>;
|
|
36
48
|
}
|
|
37
49
|
export declare class CustomersResource {
|
|
38
50
|
private readonly http;
|
|
39
51
|
constructor(http: HttpClient);
|
|
40
|
-
list(): Promise<PartnerCustomerDto
|
|
52
|
+
list(query?: ListQuery): Promise<Page<PartnerCustomerDto>>;
|
|
41
53
|
get(id: string): Promise<PartnerCustomerDto>;
|
|
42
|
-
create(body:
|
|
43
|
-
|
|
44
|
-
email: string;
|
|
45
|
-
}): Promise<PartnerCustomerDto>;
|
|
46
|
-
update(id: string, body: unknown): Promise<PartnerCustomerDto>;
|
|
54
|
+
create(body: CreateCustomerInput): Promise<PartnerCustomerDto>;
|
|
55
|
+
update(id: string, body: UpdateCustomerInput): Promise<PartnerCustomerDto>;
|
|
47
56
|
}
|
|
48
57
|
export interface WebhookSubscriptionPublic {
|
|
49
58
|
id: string;
|
|
@@ -51,21 +60,16 @@ export interface WebhookSubscriptionPublic {
|
|
|
51
60
|
events: PartnerWebhookEvent[];
|
|
52
61
|
creationDate?: string;
|
|
53
62
|
}
|
|
63
|
+
export interface CreateWebhookResult {
|
|
64
|
+
subscription: WebhookSubscriptionPublic;
|
|
65
|
+
secret: string;
|
|
66
|
+
}
|
|
54
67
|
export declare class WebhooksResource {
|
|
55
68
|
private readonly http;
|
|
56
69
|
constructor(http: HttpClient);
|
|
57
|
-
list(): Promise<WebhookSubscriptionPublic
|
|
58
|
-
create(body:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}): Promise<{
|
|
62
|
-
subscription: WebhookSubscriptionPublic;
|
|
63
|
-
secret: string;
|
|
64
|
-
}>;
|
|
65
|
-
update(id: string, body: Partial<{
|
|
66
|
-
url: string;
|
|
67
|
-
events: PartnerWebhookEvent[];
|
|
68
|
-
}>): Promise<WebhookSubscriptionPublic>;
|
|
69
|
-
delete(id: string): Promise<unknown>;
|
|
70
|
+
list(query?: ListQuery): Promise<Page<WebhookSubscriptionPublic>>;
|
|
71
|
+
create(body: CreateWebhookInput): Promise<CreateWebhookResult>;
|
|
72
|
+
update(id: string, body: UpdateWebhookInput): Promise<WebhookSubscriptionPublic>;
|
|
73
|
+
delete(id: string): Promise<boolean>;
|
|
70
74
|
}
|
|
71
75
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAWrB,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,GAAG,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIlC;;;OAGG;IACH,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAsB9E;AAED,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IA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C;CAGrC"}
|
package/dist/cjs/types.cjs
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_BASE_URL = void 0;
|
|
3
|
+
exports.MAX_PAGE_SIZE = exports.DEFAULT_BASE_URL = void 0;
|
|
4
|
+
exports.isValidMonth = isValidMonth;
|
|
5
|
+
const shared_1 = require("@foxscheduling/shared");
|
|
4
6
|
exports.DEFAULT_BASE_URL = "https://foxscheduling.com/api/v1";
|
|
7
|
+
/** Maximum number of items returned in a single page (enforced by the API). */
|
|
8
|
+
exports.MAX_PAGE_SIZE = shared_1.PARTNER_MAX_PAGE_SIZE;
|
|
9
|
+
/** True when `value` matches the `YYYY-MM` format (e.g. "2026-06"). */
|
|
10
|
+
function isValidMonth(value) {
|
|
11
|
+
return (0, shared_1.isValidYearMonth)(value);
|
|
12
|
+
}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,4 +1,100 @@
|
|
|
1
|
+
import type { Availability, Booking, BookingSummary, PartnerPage, PartnerWebhookEvent } from "@foxscheduling/shared";
|
|
1
2
|
export declare const DEFAULT_BASE_URL = "https://foxscheduling.com/api/v1";
|
|
3
|
+
/** Maximum number of items returned in a single page (enforced by the API). */
|
|
4
|
+
export declare const MAX_PAGE_SIZE = 100;
|
|
5
|
+
/** Pagination options accepted by every list endpoint. */
|
|
6
|
+
export interface ListQuery {
|
|
7
|
+
/** Items per page (1–{@link MAX_PAGE_SIZE}). The API clamps higher values. */
|
|
8
|
+
limit?: number;
|
|
9
|
+
/** Number of items to skip from the start. Defaults to 0. */
|
|
10
|
+
offset?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A single page of results, returned by every `list()` method.
|
|
14
|
+
*
|
|
15
|
+
* Re-exported from `@foxscheduling/shared` as `PartnerPage<T>`.
|
|
16
|
+
*/
|
|
17
|
+
export type Page<T> = PartnerPage<T>;
|
|
18
|
+
/** Re-export the embed options/result types for SDK consumers. */
|
|
19
|
+
export type { PartnerEmbedOptions, PartnerEmbedCodeDto, PartnerEmbedTheme, PartnerEmbedOpenMode, PartnerEmbedButtonMode, } from "@foxscheduling/shared";
|
|
20
|
+
/** Booking status values returned by the Partner API. */
|
|
21
|
+
export type BookingStatus = Booking["status"];
|
|
22
|
+
/**
|
|
23
|
+
* Query for {@link BookingsResource.list}.
|
|
24
|
+
*
|
|
25
|
+
* `month` is required to keep responses small — the API would otherwise return
|
|
26
|
+
* every booking for the business.
|
|
27
|
+
*/
|
|
28
|
+
export interface BookingListQuery extends ListQuery {
|
|
29
|
+
/** Required calendar month to fetch, format `YYYY-MM` (e.g. "2026-06"). */
|
|
30
|
+
month: string;
|
|
31
|
+
/** Restrict to a single service (UUID v4). */
|
|
32
|
+
serviceId?: string;
|
|
33
|
+
/** Restrict to a single staff/provider (UUID). */
|
|
34
|
+
providerId?: string;
|
|
35
|
+
/** Restrict to a booking status. */
|
|
36
|
+
status?: BookingStatus;
|
|
37
|
+
/** Case-insensitive search over customer name, email, or slug. */
|
|
38
|
+
search?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Body for {@link AvailabilityResource.create}. */
|
|
41
|
+
export type CreateAvailabilityInput = Omit<Availability, "id" | "ttl" | "sortKey" | "updatedOn" | "creationDate" | "schemaVersion" | "recordType" | "tenantId">;
|
|
42
|
+
/** Body for {@link AvailabilityResource.update}. */
|
|
43
|
+
export type UpdateAvailabilityInput = Partial<CreateAvailabilityInput>;
|
|
44
|
+
/** A slot to book within {@link CreateBookingInput}. */
|
|
45
|
+
export interface BookingSlotInput {
|
|
46
|
+
/** Date in `YYYY-MM-DD`. */
|
|
47
|
+
date: string;
|
|
48
|
+
/** Start time, e.g. "09:00". */
|
|
49
|
+
start: string;
|
|
50
|
+
/** End time, e.g. "09:30". */
|
|
51
|
+
end: string;
|
|
52
|
+
/** Optional specific staff member (UUID). */
|
|
53
|
+
staffId?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Body for {@link BookingsResource.create}. */
|
|
56
|
+
export interface CreateBookingInput {
|
|
57
|
+
/** Service to book (UUID v4). */
|
|
58
|
+
serviceId: string;
|
|
59
|
+
/** One or more slots to reserve. */
|
|
60
|
+
slots: BookingSlotInput[];
|
|
61
|
+
/** Customer name. */
|
|
62
|
+
name: string;
|
|
63
|
+
/** Customer email. */
|
|
64
|
+
email: string;
|
|
65
|
+
/** Optional IANA timezone, e.g. "Europe/London". */
|
|
66
|
+
timezone?: string;
|
|
67
|
+
/** Optional answers to the service's booking questions. */
|
|
68
|
+
questionAnswers?: Record<string, string>;
|
|
69
|
+
}
|
|
70
|
+
/** Result of {@link BookingsResource.create}. */
|
|
71
|
+
export interface BookingCreatedResult {
|
|
72
|
+
bookingSummary: BookingSummary[];
|
|
73
|
+
customerId: string;
|
|
74
|
+
}
|
|
75
|
+
/** Body for {@link CustomersResource.create}. */
|
|
76
|
+
export interface CreateCustomerInput {
|
|
77
|
+
name: string;
|
|
78
|
+
email: string;
|
|
79
|
+
}
|
|
80
|
+
/** Body for {@link CustomersResource.update}. */
|
|
81
|
+
export interface UpdateCustomerInput {
|
|
82
|
+
name?: string;
|
|
83
|
+
email?: string;
|
|
84
|
+
blacklisted?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** Body for {@link WebhooksResource.create}. */
|
|
87
|
+
export interface CreateWebhookInput {
|
|
88
|
+
url: string;
|
|
89
|
+
events: PartnerWebhookEvent[];
|
|
90
|
+
}
|
|
91
|
+
/** Body for {@link WebhooksResource.update}. */
|
|
92
|
+
export interface UpdateWebhookInput {
|
|
93
|
+
url?: string;
|
|
94
|
+
events?: PartnerWebhookEvent[];
|
|
95
|
+
}
|
|
96
|
+
/** True when `value` matches the `YYYY-MM` format (e.g. "2026-06"). */
|
|
97
|
+
export declare function isValidMonth(value: string): boolean;
|
|
2
98
|
export interface TokenSet {
|
|
3
99
|
accessToken: string;
|
|
4
100
|
refreshToken: string;
|
package/dist/cjs/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,qCAAqC,CAAC;AAEnE,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,sBAAsB,EAAE,UAAU,CAAC;CACvD;AAED,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AAEjF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,cAAc,EACd,WAAW,EACX,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,gBAAgB,qCAAqC,CAAC;AAEnE,+EAA+E;AAC/E,eAAO,MAAM,aAAa,MAAwB,CAAC;AAEnD,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BAAuB;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,sBAAsB,EAAE,UAAU,CAAC;CACvD;AAED,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AAEjF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export { FoxSchedulingError, isFoxSchedulingError } from "./errors.js";
|
|
|
3
3
|
export { MemoryTokenStore, FileTokenStore, type TokenStore, } from "./auth/tokenStore.js";
|
|
4
4
|
export { generateCodeVerifier, generateCodeChallengeS256, generateState, } from "./auth/pkce.js";
|
|
5
5
|
export { verifyFoxWebhookSignature } from "./webhooks/verify.js";
|
|
6
|
-
export
|
|
6
|
+
export type { WebhookSubscriptionPublic, CreateWebhookResult, } from "./resources/index.js";
|
|
7
|
+
export { DEFAULT_BASE_URL, MAX_PAGE_SIZE, isValidMonth, type FoxSchedulingConfig, type FoxSchedulingAuth, type FoxSchedulingApiKeyAuth, type FoxSchedulingOAuthAuth, type TokenSet, type AuthorizationUrlResult, type ListQuery, type Page, type BookingStatus, type BookingListQuery, type CreateAvailabilityInput, type UpdateAvailabilityInput, type BookingSlotInput, type CreateBookingInput, type BookingCreatedResult, type CreateCustomerInput, type UpdateCustomerInput, type CreateWebhookInput, type UpdateWebhookInput, type PartnerEmbedOptions, type PartnerEmbedCodeDto, type PartnerEmbedTheme, type PartnerEmbedOpenMode, type PartnerEmbedButtonMode, } from "./types.js";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,KAAK,sBAAsB,GAC5B,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,YAAY,EACV,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,4 +3,4 @@ export { FoxSchedulingError, isFoxSchedulingError } from "./errors.js";
|
|
|
3
3
|
export { MemoryTokenStore, FileTokenStore, } from "./auth/tokenStore.js";
|
|
4
4
|
export { generateCodeVerifier, generateCodeChallengeS256, generateState, } from "./auth/pkce.js";
|
|
5
5
|
export { verifyFoxWebhookSignature } from "./webhooks/verify.js";
|
|
6
|
-
export { DEFAULT_BASE_URL, } from "./types.js";
|
|
6
|
+
export { DEFAULT_BASE_URL, MAX_PAGE_SIZE, isValidMonth, } from "./types.js";
|
|
@@ -1,49 +1,58 @@
|
|
|
1
|
-
import type { BusinessProfileDto, PartnerBookingDto, PartnerCustomerDto, PartnerServiceDto, PartnerStaffDto, PartnerWebhookEvent } from "@foxscheduling/shared";
|
|
1
|
+
import type { Availability, BusinessProfileDto, PartnerBookingDto, PartnerCustomerDto, PartnerEmbedCodeDto, PartnerEmbedOptions, PartnerServiceDto, PartnerStaffDto, PartnerWebhookEvent } from "@foxscheduling/shared";
|
|
2
2
|
import type { HttpClient } from "../http/client.js";
|
|
3
|
+
import { type BookingCreatedResult, type BookingListQuery, type CreateAvailabilityInput, type CreateBookingInput, type CreateCustomerInput, type CreateWebhookInput, type ListQuery, type Page, type UpdateAvailabilityInput, type UpdateCustomerInput, type UpdateWebhookInput } from "../types.js";
|
|
3
4
|
export declare class BusinessResource {
|
|
4
5
|
private readonly http;
|
|
5
6
|
constructor(http: HttpClient);
|
|
6
7
|
get(): Promise<BusinessProfileDto>;
|
|
8
|
+
/**
|
|
9
|
+
* Get booking embed code (inline iframe + popup script + raw URL) for this
|
|
10
|
+
* business, with optional theming and button styling.
|
|
11
|
+
*/
|
|
12
|
+
getEmbedCode(options?: PartnerEmbedOptions): Promise<PartnerEmbedCodeDto>;
|
|
7
13
|
}
|
|
8
14
|
export declare class ServicesResource {
|
|
9
15
|
private readonly http;
|
|
10
16
|
constructor(http: HttpClient);
|
|
11
|
-
list(): Promise<PartnerServiceDto
|
|
17
|
+
list(query?: ListQuery): Promise<Page<PartnerServiceDto>>;
|
|
12
18
|
get(id: string): Promise<PartnerServiceDto>;
|
|
13
19
|
}
|
|
14
20
|
export declare class StaffResource {
|
|
15
21
|
private readonly http;
|
|
16
22
|
constructor(http: HttpClient);
|
|
17
|
-
list(): Promise<PartnerStaffDto
|
|
23
|
+
list(query?: ListQuery): Promise<Page<PartnerStaffDto>>;
|
|
18
24
|
get(id: string): Promise<PartnerStaffDto>;
|
|
19
25
|
}
|
|
20
26
|
export declare class AvailabilityResource {
|
|
21
27
|
private readonly http;
|
|
22
28
|
constructor(http: HttpClient);
|
|
23
|
-
list(): Promise<
|
|
24
|
-
get(id: string): Promise<
|
|
25
|
-
create(body:
|
|
26
|
-
update(id: string, body:
|
|
27
|
-
delete(id: string): Promise<
|
|
29
|
+
list(query?: ListQuery): Promise<Page<Availability>>;
|
|
30
|
+
get(id: string): Promise<Availability>;
|
|
31
|
+
create(body: CreateAvailabilityInput): Promise<Availability>;
|
|
32
|
+
update(id: string, body: UpdateAvailabilityInput): Promise<Availability>;
|
|
33
|
+
delete(id: string): Promise<boolean>;
|
|
28
34
|
}
|
|
29
35
|
export declare class BookingsResource {
|
|
30
36
|
private readonly http;
|
|
31
37
|
constructor(http: HttpClient);
|
|
32
|
-
|
|
38
|
+
/**
|
|
39
|
+
* List bookings for a single month.
|
|
40
|
+
*
|
|
41
|
+
* `query.month` is required (format `YYYY-MM`, e.g. "2026-06") to keep the
|
|
42
|
+
* response small.
|
|
43
|
+
*/
|
|
44
|
+
list(query: BookingListQuery): Promise<Page<PartnerBookingDto>>;
|
|
33
45
|
get(id: string, serviceId: string): Promise<PartnerBookingDto>;
|
|
34
|
-
create(body:
|
|
35
|
-
cancel(id: string, serviceId: string): Promise<
|
|
46
|
+
create(body: CreateBookingInput): Promise<BookingCreatedResult>;
|
|
47
|
+
cancel(id: string, serviceId: string): Promise<PartnerBookingDto>;
|
|
36
48
|
}
|
|
37
49
|
export declare class CustomersResource {
|
|
38
50
|
private readonly http;
|
|
39
51
|
constructor(http: HttpClient);
|
|
40
|
-
list(): Promise<PartnerCustomerDto
|
|
52
|
+
list(query?: ListQuery): Promise<Page<PartnerCustomerDto>>;
|
|
41
53
|
get(id: string): Promise<PartnerCustomerDto>;
|
|
42
|
-
create(body:
|
|
43
|
-
|
|
44
|
-
email: string;
|
|
45
|
-
}): Promise<PartnerCustomerDto>;
|
|
46
|
-
update(id: string, body: unknown): Promise<PartnerCustomerDto>;
|
|
54
|
+
create(body: CreateCustomerInput): Promise<PartnerCustomerDto>;
|
|
55
|
+
update(id: string, body: UpdateCustomerInput): Promise<PartnerCustomerDto>;
|
|
47
56
|
}
|
|
48
57
|
export interface WebhookSubscriptionPublic {
|
|
49
58
|
id: string;
|
|
@@ -51,21 +60,16 @@ export interface WebhookSubscriptionPublic {
|
|
|
51
60
|
events: PartnerWebhookEvent[];
|
|
52
61
|
creationDate?: string;
|
|
53
62
|
}
|
|
63
|
+
export interface CreateWebhookResult {
|
|
64
|
+
subscription: WebhookSubscriptionPublic;
|
|
65
|
+
secret: string;
|
|
66
|
+
}
|
|
54
67
|
export declare class WebhooksResource {
|
|
55
68
|
private readonly http;
|
|
56
69
|
constructor(http: HttpClient);
|
|
57
|
-
list(): Promise<WebhookSubscriptionPublic
|
|
58
|
-
create(body:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}): Promise<{
|
|
62
|
-
subscription: WebhookSubscriptionPublic;
|
|
63
|
-
secret: string;
|
|
64
|
-
}>;
|
|
65
|
-
update(id: string, body: Partial<{
|
|
66
|
-
url: string;
|
|
67
|
-
events: PartnerWebhookEvent[];
|
|
68
|
-
}>): Promise<WebhookSubscriptionPublic>;
|
|
69
|
-
delete(id: string): Promise<unknown>;
|
|
70
|
+
list(query?: ListQuery): Promise<Page<WebhookSubscriptionPublic>>;
|
|
71
|
+
create(body: CreateWebhookInput): Promise<CreateWebhookResult>;
|
|
72
|
+
update(id: string, body: UpdateWebhookInput): Promise<WebhookSubscriptionPublic>;
|
|
73
|
+
delete(id: string): Promise<boolean>;
|
|
70
74
|
}
|
|
71
75
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EA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EAAE,mBAAmB,EAAE,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,yBAAyB,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAOjE,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI9D,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,yBAAyB,CAAC;IAOrC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGrC"}
|
package/dist/resources/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { isValidMonth, } from "../types.js";
|
|
2
|
+
import { FoxSchedulingError } from "../errors.js";
|
|
3
|
+
/** Convert pagination options to string query params. */
|
|
4
|
+
function pageQuery(query) {
|
|
5
|
+
return {
|
|
6
|
+
limit: query?.limit != null ? String(query.limit) : undefined,
|
|
7
|
+
offset: query?.offset != null ? String(query.offset) : undefined,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
1
10
|
export class BusinessResource {
|
|
2
11
|
http;
|
|
3
12
|
constructor(http) {
|
|
@@ -6,14 +15,37 @@ export class BusinessResource {
|
|
|
6
15
|
get() {
|
|
7
16
|
return this.http.get("/partner/business");
|
|
8
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Get booking embed code (inline iframe + popup script + raw URL) for this
|
|
20
|
+
* business, with optional theming and button styling.
|
|
21
|
+
*/
|
|
22
|
+
getEmbedCode(options = {}) {
|
|
23
|
+
return this.http.get("/partner/business/embed", {
|
|
24
|
+
servicePath: options.servicePath,
|
|
25
|
+
theme: options.theme,
|
|
26
|
+
hidePageDetails: options.hidePageDetails != null ? String(options.hidePageDetails) : undefined,
|
|
27
|
+
showThemeToggle: options.showThemeToggle != null ? String(options.showThemeToggle) : undefined,
|
|
28
|
+
heightPx: options.heightPx != null ? String(options.heightPx) : undefined,
|
|
29
|
+
iframeBorderRadius: options.iframeBorderRadius,
|
|
30
|
+
openMode: options.openMode,
|
|
31
|
+
buttonMode: options.buttonMode,
|
|
32
|
+
triggerId: options.triggerId,
|
|
33
|
+
buttonText: options.buttonText,
|
|
34
|
+
buttonBackgroundColor: options.buttonBackgroundColor,
|
|
35
|
+
buttonTextColor: options.buttonTextColor,
|
|
36
|
+
buttonBorderRadiusPx: options.buttonBorderRadiusPx != null
|
|
37
|
+
? String(options.buttonBorderRadiusPx)
|
|
38
|
+
: undefined,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
9
41
|
}
|
|
10
42
|
export class ServicesResource {
|
|
11
43
|
http;
|
|
12
44
|
constructor(http) {
|
|
13
45
|
this.http = http;
|
|
14
46
|
}
|
|
15
|
-
list() {
|
|
16
|
-
return this.http.get("/partner/services");
|
|
47
|
+
list(query) {
|
|
48
|
+
return this.http.get("/partner/services", pageQuery(query));
|
|
17
49
|
}
|
|
18
50
|
get(id) {
|
|
19
51
|
return this.http.get(`/partner/services/${id}`);
|
|
@@ -24,8 +56,8 @@ export class StaffResource {
|
|
|
24
56
|
constructor(http) {
|
|
25
57
|
this.http = http;
|
|
26
58
|
}
|
|
27
|
-
list() {
|
|
28
|
-
return this.http.get("/partner/staff");
|
|
59
|
+
list(query) {
|
|
60
|
+
return this.http.get("/partner/staff", pageQuery(query));
|
|
29
61
|
}
|
|
30
62
|
get(id) {
|
|
31
63
|
return this.http.get(`/partner/staff/${id}`);
|
|
@@ -36,8 +68,8 @@ export class AvailabilityResource {
|
|
|
36
68
|
constructor(http) {
|
|
37
69
|
this.http = http;
|
|
38
70
|
}
|
|
39
|
-
list() {
|
|
40
|
-
return this.http.get("/partner/availability");
|
|
71
|
+
list(query) {
|
|
72
|
+
return this.http.get("/partner/availability", pageQuery(query));
|
|
41
73
|
}
|
|
42
74
|
get(id) {
|
|
43
75
|
return this.http.get(`/partner/availability/${id}`);
|
|
@@ -57,19 +89,38 @@ export class BookingsResource {
|
|
|
57
89
|
constructor(http) {
|
|
58
90
|
this.http = http;
|
|
59
91
|
}
|
|
60
|
-
|
|
61
|
-
|
|
92
|
+
/**
|
|
93
|
+
* List bookings for a single month.
|
|
94
|
+
*
|
|
95
|
+
* `query.month` is required (format `YYYY-MM`, e.g. "2026-06") to keep the
|
|
96
|
+
* response small.
|
|
97
|
+
*/
|
|
98
|
+
async list(query) {
|
|
99
|
+
if (!query || !query.month) {
|
|
100
|
+
throw new FoxSchedulingError("MONTH_REQUIRED", 'bookings.list requires a "month" in YYYY-MM format, e.g. "2026-06".');
|
|
101
|
+
}
|
|
102
|
+
if (!isValidMonth(query.month)) {
|
|
103
|
+
throw new FoxSchedulingError("INVALID_MONTH", `Invalid month "${query.month}". Expected YYYY-MM, e.g. "2026-06".`);
|
|
104
|
+
}
|
|
105
|
+
return this.http.get("/partner/bookings", {
|
|
106
|
+
yearMonth: query.month,
|
|
107
|
+
serviceId: query.serviceId,
|
|
108
|
+
providerId: query.providerId,
|
|
109
|
+
status: query.status,
|
|
110
|
+
search: query.search,
|
|
111
|
+
...pageQuery(query),
|
|
112
|
+
});
|
|
62
113
|
}
|
|
63
114
|
get(id, serviceId) {
|
|
64
|
-
return this.http.get(`/partner/bookings/${id}`, {
|
|
115
|
+
return this.http.get(`/partner/bookings/${id}`, {
|
|
116
|
+
serviceId,
|
|
117
|
+
});
|
|
65
118
|
}
|
|
66
119
|
create(body) {
|
|
67
120
|
return this.http.post("/partner/bookings", body);
|
|
68
121
|
}
|
|
69
122
|
cancel(id, serviceId) {
|
|
70
|
-
return this.http.post(`/partner/bookings/${id}/cancel`, undefined, {
|
|
71
|
-
serviceId,
|
|
72
|
-
});
|
|
123
|
+
return this.http.post(`/partner/bookings/${id}/cancel`, undefined, { serviceId });
|
|
73
124
|
}
|
|
74
125
|
}
|
|
75
126
|
export class CustomersResource {
|
|
@@ -77,8 +128,8 @@ export class CustomersResource {
|
|
|
77
128
|
constructor(http) {
|
|
78
129
|
this.http = http;
|
|
79
130
|
}
|
|
80
|
-
list() {
|
|
81
|
-
return this.http.get("/partner/customers");
|
|
131
|
+
list(query) {
|
|
132
|
+
return this.http.get("/partner/customers", pageQuery(query));
|
|
82
133
|
}
|
|
83
134
|
get(id) {
|
|
84
135
|
return this.http.get(`/partner/customers/${id}`);
|
|
@@ -95,8 +146,8 @@ export class WebhooksResource {
|
|
|
95
146
|
constructor(http) {
|
|
96
147
|
this.http = http;
|
|
97
148
|
}
|
|
98
|
-
list() {
|
|
99
|
-
return this.http.get("/partner/webhooks");
|
|
149
|
+
list(query) {
|
|
150
|
+
return this.http.get("/partner/webhooks", pageQuery(query));
|
|
100
151
|
}
|
|
101
152
|
create(body) {
|
|
102
153
|
return this.http.post("/partner/webhooks", body);
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,100 @@
|
|
|
1
|
+
import type { Availability, Booking, BookingSummary, PartnerPage, PartnerWebhookEvent } from "@foxscheduling/shared";
|
|
1
2
|
export declare const DEFAULT_BASE_URL = "https://foxscheduling.com/api/v1";
|
|
3
|
+
/** Maximum number of items returned in a single page (enforced by the API). */
|
|
4
|
+
export declare const MAX_PAGE_SIZE = 100;
|
|
5
|
+
/** Pagination options accepted by every list endpoint. */
|
|
6
|
+
export interface ListQuery {
|
|
7
|
+
/** Items per page (1–{@link MAX_PAGE_SIZE}). The API clamps higher values. */
|
|
8
|
+
limit?: number;
|
|
9
|
+
/** Number of items to skip from the start. Defaults to 0. */
|
|
10
|
+
offset?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A single page of results, returned by every `list()` method.
|
|
14
|
+
*
|
|
15
|
+
* Re-exported from `@foxscheduling/shared` as `PartnerPage<T>`.
|
|
16
|
+
*/
|
|
17
|
+
export type Page<T> = PartnerPage<T>;
|
|
18
|
+
/** Re-export the embed options/result types for SDK consumers. */
|
|
19
|
+
export type { PartnerEmbedOptions, PartnerEmbedCodeDto, PartnerEmbedTheme, PartnerEmbedOpenMode, PartnerEmbedButtonMode, } from "@foxscheduling/shared";
|
|
20
|
+
/** Booking status values returned by the Partner API. */
|
|
21
|
+
export type BookingStatus = Booking["status"];
|
|
22
|
+
/**
|
|
23
|
+
* Query for {@link BookingsResource.list}.
|
|
24
|
+
*
|
|
25
|
+
* `month` is required to keep responses small — the API would otherwise return
|
|
26
|
+
* every booking for the business.
|
|
27
|
+
*/
|
|
28
|
+
export interface BookingListQuery extends ListQuery {
|
|
29
|
+
/** Required calendar month to fetch, format `YYYY-MM` (e.g. "2026-06"). */
|
|
30
|
+
month: string;
|
|
31
|
+
/** Restrict to a single service (UUID v4). */
|
|
32
|
+
serviceId?: string;
|
|
33
|
+
/** Restrict to a single staff/provider (UUID). */
|
|
34
|
+
providerId?: string;
|
|
35
|
+
/** Restrict to a booking status. */
|
|
36
|
+
status?: BookingStatus;
|
|
37
|
+
/** Case-insensitive search over customer name, email, or slug. */
|
|
38
|
+
search?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Body for {@link AvailabilityResource.create}. */
|
|
41
|
+
export type CreateAvailabilityInput = Omit<Availability, "id" | "ttl" | "sortKey" | "updatedOn" | "creationDate" | "schemaVersion" | "recordType" | "tenantId">;
|
|
42
|
+
/** Body for {@link AvailabilityResource.update}. */
|
|
43
|
+
export type UpdateAvailabilityInput = Partial<CreateAvailabilityInput>;
|
|
44
|
+
/** A slot to book within {@link CreateBookingInput}. */
|
|
45
|
+
export interface BookingSlotInput {
|
|
46
|
+
/** Date in `YYYY-MM-DD`. */
|
|
47
|
+
date: string;
|
|
48
|
+
/** Start time, e.g. "09:00". */
|
|
49
|
+
start: string;
|
|
50
|
+
/** End time, e.g. "09:30". */
|
|
51
|
+
end: string;
|
|
52
|
+
/** Optional specific staff member (UUID). */
|
|
53
|
+
staffId?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Body for {@link BookingsResource.create}. */
|
|
56
|
+
export interface CreateBookingInput {
|
|
57
|
+
/** Service to book (UUID v4). */
|
|
58
|
+
serviceId: string;
|
|
59
|
+
/** One or more slots to reserve. */
|
|
60
|
+
slots: BookingSlotInput[];
|
|
61
|
+
/** Customer name. */
|
|
62
|
+
name: string;
|
|
63
|
+
/** Customer email. */
|
|
64
|
+
email: string;
|
|
65
|
+
/** Optional IANA timezone, e.g. "Europe/London". */
|
|
66
|
+
timezone?: string;
|
|
67
|
+
/** Optional answers to the service's booking questions. */
|
|
68
|
+
questionAnswers?: Record<string, string>;
|
|
69
|
+
}
|
|
70
|
+
/** Result of {@link BookingsResource.create}. */
|
|
71
|
+
export interface BookingCreatedResult {
|
|
72
|
+
bookingSummary: BookingSummary[];
|
|
73
|
+
customerId: string;
|
|
74
|
+
}
|
|
75
|
+
/** Body for {@link CustomersResource.create}. */
|
|
76
|
+
export interface CreateCustomerInput {
|
|
77
|
+
name: string;
|
|
78
|
+
email: string;
|
|
79
|
+
}
|
|
80
|
+
/** Body for {@link CustomersResource.update}. */
|
|
81
|
+
export interface UpdateCustomerInput {
|
|
82
|
+
name?: string;
|
|
83
|
+
email?: string;
|
|
84
|
+
blacklisted?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** Body for {@link WebhooksResource.create}. */
|
|
87
|
+
export interface CreateWebhookInput {
|
|
88
|
+
url: string;
|
|
89
|
+
events: PartnerWebhookEvent[];
|
|
90
|
+
}
|
|
91
|
+
/** Body for {@link WebhooksResource.update}. */
|
|
92
|
+
export interface UpdateWebhookInput {
|
|
93
|
+
url?: string;
|
|
94
|
+
events?: PartnerWebhookEvent[];
|
|
95
|
+
}
|
|
96
|
+
/** True when `value` matches the `YYYY-MM` format (e.g. "2026-06"). */
|
|
97
|
+
export declare function isValidMonth(value: string): boolean;
|
|
2
98
|
export interface TokenSet {
|
|
3
99
|
accessToken: string;
|
|
4
100
|
refreshToken: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,qCAAqC,CAAC;AAEnE,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,sBAAsB,EAAE,UAAU,CAAC;CACvD;AAED,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AAEjF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,cAAc,EACd,WAAW,EACX,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,gBAAgB,qCAAqC,CAAC;AA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CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,sBAAsB,EAAE,UAAU,CAAC;CACvD;AAED,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AAEjF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
package/dist/types.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
+
import { isValidYearMonth, PARTNER_MAX_PAGE_SIZE, } from "@foxscheduling/shared";
|
|
1
2
|
export const DEFAULT_BASE_URL = "https://foxscheduling.com/api/v1";
|
|
3
|
+
/** Maximum number of items returned in a single page (enforced by the API). */
|
|
4
|
+
export const MAX_PAGE_SIZE = PARTNER_MAX_PAGE_SIZE;
|
|
5
|
+
/** True when `value` matches the `YYYY-MM` format (e.g. "2026-06"). */
|
|
6
|
+
export function isValidMonth(value) {
|
|
7
|
+
return isValidYearMonth(value);
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxscheduling/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Official Fox Scheduling Partner API SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.cjs",
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"default": "./dist/index.js"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"files": [
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
17
20
|
"scripts": {
|
|
18
21
|
"build": "tsc && tsc -p tsconfig.cjs.json && node scripts/rename-cjs.mjs",
|
|
19
22
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
@@ -36,4 +39,4 @@
|
|
|
36
39
|
"ts-jest": "^29",
|
|
37
40
|
"typescript": "~5.9.3"
|
|
38
41
|
}
|
|
39
|
-
}
|
|
42
|
+
}
|