@slotchain/sdk 1.4.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
@@ -388,7 +388,7 @@ interface GetOrganizationOptions {
388
388
  /**
389
389
  * Artifact / document attached to a customer or booking
390
390
  */
391
- type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant';
391
+ type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant' | 'slot_moment';
392
392
  type ArtifactMimeCategory = 'pdf' | 'document' | 'image' | 'spreadsheet' | 'video' | 'audio' | 'other';
393
393
  interface Artifact {
394
394
  id: string;
@@ -446,6 +446,46 @@ interface UploadArtifactOptions {
446
446
  mime_type?: string;
447
447
  metadata?: Record<string, unknown>;
448
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
+ }
449
489
  /**
450
490
  * Full tenant configuration including branding, services, and service items
451
491
  * Service items are nested within each service object (not as a separate top-level array)
@@ -1565,6 +1605,34 @@ declare class DocumentClient {
1565
1605
  }): Promise<Artifact>;
1566
1606
  }
1567
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
+
1568
1636
  /**
1569
1637
  * Custom error classes for Slotly SDK
1570
1638
  */
@@ -1729,6 +1797,8 @@ interface SlotlyApi {
1729
1797
  organization: OrganizationClient;
1730
1798
  /** Upload and retrieve file artifacts (CVs, invoices, images) linked to any Slotly entity */
1731
1799
  document: DocumentClient;
1800
+ /** List slot-scoped operational notices (early closure, venue change, general alerts) */
1801
+ notices: NoticesClient;
1732
1802
  }
1733
1803
  /**
1734
1804
  * Initialize and configure a new Slotly API client with dual authentication.
@@ -1793,4 +1863,4 @@ interface SlotlyApi {
1793
1863
  */
1794
1864
  declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
1795
1865
 
1796
- 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 Notification, type NotificationPreferences, type Organization, type OrganizationFullConfig, type ResolveCustomerOptions, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotMetadata, 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 };
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
@@ -388,7 +388,7 @@ interface GetOrganizationOptions {
388
388
  /**
389
389
  * Artifact / document attached to a customer or booking
390
390
  */
391
- type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant';
391
+ type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant' | 'slot_moment';
392
392
  type ArtifactMimeCategory = 'pdf' | 'document' | 'image' | 'spreadsheet' | 'video' | 'audio' | 'other';
393
393
  interface Artifact {
394
394
  id: string;
@@ -446,6 +446,46 @@ interface UploadArtifactOptions {
446
446
  mime_type?: string;
447
447
  metadata?: Record<string, unknown>;
448
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
+ }
449
489
  /**
450
490
  * Full tenant configuration including branding, services, and service items
451
491
  * Service items are nested within each service object (not as a separate top-level array)
@@ -1565,6 +1605,34 @@ declare class DocumentClient {
1565
1605
  }): Promise<Artifact>;
1566
1606
  }
1567
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
+
1568
1636
  /**
1569
1637
  * Custom error classes for Slotly SDK
1570
1638
  */
@@ -1729,6 +1797,8 @@ interface SlotlyApi {
1729
1797
  organization: OrganizationClient;
1730
1798
  /** Upload and retrieve file artifacts (CVs, invoices, images) linked to any Slotly entity */
1731
1799
  document: DocumentClient;
1800
+ /** List slot-scoped operational notices (early closure, venue change, general alerts) */
1801
+ notices: NoticesClient;
1732
1802
  }
1733
1803
  /**
1734
1804
  * Initialize and configure a new Slotly API client with dual authentication.
@@ -1793,4 +1863,4 @@ interface SlotlyApi {
1793
1863
  */
1794
1864
  declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
1795
1865
 
1796
- 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 Notification, type NotificationPreferences, type Organization, type OrganizationFullConfig, type ResolveCustomerOptions, type Service, type ServiceItem, type ServiceItemWithService, type ServiceWithItems, type Slot, type SlotMetadata, 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 };
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
@@ -1553,6 +1553,40 @@ var DocumentClient = class {
1553
1553
  }
1554
1554
  };
1555
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
+
1556
1590
  // src/errors.ts
1557
1591
  var SlotlyApiError = class _SlotlyApiError extends Error {
1558
1592
  constructor(code, message, statusCode, details) {
@@ -1886,7 +1920,8 @@ var useSlotly = (options) => {
1886
1920
  notification: new NotificationClient(client),
1887
1921
  dataQuality: new DataQualityClient(client),
1888
1922
  organization: new OrganizationClient(client),
1889
- document: new DocumentClient(client)
1923
+ document: new DocumentClient(client),
1924
+ notices: new NoticesClient(client)
1890
1925
  };
1891
1926
  };
1892
1927
  var index_default = useSlotly;