@slotchain/sdk 1.3.0 → 1.5.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/dist/index.d.mts CHANGED
@@ -160,16 +160,81 @@ interface Service {
160
160
  created_at: string;
161
161
  updated_at: string;
162
162
  }
163
+ /**
164
+ * Metadata bag for a slot — open-ended key/value store, with well-known
165
+ * optional fields for childcare / nursery term-based scheduling.
166
+ */
167
+ interface SlotMetadata {
168
+ /** Human-readable term name, e.g. "Autumn Term 2024" */
169
+ term_name?: string;
170
+ /** Season identifier, e.g. "autumn" | "spring" | "summer" */
171
+ season?: string;
172
+ /** ISO date string for when the half-term break starts */
173
+ half_term_start?: string;
174
+ /** ISO date string for when the half-term break ends */
175
+ half_term_end?: string;
176
+ /** Maximum number of children / participants in this slot */
177
+ capacity?: number;
178
+ /**
179
+ * Headcount at -2 weeks (used for register generation / staffing).
180
+ * Negative prefix avoids collision with positive operational fields.
181
+ */
182
+ neg_headcount_neg2?: number;
183
+ /**
184
+ * Headcount at -3 weeks (used for register generation / staffing).
185
+ */
186
+ neg_headcount_neg3?: number;
187
+ /** Arbitrary additional metadata */
188
+ [key: string]: unknown;
189
+ }
163
190
  interface Slot {
164
191
  id: string;
165
192
  tenant_id: string;
193
+ /** Display name / title of the slot */
166
194
  name: string;
167
195
  description?: string;
168
196
  status?: string;
169
197
  is_active?: boolean;
198
+ /**
199
+ * ISO 8601 datetime when the slot opens (combines start_date + start_time from the DB).
200
+ * Present when the API serialises scheduled slots.
201
+ */
202
+ starts_at?: string;
203
+ /**
204
+ * ISO 8601 datetime when the slot closes (combines end_date + end_time from the DB).
205
+ * Absent for open-ended / on-demand slots.
206
+ */
207
+ ends_at?: string;
208
+ /** Arbitrary metadata bag — see SlotMetadata for well-known keys */
209
+ metadata?: SlotMetadata;
170
210
  created_at: string;
171
211
  updated_at: string;
172
212
  }
213
+ /**
214
+ * Input shape for creating or updating a slot.
215
+ * Omits server-generated fields; all scheduling fields optional.
216
+ */
217
+ interface CreateSlotInput {
218
+ name: string;
219
+ description?: string;
220
+ tenant_id: string;
221
+ status?: 'draft' | 'live' | 'archived';
222
+ /**
223
+ * ISO 8601 datetime for when the slot opens.
224
+ * The API splits this into start_date + start_time before persisting.
225
+ */
226
+ starts_at?: string;
227
+ /**
228
+ * ISO 8601 datetime for when the slot closes.
229
+ * Omit for on-demand / open-ended slots.
230
+ */
231
+ ends_at?: string;
232
+ metadata?: SlotMetadata;
233
+ }
234
+ /**
235
+ * Partial update shape — all fields optional except id (supplied as path param).
236
+ */
237
+ type UpdateSlotInput = Partial<Omit<CreateSlotInput, 'tenant_id'>>;
173
238
  /**
174
239
  * Customer record — matches the `customers` table.
175
240
  */
@@ -323,7 +388,7 @@ interface GetOrganizationOptions {
323
388
  /**
324
389
  * Artifact / document attached to a customer or booking
325
390
  */
326
- type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant';
391
+ type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant' | 'slot_moment';
327
392
  type ArtifactMimeCategory = 'pdf' | 'document' | 'image' | 'spreadsheet' | 'video' | 'audio' | 'other';
328
393
  interface Artifact {
329
394
  id: string;
@@ -381,6 +446,46 @@ interface UploadArtifactOptions {
381
446
  mime_type?: string;
382
447
  metadata?: Record<string, unknown>;
383
448
  }
449
+ /**
450
+ * Slot-scoped operational notice (early closure, venue change, general alert).
451
+ * Backed by a `slot_moment` — see NOTICES_PLAN.md in slotly-admin.
452
+ */
453
+ type NoticeMomentType = 'general_notice' | 'early_closure' | 'closure_notice' | 'venue_change';
454
+ interface SlotNotice {
455
+ id: string;
456
+ slotId: string;
457
+ tenantId: string;
458
+ momentType: NoticeMomentType;
459
+ createdAt: string;
460
+ createdBy: string | null;
461
+ notice: {
462
+ type: string;
463
+ title: string;
464
+ message: string;
465
+ /** YYYY-MM-DD — the day the notice applies to */
466
+ affectedDate: string;
467
+ /** HH:MM — only present for early_closure notices */
468
+ closesAt?: string;
469
+ severity: 'info' | 'warning' | 'urgent';
470
+ visibleFrom: string;
471
+ visibleUntil: string;
472
+ dismissible: boolean;
473
+ /** Signed URL for the notice's attached graphic, if one was uploaded */
474
+ imageUrl?: string | null;
475
+ /** Staff-picked display treatment — 'banner' (compact, stacks) or 'modal' (full-screen, one at a time) */
476
+ presentation: 'banner' | 'modal';
477
+ };
478
+ affectedBookingIds: string[];
479
+ }
480
+ interface ListNoticesOptions {
481
+ tenantId: string;
482
+ /** Filter to notices active at this ISO timestamp. Defaults to now. */
483
+ activeAt?: string;
484
+ /** Filter to a specific slot */
485
+ slotId?: string;
486
+ /** Specific notice types to include. Defaults to all notice types. */
487
+ types?: NoticeMomentType[];
488
+ }
384
489
  /**
385
490
  * Full tenant configuration including branding, services, and service items
386
491
  * Service items are nested within each service object (not as a separate top-level array)
@@ -923,19 +1028,41 @@ declare class SlotClient {
923
1028
  limit?: number;
924
1029
  }): Promise<ApiResponse<Slot[]>>;
925
1030
  /**
926
- * Create a new slot
1031
+ * Create a new slot.
927
1032
  * POST /api/v1/slots
928
1033
  *
929
- * @param data - Slot creation data (tenant_id, name required)
1034
+ * Accepts any subset of `Slot` fields. For new integrations, prefer the
1035
+ * exported `CreateSlotInput` type which documents the recommended shape
1036
+ * and will become the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
1037
+ *
1038
+ * New fields available as of v1.4:
1039
+ * - `starts_at` — ISO 8601 datetime when the slot opens
1040
+ * - `ends_at` — ISO 8601 datetime when the slot closes (omit for open-ended slots)
1041
+ * - `metadata` — term enrichment bag (term_name, season, half_term_start,
1042
+ * half_term_end, capacity); see `SlotMetadata` type
1043
+ *
1044
+ * @param data - Slot creation data
930
1045
  * @returns Created slot
1046
+ *
1047
+ * @example
1048
+ * // Recommended — opt into stricter typing now:
1049
+ * import { CreateSlotInput } from '@slotly/sdk';
1050
+ * const input: CreateSlotInput = { name: 'Autumn Term', tenant_id: '...', starts_at: '...' };
1051
+ * sdk.slots.create(input);
931
1052
  */
932
1053
  create(data: Partial<Slot>): Promise<ApiResponse<Slot>>;
933
1054
  /**
934
- * Update slot by ID
1055
+ * Update slot by ID.
935
1056
  * PUT /api/v1/slots/:id
936
1057
  *
937
- * @param id - Slot ID
938
- * @param data - Slot update data
1058
+ * Accepts any subset of `Slot` fields. For new integrations, prefer the
1059
+ * exported `UpdateSlotInput` type it will become the enforced signature
1060
+ * in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
1061
+ *
1062
+ * New fields available as of v1.4: `starts_at`, `ends_at`, `metadata`.
1063
+ *
1064
+ * @param id - Slot ID
1065
+ * @param data - Fields to update
939
1066
  * @returns Updated slot
940
1067
  */
941
1068
  update(id: string, data: Partial<Slot>): Promise<ApiResponse<Slot>>;
@@ -954,10 +1081,20 @@ declare class SlotClient {
954
1081
  * @param slots - Array of slots to create
955
1082
  * @returns Created slots
956
1083
  */
1084
+ /**
1085
+ * Bulk create slots.
1086
+ * POST /api/v1/slots/bulk
1087
+ *
1088
+ * For new integrations, prefer passing `CreateSlotInput[]` — it will become
1089
+ * the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
1090
+ */
957
1091
  bulkCreate(slots: Partial<Slot>[]): Promise<ApiResponse<Slot[]>>;
958
1092
  /**
959
- * Mark slot as available/unavailable
960
- * Note: Use update() method with status or other fields
1093
+ * Mark slot as available (live) or unavailable (archived).
1094
+ *
1095
+ * Note: previous versions sent 'active'/'inactive' which were not valid DB
1096
+ * enum values. Fixed in v1.4 to use 'live'/'archived' — the only valid
1097
+ * non-draft statuses. If you need 'draft', use update() directly.
961
1098
  */
962
1099
  setAvailability(id: string, available: boolean): Promise<ApiResponse<Slot>>;
963
1100
  /**
@@ -1468,6 +1605,34 @@ declare class DocumentClient {
1468
1605
  }): Promise<Artifact>;
1469
1606
  }
1470
1607
 
1608
+ /**
1609
+ * NoticesClient — read active slot-scoped operational notices.
1610
+ *
1611
+ * Notices are a product concept (early closure, venue change, general alert)
1612
+ * backed by `slot_moments` internally — the SDK surface reflects the product,
1613
+ * not the storage model. Each notice's attached graphic (if any) is already
1614
+ * resolved to a signed `imageUrl` server-side.
1615
+ *
1616
+ * @example List active notices for a tenant
1617
+ * ```ts
1618
+ * const { data } = await slotly.notices.list({ tenantId });
1619
+ * ```
1620
+ */
1621
+ declare class NoticesClient {
1622
+ private readonly client;
1623
+ private readonly base;
1624
+ constructor(client: AxiosInstance);
1625
+ /**
1626
+ * List active notices for a tenant.
1627
+ * Returns only notices where visible_until > activeAt (default: now).
1628
+ */
1629
+ list(options: ListNoticesOptions): Promise<ApiResponse<SlotNotice[]>>;
1630
+ /**
1631
+ * Get a single notice by its slot_moment id.
1632
+ */
1633
+ getById(id: string, tenantId: string): Promise<SlotNotice>;
1634
+ }
1635
+
1471
1636
  /**
1472
1637
  * Custom error classes for Slotly SDK
1473
1638
  */
@@ -1632,6 +1797,8 @@ interface SlotlyApi {
1632
1797
  organization: OrganizationClient;
1633
1798
  /** Upload and retrieve file artifacts (CVs, invoices, images) linked to any Slotly entity */
1634
1799
  document: DocumentClient;
1800
+ /** List slot-scoped operational notices (early closure, venue change, general alerts) */
1801
+ notices: NoticesClient;
1635
1802
  }
1636
1803
  /**
1637
1804
  * Initialize and configure a new Slotly API client with dual authentication.
@@ -1696,4 +1863,4 @@ interface SlotlyApi {
1696
1863
  */
1697
1864
  declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
1698
1865
 
1699
- export { type ApiResponse, type Artifact, type ArtifactEntityType, type ArtifactMimeCategory, type ArtifactWithUrl, type Booking, type BookingWithSlot, type Category, type Customer, type CustomerIdentity, type CustomerWithBookings, type CustomerWithIdentities, type DataQualityIssue, type FindOrCreateCustomerOptions, type Flow, type FlowStep, type GetOrganizationOptions, type ListArtifactsOptions, type ListBookingsOptions, type Notification, type NotificationPreferences, type Organization, type OrganizationFullConfig, type ResolveCustomerOptions, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotServiceWithItems, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, type UploadArtifactOptions, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
1866
+ export { type ApiResponse, type Artifact, type ArtifactEntityType, type ArtifactMimeCategory, type ArtifactWithUrl, type Booking, type BookingWithSlot, type Category, type CreateSlotInput, type Customer, type CustomerIdentity, type CustomerWithBookings, type CustomerWithIdentities, type DataQualityIssue, type FindOrCreateCustomerOptions, type Flow, type FlowStep, type GetOrganizationOptions, type ListArtifactsOptions, type ListBookingsOptions, type ListNoticesOptions, type NoticeMomentType, type Notification, type NotificationPreferences, type Organization, type OrganizationFullConfig, type ResolveCustomerOptions, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotMetadata, type SlotNotice, type SlotServiceWithItems, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, type UpdateSlotInput, type UploadArtifactOptions, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
package/dist/index.d.ts CHANGED
@@ -160,16 +160,81 @@ interface Service {
160
160
  created_at: string;
161
161
  updated_at: string;
162
162
  }
163
+ /**
164
+ * Metadata bag for a slot — open-ended key/value store, with well-known
165
+ * optional fields for childcare / nursery term-based scheduling.
166
+ */
167
+ interface SlotMetadata {
168
+ /** Human-readable term name, e.g. "Autumn Term 2024" */
169
+ term_name?: string;
170
+ /** Season identifier, e.g. "autumn" | "spring" | "summer" */
171
+ season?: string;
172
+ /** ISO date string for when the half-term break starts */
173
+ half_term_start?: string;
174
+ /** ISO date string for when the half-term break ends */
175
+ half_term_end?: string;
176
+ /** Maximum number of children / participants in this slot */
177
+ capacity?: number;
178
+ /**
179
+ * Headcount at -2 weeks (used for register generation / staffing).
180
+ * Negative prefix avoids collision with positive operational fields.
181
+ */
182
+ neg_headcount_neg2?: number;
183
+ /**
184
+ * Headcount at -3 weeks (used for register generation / staffing).
185
+ */
186
+ neg_headcount_neg3?: number;
187
+ /** Arbitrary additional metadata */
188
+ [key: string]: unknown;
189
+ }
163
190
  interface Slot {
164
191
  id: string;
165
192
  tenant_id: string;
193
+ /** Display name / title of the slot */
166
194
  name: string;
167
195
  description?: string;
168
196
  status?: string;
169
197
  is_active?: boolean;
198
+ /**
199
+ * ISO 8601 datetime when the slot opens (combines start_date + start_time from the DB).
200
+ * Present when the API serialises scheduled slots.
201
+ */
202
+ starts_at?: string;
203
+ /**
204
+ * ISO 8601 datetime when the slot closes (combines end_date + end_time from the DB).
205
+ * Absent for open-ended / on-demand slots.
206
+ */
207
+ ends_at?: string;
208
+ /** Arbitrary metadata bag — see SlotMetadata for well-known keys */
209
+ metadata?: SlotMetadata;
170
210
  created_at: string;
171
211
  updated_at: string;
172
212
  }
213
+ /**
214
+ * Input shape for creating or updating a slot.
215
+ * Omits server-generated fields; all scheduling fields optional.
216
+ */
217
+ interface CreateSlotInput {
218
+ name: string;
219
+ description?: string;
220
+ tenant_id: string;
221
+ status?: 'draft' | 'live' | 'archived';
222
+ /**
223
+ * ISO 8601 datetime for when the slot opens.
224
+ * The API splits this into start_date + start_time before persisting.
225
+ */
226
+ starts_at?: string;
227
+ /**
228
+ * ISO 8601 datetime for when the slot closes.
229
+ * Omit for on-demand / open-ended slots.
230
+ */
231
+ ends_at?: string;
232
+ metadata?: SlotMetadata;
233
+ }
234
+ /**
235
+ * Partial update shape — all fields optional except id (supplied as path param).
236
+ */
237
+ type UpdateSlotInput = Partial<Omit<CreateSlotInput, 'tenant_id'>>;
173
238
  /**
174
239
  * Customer record — matches the `customers` table.
175
240
  */
@@ -323,7 +388,7 @@ interface GetOrganizationOptions {
323
388
  /**
324
389
  * Artifact / document attached to a customer or booking
325
390
  */
326
- type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant';
391
+ type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant' | 'slot_moment';
327
392
  type ArtifactMimeCategory = 'pdf' | 'document' | 'image' | 'spreadsheet' | 'video' | 'audio' | 'other';
328
393
  interface Artifact {
329
394
  id: string;
@@ -381,6 +446,46 @@ interface UploadArtifactOptions {
381
446
  mime_type?: string;
382
447
  metadata?: Record<string, unknown>;
383
448
  }
449
+ /**
450
+ * Slot-scoped operational notice (early closure, venue change, general alert).
451
+ * Backed by a `slot_moment` — see NOTICES_PLAN.md in slotly-admin.
452
+ */
453
+ type NoticeMomentType = 'general_notice' | 'early_closure' | 'closure_notice' | 'venue_change';
454
+ interface SlotNotice {
455
+ id: string;
456
+ slotId: string;
457
+ tenantId: string;
458
+ momentType: NoticeMomentType;
459
+ createdAt: string;
460
+ createdBy: string | null;
461
+ notice: {
462
+ type: string;
463
+ title: string;
464
+ message: string;
465
+ /** YYYY-MM-DD — the day the notice applies to */
466
+ affectedDate: string;
467
+ /** HH:MM — only present for early_closure notices */
468
+ closesAt?: string;
469
+ severity: 'info' | 'warning' | 'urgent';
470
+ visibleFrom: string;
471
+ visibleUntil: string;
472
+ dismissible: boolean;
473
+ /** Signed URL for the notice's attached graphic, if one was uploaded */
474
+ imageUrl?: string | null;
475
+ /** Staff-picked display treatment — 'banner' (compact, stacks) or 'modal' (full-screen, one at a time) */
476
+ presentation: 'banner' | 'modal';
477
+ };
478
+ affectedBookingIds: string[];
479
+ }
480
+ interface ListNoticesOptions {
481
+ tenantId: string;
482
+ /** Filter to notices active at this ISO timestamp. Defaults to now. */
483
+ activeAt?: string;
484
+ /** Filter to a specific slot */
485
+ slotId?: string;
486
+ /** Specific notice types to include. Defaults to all notice types. */
487
+ types?: NoticeMomentType[];
488
+ }
384
489
  /**
385
490
  * Full tenant configuration including branding, services, and service items
386
491
  * Service items are nested within each service object (not as a separate top-level array)
@@ -923,19 +1028,41 @@ declare class SlotClient {
923
1028
  limit?: number;
924
1029
  }): Promise<ApiResponse<Slot[]>>;
925
1030
  /**
926
- * Create a new slot
1031
+ * Create a new slot.
927
1032
  * POST /api/v1/slots
928
1033
  *
929
- * @param data - Slot creation data (tenant_id, name required)
1034
+ * Accepts any subset of `Slot` fields. For new integrations, prefer the
1035
+ * exported `CreateSlotInput` type which documents the recommended shape
1036
+ * and will become the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
1037
+ *
1038
+ * New fields available as of v1.4:
1039
+ * - `starts_at` — ISO 8601 datetime when the slot opens
1040
+ * - `ends_at` — ISO 8601 datetime when the slot closes (omit for open-ended slots)
1041
+ * - `metadata` — term enrichment bag (term_name, season, half_term_start,
1042
+ * half_term_end, capacity); see `SlotMetadata` type
1043
+ *
1044
+ * @param data - Slot creation data
930
1045
  * @returns Created slot
1046
+ *
1047
+ * @example
1048
+ * // Recommended — opt into stricter typing now:
1049
+ * import { CreateSlotInput } from '@slotly/sdk';
1050
+ * const input: CreateSlotInput = { name: 'Autumn Term', tenant_id: '...', starts_at: '...' };
1051
+ * sdk.slots.create(input);
931
1052
  */
932
1053
  create(data: Partial<Slot>): Promise<ApiResponse<Slot>>;
933
1054
  /**
934
- * Update slot by ID
1055
+ * Update slot by ID.
935
1056
  * PUT /api/v1/slots/:id
936
1057
  *
937
- * @param id - Slot ID
938
- * @param data - Slot update data
1058
+ * Accepts any subset of `Slot` fields. For new integrations, prefer the
1059
+ * exported `UpdateSlotInput` type it will become the enforced signature
1060
+ * in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
1061
+ *
1062
+ * New fields available as of v1.4: `starts_at`, `ends_at`, `metadata`.
1063
+ *
1064
+ * @param id - Slot ID
1065
+ * @param data - Fields to update
939
1066
  * @returns Updated slot
940
1067
  */
941
1068
  update(id: string, data: Partial<Slot>): Promise<ApiResponse<Slot>>;
@@ -954,10 +1081,20 @@ declare class SlotClient {
954
1081
  * @param slots - Array of slots to create
955
1082
  * @returns Created slots
956
1083
  */
1084
+ /**
1085
+ * Bulk create slots.
1086
+ * POST /api/v1/slots/bulk
1087
+ *
1088
+ * For new integrations, prefer passing `CreateSlotInput[]` — it will become
1089
+ * the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
1090
+ */
957
1091
  bulkCreate(slots: Partial<Slot>[]): Promise<ApiResponse<Slot[]>>;
958
1092
  /**
959
- * Mark slot as available/unavailable
960
- * Note: Use update() method with status or other fields
1093
+ * Mark slot as available (live) or unavailable (archived).
1094
+ *
1095
+ * Note: previous versions sent 'active'/'inactive' which were not valid DB
1096
+ * enum values. Fixed in v1.4 to use 'live'/'archived' — the only valid
1097
+ * non-draft statuses. If you need 'draft', use update() directly.
961
1098
  */
962
1099
  setAvailability(id: string, available: boolean): Promise<ApiResponse<Slot>>;
963
1100
  /**
@@ -1468,6 +1605,34 @@ declare class DocumentClient {
1468
1605
  }): Promise<Artifact>;
1469
1606
  }
1470
1607
 
1608
+ /**
1609
+ * NoticesClient — read active slot-scoped operational notices.
1610
+ *
1611
+ * Notices are a product concept (early closure, venue change, general alert)
1612
+ * backed by `slot_moments` internally — the SDK surface reflects the product,
1613
+ * not the storage model. Each notice's attached graphic (if any) is already
1614
+ * resolved to a signed `imageUrl` server-side.
1615
+ *
1616
+ * @example List active notices for a tenant
1617
+ * ```ts
1618
+ * const { data } = await slotly.notices.list({ tenantId });
1619
+ * ```
1620
+ */
1621
+ declare class NoticesClient {
1622
+ private readonly client;
1623
+ private readonly base;
1624
+ constructor(client: AxiosInstance);
1625
+ /**
1626
+ * List active notices for a tenant.
1627
+ * Returns only notices where visible_until > activeAt (default: now).
1628
+ */
1629
+ list(options: ListNoticesOptions): Promise<ApiResponse<SlotNotice[]>>;
1630
+ /**
1631
+ * Get a single notice by its slot_moment id.
1632
+ */
1633
+ getById(id: string, tenantId: string): Promise<SlotNotice>;
1634
+ }
1635
+
1471
1636
  /**
1472
1637
  * Custom error classes for Slotly SDK
1473
1638
  */
@@ -1632,6 +1797,8 @@ interface SlotlyApi {
1632
1797
  organization: OrganizationClient;
1633
1798
  /** Upload and retrieve file artifacts (CVs, invoices, images) linked to any Slotly entity */
1634
1799
  document: DocumentClient;
1800
+ /** List slot-scoped operational notices (early closure, venue change, general alerts) */
1801
+ notices: NoticesClient;
1635
1802
  }
1636
1803
  /**
1637
1804
  * Initialize and configure a new Slotly API client with dual authentication.
@@ -1696,4 +1863,4 @@ interface SlotlyApi {
1696
1863
  */
1697
1864
  declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
1698
1865
 
1699
- export { type ApiResponse, type Artifact, type ArtifactEntityType, type ArtifactMimeCategory, type ArtifactWithUrl, type Booking, type BookingWithSlot, type Category, type Customer, type CustomerIdentity, type CustomerWithBookings, type CustomerWithIdentities, type DataQualityIssue, type FindOrCreateCustomerOptions, type Flow, type FlowStep, type GetOrganizationOptions, type ListArtifactsOptions, type ListBookingsOptions, type Notification, type NotificationPreferences, type Organization, type OrganizationFullConfig, type ResolveCustomerOptions, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotServiceWithItems, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, type UploadArtifactOptions, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
1866
+ export { type ApiResponse, type Artifact, type ArtifactEntityType, type ArtifactMimeCategory, type ArtifactWithUrl, type Booking, type BookingWithSlot, type Category, type CreateSlotInput, type Customer, type CustomerIdentity, type CustomerWithBookings, type CustomerWithIdentities, type DataQualityIssue, type FindOrCreateCustomerOptions, type Flow, type FlowStep, type GetOrganizationOptions, type ListArtifactsOptions, type ListBookingsOptions, type ListNoticesOptions, type NoticeMomentType, type Notification, type NotificationPreferences, type Organization, type OrganizationFullConfig, type ResolveCustomerOptions, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotMetadata, type SlotNotice, type SlotServiceWithItems, type SlotlyApi, SlotlyApiError, type SlotlyAuthContext, SlotlyAuthError, type SlotlyClientOptions, SlotlyConfigurationError, SlotlyNetworkError, type SlotlyRequest, type Studio, type Tenant, type TenantBranding, type TenantFullConfig, type UpdateSlotInput, type UploadArtifactOptions, useSlotly as default, getSlotlyContext, useSlotly, validateSlotlyRequest };
package/dist/index.esm.js CHANGED
@@ -699,11 +699,27 @@ var SlotClient = class {
699
699
  return response.data;
700
700
  }
701
701
  /**
702
- * Create a new slot
702
+ * Create a new slot.
703
703
  * POST /api/v1/slots
704
- *
705
- * @param data - Slot creation data (tenant_id, name required)
704
+ *
705
+ * Accepts any subset of `Slot` fields. For new integrations, prefer the
706
+ * exported `CreateSlotInput` type which documents the recommended shape
707
+ * and will become the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
708
+ *
709
+ * New fields available as of v1.4:
710
+ * - `starts_at` — ISO 8601 datetime when the slot opens
711
+ * - `ends_at` — ISO 8601 datetime when the slot closes (omit for open-ended slots)
712
+ * - `metadata` — term enrichment bag (term_name, season, half_term_start,
713
+ * half_term_end, capacity); see `SlotMetadata` type
714
+ *
715
+ * @param data - Slot creation data
706
716
  * @returns Created slot
717
+ *
718
+ * @example
719
+ * // Recommended — opt into stricter typing now:
720
+ * import { CreateSlotInput } from '@slotly/sdk';
721
+ * const input: CreateSlotInput = { name: 'Autumn Term', tenant_id: '...', starts_at: '...' };
722
+ * sdk.slots.create(input);
707
723
  */
708
724
  async create(data) {
709
725
  const response = await this.client.post(
@@ -713,11 +729,17 @@ var SlotClient = class {
713
729
  return response.data;
714
730
  }
715
731
  /**
716
- * Update slot by ID
732
+ * Update slot by ID.
717
733
  * PUT /api/v1/slots/:id
718
- *
719
- * @param id - Slot ID
720
- * @param data - Slot update data
734
+ *
735
+ * Accepts any subset of `Slot` fields. For new integrations, prefer the
736
+ * exported `UpdateSlotInput` type it will become the enforced signature
737
+ * in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
738
+ *
739
+ * New fields available as of v1.4: `starts_at`, `ends_at`, `metadata`.
740
+ *
741
+ * @param id - Slot ID
742
+ * @param data - Fields to update
721
743
  * @returns Updated slot
722
744
  */
723
745
  async update(id, data) {
@@ -747,6 +769,13 @@ var SlotClient = class {
747
769
  * @param slots - Array of slots to create
748
770
  * @returns Created slots
749
771
  */
772
+ /**
773
+ * Bulk create slots.
774
+ * POST /api/v1/slots/bulk
775
+ *
776
+ * For new integrations, prefer passing `CreateSlotInput[]` — it will become
777
+ * the enforced signature in v2.0 (see SLOT_TYPE_UPGRADE_PLAN.md).
778
+ */
750
779
  async bulkCreate(slots) {
751
780
  const response = await this.client.post(
752
781
  "/api/v1/slots/bulk",
@@ -755,11 +784,14 @@ var SlotClient = class {
755
784
  return response.data;
756
785
  }
757
786
  /**
758
- * Mark slot as available/unavailable
759
- * Note: Use update() method with status or other fields
787
+ * Mark slot as available (live) or unavailable (archived).
788
+ *
789
+ * Note: previous versions sent 'active'/'inactive' which were not valid DB
790
+ * enum values. Fixed in v1.4 to use 'live'/'archived' — the only valid
791
+ * non-draft statuses. If you need 'draft', use update() directly.
760
792
  */
761
793
  async setAvailability(id, available) {
762
- return this.update(id, { status: available ? "active" : "inactive" });
794
+ return this.update(id, { status: available ? "live" : "archived" });
763
795
  }
764
796
  /**
765
797
  * Get all active services for a slot with their items
@@ -1521,6 +1553,40 @@ var DocumentClient = class {
1521
1553
  }
1522
1554
  };
1523
1555
 
1556
+ // src/clients/notices-client.ts
1557
+ var NoticesClient = class {
1558
+ constructor(client) {
1559
+ this.base = "/api/v1/notices";
1560
+ this.client = client;
1561
+ }
1562
+ /**
1563
+ * List active notices for a tenant.
1564
+ * Returns only notices where visible_until > activeAt (default: now).
1565
+ */
1566
+ async list(options) {
1567
+ const response = await this.client.get(this.base, {
1568
+ params: {
1569
+ tenant_id: options.tenantId,
1570
+ active_at: options.activeAt,
1571
+ slot_id: options.slotId,
1572
+ types: options.types?.join(",")
1573
+ }
1574
+ });
1575
+ return response.data;
1576
+ }
1577
+ /**
1578
+ * Get a single notice by its slot_moment id.
1579
+ */
1580
+ async getById(id, tenantId) {
1581
+ const response = await this.client.get(`${this.base}/${id}`, {
1582
+ params: { tenant_id: tenantId }
1583
+ });
1584
+ const { data } = response.data;
1585
+ if (!data) throw new Error(`Notice ${id} not found`);
1586
+ return data;
1587
+ }
1588
+ };
1589
+
1524
1590
  // src/errors.ts
1525
1591
  var SlotlyApiError = class _SlotlyApiError extends Error {
1526
1592
  constructor(code, message, statusCode, details) {
@@ -1854,7 +1920,8 @@ var useSlotly = (options) => {
1854
1920
  notification: new NotificationClient(client),
1855
1921
  dataQuality: new DataQualityClient(client),
1856
1922
  organization: new OrganizationClient(client),
1857
- document: new DocumentClient(client)
1923
+ document: new DocumentClient(client),
1924
+ notices: new NoticesClient(client)
1858
1925
  };
1859
1926
  };
1860
1927
  var index_default = useSlotly;