@slotchain/sdk 1.4.0 → 1.6.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
@@ -66,6 +66,10 @@ interface ServiceItem {
66
66
  sort_order?: number;
67
67
  created_at: string;
68
68
  updated_at: string;
69
+ /** Set when the item has been soft-deleted. Filtered out by the SDK. */
70
+ deleted_at?: string | null;
71
+ /** Set when the item was withdrawn by the publisher (syndication). Filtered out by the SDK. */
72
+ withdrawn_at?: string | null;
69
73
  }
70
74
  /**
71
75
  * Enhanced Service type with nested service items (for tenant endpoint)
@@ -159,6 +163,8 @@ interface Service {
159
163
  price?: number;
160
164
  created_at: string;
161
165
  updated_at: string;
166
+ /** Set when the service has been soft-deleted. Filtered out by the SDK. */
167
+ deleted_at?: string | null;
162
168
  }
163
169
  /**
164
170
  * Metadata bag for a slot — open-ended key/value store, with well-known
@@ -388,7 +394,7 @@ interface GetOrganizationOptions {
388
394
  /**
389
395
  * Artifact / document attached to a customer or booking
390
396
  */
391
- type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant';
397
+ type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant' | 'slot_moment';
392
398
  type ArtifactMimeCategory = 'pdf' | 'document' | 'image' | 'spreadsheet' | 'video' | 'audio' | 'other';
393
399
  interface Artifact {
394
400
  id: string;
@@ -446,6 +452,59 @@ interface UploadArtifactOptions {
446
452
  mime_type?: string;
447
453
  metadata?: Record<string, unknown>;
448
454
  }
455
+ /**
456
+ * Slot-scoped operational notice (early closure, venue change, general alert).
457
+ * Backed by a `slot_moment` — see NOTICES_PLAN.md in slotly-admin.
458
+ */
459
+ type NoticeMomentType = 'general_notice' | 'early_closure' | 'closure_notice' | 'venue_change';
460
+ /**
461
+ * Optional call-to-action button attached to a notice.
462
+ * `url` is either an absolute http(s) URL or a site-relative path ('/contact-us').
463
+ * Only returned when both halves are present — a partial CTA is dropped server-side.
464
+ */
465
+ interface NoticeCta {
466
+ label: string;
467
+ url: string;
468
+ /** Open the link in a new tab. Defaults to true for notices created without the flag. */
469
+ newTab: boolean;
470
+ }
471
+ interface SlotNotice {
472
+ id: string;
473
+ slotId: string;
474
+ tenantId: string;
475
+ momentType: NoticeMomentType;
476
+ createdAt: string;
477
+ createdBy: string | null;
478
+ notice: {
479
+ type: string;
480
+ title: string;
481
+ message: string;
482
+ /** YYYY-MM-DD — the day the notice applies to */
483
+ affectedDate: string;
484
+ /** HH:MM — only present for early_closure notices */
485
+ closesAt?: string;
486
+ severity: 'info' | 'warning' | 'urgent';
487
+ visibleFrom: string;
488
+ visibleUntil: string;
489
+ dismissible: boolean;
490
+ /** Signed URL for the notice's attached graphic, if one was uploaded */
491
+ imageUrl?: string | null;
492
+ /** Staff-picked display treatment — 'banner' (compact, stacks) or 'modal' (full-screen, one at a time) */
493
+ presentation: 'banner' | 'modal';
494
+ /** Call-to-action button, or null when the notice has none */
495
+ cta?: NoticeCta | null;
496
+ };
497
+ affectedBookingIds: string[];
498
+ }
499
+ interface ListNoticesOptions {
500
+ tenantId: string;
501
+ /** Filter to notices active at this ISO timestamp. Defaults to now. */
502
+ activeAt?: string;
503
+ /** Filter to a specific slot */
504
+ slotId?: string;
505
+ /** Specific notice types to include. Defaults to all notice types. */
506
+ types?: NoticeMomentType[];
507
+ }
449
508
  /**
450
509
  * Full tenant configuration including branding, services, and service items
451
510
  * Service items are nested within each service object (not as a separate top-level array)
@@ -1565,6 +1624,34 @@ declare class DocumentClient {
1565
1624
  }): Promise<Artifact>;
1566
1625
  }
1567
1626
 
1627
+ /**
1628
+ * NoticesClient — read active slot-scoped operational notices.
1629
+ *
1630
+ * Notices are a product concept (early closure, venue change, general alert)
1631
+ * backed by `slot_moments` internally — the SDK surface reflects the product,
1632
+ * not the storage model. Each notice's attached graphic (if any) is already
1633
+ * resolved to a signed `imageUrl` server-side.
1634
+ *
1635
+ * @example List active notices for a tenant
1636
+ * ```ts
1637
+ * const { data } = await slotly.notices.list({ tenantId });
1638
+ * ```
1639
+ */
1640
+ declare class NoticesClient {
1641
+ private readonly client;
1642
+ private readonly base;
1643
+ constructor(client: AxiosInstance);
1644
+ /**
1645
+ * List active notices for a tenant.
1646
+ * Returns only notices where visible_until > activeAt (default: now).
1647
+ */
1648
+ list(options: ListNoticesOptions): Promise<ApiResponse<SlotNotice[]>>;
1649
+ /**
1650
+ * Get a single notice by its slot_moment id.
1651
+ */
1652
+ getById(id: string, tenantId: string): Promise<SlotNotice>;
1653
+ }
1654
+
1568
1655
  /**
1569
1656
  * Custom error classes for Slotly SDK
1570
1657
  */
@@ -1729,6 +1816,8 @@ interface SlotlyApi {
1729
1816
  organization: OrganizationClient;
1730
1817
  /** Upload and retrieve file artifacts (CVs, invoices, images) linked to any Slotly entity */
1731
1818
  document: DocumentClient;
1819
+ /** List slot-scoped operational notices (early closure, venue change, general alerts) */
1820
+ notices: NoticesClient;
1732
1821
  }
1733
1822
  /**
1734
1823
  * Initialize and configure a new Slotly API client with dual authentication.
@@ -1793,4 +1882,4 @@ interface SlotlyApi {
1793
1882
  */
1794
1883
  declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
1795
1884
 
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 };
1885
+ 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 NoticeCta, 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
@@ -66,6 +66,10 @@ interface ServiceItem {
66
66
  sort_order?: number;
67
67
  created_at: string;
68
68
  updated_at: string;
69
+ /** Set when the item has been soft-deleted. Filtered out by the SDK. */
70
+ deleted_at?: string | null;
71
+ /** Set when the item was withdrawn by the publisher (syndication). Filtered out by the SDK. */
72
+ withdrawn_at?: string | null;
69
73
  }
70
74
  /**
71
75
  * Enhanced Service type with nested service items (for tenant endpoint)
@@ -159,6 +163,8 @@ interface Service {
159
163
  price?: number;
160
164
  created_at: string;
161
165
  updated_at: string;
166
+ /** Set when the service has been soft-deleted. Filtered out by the SDK. */
167
+ deleted_at?: string | null;
162
168
  }
163
169
  /**
164
170
  * Metadata bag for a slot — open-ended key/value store, with well-known
@@ -388,7 +394,7 @@ interface GetOrganizationOptions {
388
394
  /**
389
395
  * Artifact / document attached to a customer or booking
390
396
  */
391
- type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant';
397
+ type ArtifactEntityType = 'customer' | 'booking' | 'slot' | 'service' | 'tenant' | 'slot_moment';
392
398
  type ArtifactMimeCategory = 'pdf' | 'document' | 'image' | 'spreadsheet' | 'video' | 'audio' | 'other';
393
399
  interface Artifact {
394
400
  id: string;
@@ -446,6 +452,59 @@ interface UploadArtifactOptions {
446
452
  mime_type?: string;
447
453
  metadata?: Record<string, unknown>;
448
454
  }
455
+ /**
456
+ * Slot-scoped operational notice (early closure, venue change, general alert).
457
+ * Backed by a `slot_moment` — see NOTICES_PLAN.md in slotly-admin.
458
+ */
459
+ type NoticeMomentType = 'general_notice' | 'early_closure' | 'closure_notice' | 'venue_change';
460
+ /**
461
+ * Optional call-to-action button attached to a notice.
462
+ * `url` is either an absolute http(s) URL or a site-relative path ('/contact-us').
463
+ * Only returned when both halves are present — a partial CTA is dropped server-side.
464
+ */
465
+ interface NoticeCta {
466
+ label: string;
467
+ url: string;
468
+ /** Open the link in a new tab. Defaults to true for notices created without the flag. */
469
+ newTab: boolean;
470
+ }
471
+ interface SlotNotice {
472
+ id: string;
473
+ slotId: string;
474
+ tenantId: string;
475
+ momentType: NoticeMomentType;
476
+ createdAt: string;
477
+ createdBy: string | null;
478
+ notice: {
479
+ type: string;
480
+ title: string;
481
+ message: string;
482
+ /** YYYY-MM-DD — the day the notice applies to */
483
+ affectedDate: string;
484
+ /** HH:MM — only present for early_closure notices */
485
+ closesAt?: string;
486
+ severity: 'info' | 'warning' | 'urgent';
487
+ visibleFrom: string;
488
+ visibleUntil: string;
489
+ dismissible: boolean;
490
+ /** Signed URL for the notice's attached graphic, if one was uploaded */
491
+ imageUrl?: string | null;
492
+ /** Staff-picked display treatment — 'banner' (compact, stacks) or 'modal' (full-screen, one at a time) */
493
+ presentation: 'banner' | 'modal';
494
+ /** Call-to-action button, or null when the notice has none */
495
+ cta?: NoticeCta | null;
496
+ };
497
+ affectedBookingIds: string[];
498
+ }
499
+ interface ListNoticesOptions {
500
+ tenantId: string;
501
+ /** Filter to notices active at this ISO timestamp. Defaults to now. */
502
+ activeAt?: string;
503
+ /** Filter to a specific slot */
504
+ slotId?: string;
505
+ /** Specific notice types to include. Defaults to all notice types. */
506
+ types?: NoticeMomentType[];
507
+ }
449
508
  /**
450
509
  * Full tenant configuration including branding, services, and service items
451
510
  * Service items are nested within each service object (not as a separate top-level array)
@@ -1565,6 +1624,34 @@ declare class DocumentClient {
1565
1624
  }): Promise<Artifact>;
1566
1625
  }
1567
1626
 
1627
+ /**
1628
+ * NoticesClient — read active slot-scoped operational notices.
1629
+ *
1630
+ * Notices are a product concept (early closure, venue change, general alert)
1631
+ * backed by `slot_moments` internally — the SDK surface reflects the product,
1632
+ * not the storage model. Each notice's attached graphic (if any) is already
1633
+ * resolved to a signed `imageUrl` server-side.
1634
+ *
1635
+ * @example List active notices for a tenant
1636
+ * ```ts
1637
+ * const { data } = await slotly.notices.list({ tenantId });
1638
+ * ```
1639
+ */
1640
+ declare class NoticesClient {
1641
+ private readonly client;
1642
+ private readonly base;
1643
+ constructor(client: AxiosInstance);
1644
+ /**
1645
+ * List active notices for a tenant.
1646
+ * Returns only notices where visible_until > activeAt (default: now).
1647
+ */
1648
+ list(options: ListNoticesOptions): Promise<ApiResponse<SlotNotice[]>>;
1649
+ /**
1650
+ * Get a single notice by its slot_moment id.
1651
+ */
1652
+ getById(id: string, tenantId: string): Promise<SlotNotice>;
1653
+ }
1654
+
1568
1655
  /**
1569
1656
  * Custom error classes for Slotly SDK
1570
1657
  */
@@ -1729,6 +1816,8 @@ interface SlotlyApi {
1729
1816
  organization: OrganizationClient;
1730
1817
  /** Upload and retrieve file artifacts (CVs, invoices, images) linked to any Slotly entity */
1731
1818
  document: DocumentClient;
1819
+ /** List slot-scoped operational notices (early closure, venue change, general alerts) */
1820
+ notices: NoticesClient;
1732
1821
  }
1733
1822
  /**
1734
1823
  * Initialize and configure a new Slotly API client with dual authentication.
@@ -1793,4 +1882,4 @@ interface SlotlyApi {
1793
1882
  */
1794
1883
  declare const useSlotly: (options: SlotlyClientOptions) => SlotlyApi;
1795
1884
 
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 };
1885
+ 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 NoticeCta, 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
@@ -157,7 +157,16 @@ var TenantClient = class {
157
157
  `/api/v1/tenants/${slug}`,
158
158
  { params: { includeServices } }
159
159
  );
160
- return response.data;
160
+ const data = response.data;
161
+ if (data?.data?.services) {
162
+ data.data.services = data.data.services.filter((s) => !s.deleted_at).map((s) => ({
163
+ ...s,
164
+ serviceItems: (s.serviceItems ?? []).filter(
165
+ (item) => !item.deleted_at && !item.withdrawn_at
166
+ )
167
+ }));
168
+ }
169
+ return data;
161
170
  }
162
171
  };
163
172
 
@@ -1553,6 +1562,40 @@ var DocumentClient = class {
1553
1562
  }
1554
1563
  };
1555
1564
 
1565
+ // src/clients/notices-client.ts
1566
+ var NoticesClient = class {
1567
+ constructor(client) {
1568
+ this.base = "/api/v1/notices";
1569
+ this.client = client;
1570
+ }
1571
+ /**
1572
+ * List active notices for a tenant.
1573
+ * Returns only notices where visible_until > activeAt (default: now).
1574
+ */
1575
+ async list(options) {
1576
+ const response = await this.client.get(this.base, {
1577
+ params: {
1578
+ tenant_id: options.tenantId,
1579
+ active_at: options.activeAt,
1580
+ slot_id: options.slotId,
1581
+ types: options.types?.join(",")
1582
+ }
1583
+ });
1584
+ return response.data;
1585
+ }
1586
+ /**
1587
+ * Get a single notice by its slot_moment id.
1588
+ */
1589
+ async getById(id, tenantId) {
1590
+ const response = await this.client.get(`${this.base}/${id}`, {
1591
+ params: { tenant_id: tenantId }
1592
+ });
1593
+ const { data } = response.data;
1594
+ if (!data) throw new Error(`Notice ${id} not found`);
1595
+ return data;
1596
+ }
1597
+ };
1598
+
1556
1599
  // src/errors.ts
1557
1600
  var SlotlyApiError = class _SlotlyApiError extends Error {
1558
1601
  constructor(code, message, statusCode, details) {
@@ -1886,7 +1929,8 @@ var useSlotly = (options) => {
1886
1929
  notification: new NotificationClient(client),
1887
1930
  dataQuality: new DataQualityClient(client),
1888
1931
  organization: new OrganizationClient(client),
1889
- document: new DocumentClient(client)
1932
+ document: new DocumentClient(client),
1933
+ notices: new NoticesClient(client)
1890
1934
  };
1891
1935
  };
1892
1936
  var index_default = useSlotly;