@proveanything/smartlinks 2.1.32 → 2.1.34

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.
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.1.32 | Generated: 2026-11-20T14:23:37.441Z
3
+ Version: 2.1.34 | Generated: 2026-11-20T19:32:22.299Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -137,6 +137,7 @@ The Smartlinks SDK is organized into the following namespaces:
137
137
  - **serialNumber** - Assign, lookup, and manage serial numbers across scopes.
138
138
 
139
139
  — Other —
140
+ - **address** - Functions for address operations
140
141
  - **adminCards** - Functions for adminCards operations
141
142
  - **aiGuide** - Functions for aiGuide operations
142
143
  - **analytics** - Functions for analytics operations
@@ -487,6 +488,67 @@ Examples include:
487
488
 
488
489
  ## Types
489
490
 
491
+ ### address
492
+
493
+ **AddressPage** (interface)
494
+ ```typescript
495
+ interface AddressPage {
496
+ appId: string
497
+ title: string
498
+ name: string
499
+ defaultName: string
500
+ listed: boolean
501
+ live: boolean
502
+ url: string
503
+ }
504
+ ```
505
+
506
+ **AddressWebsite** (interface)
507
+ ```typescript
508
+ interface AddressWebsite {
509
+ appId: string
510
+ title: string
511
+ live: boolean
512
+ channel: string | null
513
+ }
514
+ ```
515
+
516
+ **AddressResponse** (interface)
517
+ ```typescript
518
+ interface AddressResponse {
519
+ name: string | null
520
+ host: string
521
+ defaultHost: string | null
522
+ domain: { host: string; live: boolean } | null
523
+ front: AddressFront
524
+ websites: AddressWebsite[]
525
+ pages: AddressPage[]
526
+ }
527
+ ```
528
+
529
+ **AddressNameAvailability** (interface)
530
+ ```typescript
531
+ interface AddressNameAvailability {
532
+ available: boolean
533
+ host: string
534
+ }
535
+ ```
536
+
537
+ **AppPageLink** (interface)
538
+ ```typescript
539
+ interface AppPageLink {
540
+ url: string
541
+ pageUrl: string
542
+ name: string
543
+ live: boolean
544
+ isFront: boolean
545
+ host: string
546
+ channel: string | null
547
+ }
548
+ ```
549
+
550
+ **AddressFront** = ``
551
+
490
552
  ### adminCards
491
553
 
492
554
  **AdminCardRefresh** (interface)
@@ -12796,6 +12858,26 @@ interface Gs1DigitalLinkParams {
12796
12858
 
12797
12859
  ## API Functions
12798
12860
 
12861
+ ### address
12862
+
12863
+ **page**(collectionId: string, appId: string) → `Promise<AppPageLink | null>`
12864
+ Where an app's public page is, on the business's own address. Public: use it from the app's admin ("Open the game") and from share buttons, instead of building the CDN address by hand. Add the app's own route to it: `${link.url}#/play`. The page carries no collectionId or appId: the address says it. Resolves null when the app has no page on that collection (not installed, or a connector). const link = await SL.address.page(collectionId, appId) window.open(`${link?.url ?? fallback}#/play`, '_blank')
12865
+
12866
+ **get**(collectionId: string) → `Promise<AddressResponse>`
12867
+ Everything about the business's address: name, own domain, front page, websites that can take it, app pages.
12868
+
12869
+ **checkName**(collectionId: string, name: string) → `Promise<AddressNameAvailability>`
12870
+ Is this name free? (lower-case letters, numbers and hyphens)
12871
+
12872
+ **setName**(collectionId: string, name: string) → `Promise<`
12873
+ Choose (or change) the business's name: `<name>.smartlinks.host`. The previous name is released.
12874
+
12875
+ **setFront**(collectionId: string, front: AddressFront) → `Promise<`
12876
+ What the front page shows. Applies to the business's name, its automatic address and its own domain together. A website must be installed and live; a redirect must be https and not one of its own addresses.
12877
+
12878
+ **setPage**(collectionId: string, appId: string, change: { name?: string; listed?: boolean }) → `Promise<`
12879
+ Rename an app's page (old names keep redirecting) and/or show it on the holding page.
12880
+
12799
12881
  ### adminCards
12800
12882
 
12801
12883
  **list**(collectionId: string) → `Promise<AdminCardsResponse>`
@@ -14568,38 +14650,38 @@ POST /api/v1/public/collection/:collectionId/interactions/submit Submits an inte
14568
14650
 
14569
14651
  **ensureType**(collectionId: string,
14570
14652
  input: EnsureInteractionTypeInput) → `Promise<InteractionTypeRecord>`
14571
- Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId
14653
+ Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, display: { title: 'Cast a vote', description: 'Someone voted in the poll' }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId // Always give display.title: it's the name staff see in the CRM, on activity and when choosing // "everyone who voted" for a segment. (Without one the platform names it from the key.)
14572
14654
 
14573
14655
  **get**(collectionId: string,
14574
14656
  id: string) → `Promise<InteractionTypeRecord>`
14575
- Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId
14657
+ Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, display: { title: 'Cast a vote', description: 'Someone voted in the poll' }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId // Always give display.title: it's the name staff see in the CRM, on activity and when choosing // "everyone who voted" for a segment. (Without one the platform names it from the key.)
14576
14658
 
14577
14659
  **update**(collectionId: string,
14578
14660
  id: string,
14579
14661
  patchBody: UpdateInteractionTypeBody) → `Promise<InteractionTypeRecord>`
14580
- Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId
14662
+ Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, display: { title: 'Cast a vote', description: 'Someone voted in the poll' }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId // Always give display.title: it's the name staff see in the CRM, on activity and when choosing // "everyone who voted" for a segment. (Without one the platform names it from the key.)
14581
14663
 
14582
14664
  **remove**(collectionId: string,
14583
14665
  id: string) → `Promise<void>`
14584
- Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId
14666
+ Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, display: { title: 'Cast a vote', description: 'Someone voted in the poll' }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId // Always give display.title: it's the name staff see in the CRM, on activity and when choosing // "everyone who voted" for a segment. (Without one the platform names it from the key.)
14585
14667
 
14586
14668
  **publicCountsByOutcome**(collectionId: string,
14587
14669
  body: PublicInteractionsCountsByOutcomeRequest,
14588
14670
  authToken?: string) → `Promise<OutcomeCount[]>`
14589
- Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId
14671
+ Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, display: { title: 'Cast a vote', description: 'Someone voted in the poll' }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId // Always give display.title: it's the name staff see in the CRM, on activity and when choosing // "everyone who voted" for a segment. (Without one the platform names it from the key.)
14590
14672
 
14591
14673
  **publicMyInteractions**(collectionId: string,
14592
14674
  body: PublicInteractionsByUserRequest,
14593
14675
  authToken?: string) → `Promise<InteractionEventRow[]>`
14594
- Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId
14676
+ Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, display: { title: 'Cast a vote', description: 'Someone voted in the poll' }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId // Always give display.title: it's the name staff see in the CRM, on activity and when choosing // "everyone who voted" for a segment. (Without one the platform names it from the key.)
14595
14677
 
14596
14678
  **publicList**(collectionId: string,
14597
14679
  query: ListInteractionTypesQuery = {}) → `Promise<InteractionTypeList>`
14598
- Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId
14680
+ Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, display: { title: 'Cast a vote', description: 'Someone voted in the poll' }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId // Always give display.title: it's the name staff see in the CRM, on activity and when choosing // "everyone who voted" for a segment. (Without one the platform names it from the key.)
14599
14681
 
14600
14682
  **publicGet**(collectionId: string,
14601
14683
  id: string) → `Promise<InteractionTypeRecord>`
14602
- Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId
14684
+ Find this app's interaction type by its readable `key` (data.interactionType), or create it. Returns the type record — its `id` is the server-minted UUID every event must use. ADMIN only (run it in your admin/setup screen), then store the id in your app config so public code can read it: `interactionIds: { vote: type.id }`. Safe to run on every setup. const vote = await SL.interactions.ensureType(collectionId, { appId: 'my-app', key: 'vote', permissions: { allowPublicSubmit: true, uniquePerUser: true }, display: { title: 'Cast a vote', description: 'Someone voted in the poll' }, }) // vote.id → '52bab6fa-…' — store it in config; never hardcode 'vote' as an interactionId // Always give display.title: it's the name staff see in the CRM, on activity and when choosing // "everyone who voted" for a segment. (Without one the platform names it from the key.)
14603
14685
 
14604
14686
  ### jobs
14605
14687
 
@@ -132,6 +132,100 @@ SL.adminViews.openApp({ appId: 'crm', view: 'contact', params: { contactId } })
132
132
  - **Name the views you link to** in your docs (`crm: contact`, `messages: log` with `contact`), and
133
133
  keep their ids stable: other apps use them.
134
134
 
135
+ ## Opening the platform's screens: `open` by name
136
+
137
+ Your admin screens sit inside Studio, next to the platform's own screens. **Link to them; don't copy them.**
138
+ To message someone, open the Messages composer. To show a person, open their contact. Don't build your own
139
+ email pop-up, contact page or message log.
140
+
141
+ ```ts
142
+ // Message this person, tied to the booking: it is logged against the booking and links back to it
143
+ SL.adminViews.open('message.compose', {
144
+ contactId,
145
+ about: { type: 'booking', id: bookingId, view: 'booking', params: { bookingId }, label: 'Sat 3pm' },
146
+ })
147
+ SL.adminViews.open('contact', { contactId }) // the person, in Customers
148
+ SL.adminViews.open('contact.messages', { contactId }) // everything sent to them
149
+ SL.adminViews.open('settings.domain') // a Studio settings page
150
+ ```
151
+
152
+ You name **what** to open, never which app has it. Studio decides that, so your link keeps working if
153
+ the screen moves to another app. `open` resolves with `{ ok, reason? }`:
154
+
155
+ | `reason` | Meaning |
156
+ |---|---|
157
+ | `no-host` | Not inside Studio (the admin page opened on its own) |
158
+ | `not-here` | That screen's app isn't on in this business |
159
+ | `unknown` | Studio doesn't know the name |
160
+ | `missing-param` | A required param is missing |
161
+ | `preview` | Forge preview: it showed what would open instead |
162
+
163
+ ### Ask first: `canOpen`
164
+
165
+ ```ts
166
+ const canMessage = await SL.adminViews.canOpen('message.compose')
167
+ // SL.adminViews.available() → ['contact', 'message.compose', 'settings.domain', …]
168
+ ```
169
+
170
+ - If it's `false`, hide the button, or tell the owner what to switch on ("Switch on Messages to send
171
+ messages").
172
+ - Build your own version only when the platform has nothing for it.
173
+ - `canOpen` answers at once inside Studio. With no host, it answers `false` after a short wait.
174
+
175
+ ### The names
176
+
177
+ | Name | Params (**required**) | Opens |
178
+ |---|---|---|
179
+ | `contacts` | | The contacts list (Customers) |
180
+ | `contact` | **contactId** | One contact |
181
+ | `contact.messages` | **contactId** | The Message log for that person |
182
+ | `conversation` | **conversationId** | One conversation (Messages) |
183
+ | `segment` | **segmentId** | One segment (Customers) |
184
+ | `message.compose` | contactId, about | The composer, to that person (or choose who) |
185
+ | `message.log` | contactId, about | The Message log, filtered |
186
+ | `campaign.new` | segmentId | A new campaign to that segment |
187
+ | `campaign` | **campaignId** | One campaign |
188
+ | `templates` | | The email and message templates |
189
+ | `template` | **templateId** | One template in the editor |
190
+ | `product` | **productId** | One product (Items) |
191
+ | `proof` | **productId**, **proofId** | One item of a product |
192
+ | `interaction.type` | **interactionId** | One interaction type (Customers) |
193
+ | `settings` | | Studio → Settings |
194
+ | `settings.address` | `appId`? | Your address: the business's name, front page, app pages (with `appId`, that app's page: where the owner renames it or makes it the front page) and links domain. Put a "Change this address" link beside any link to your app's page. |
195
+ | `settings.domain` · `.languages` · `.translations` · `.email` · `.team` · `.userGroups` | | That Studio page |
196
+ | `settings.setupLists` | appId | Set-up lists, for that app |
197
+ | `settings.portal` · `.hub` · `.signIn` | | The Portal, the Hub, customer sign-in |
198
+ | `media` | | Images and files |
199
+ | `app` | **appId**, view, params | Another app at one of its screens, as `openApp` |
200
+
201
+ `SL.adminViews.DESTINATIONS` has the same list in code.
202
+
203
+ ### `about`: what a message is for
204
+
205
+ `message.compose` and `message.log` take `about`, the same shape as `comms.sendTransactional`
206
+ ([comms.md](comms.md), "What a message is about"). `appId` defaults to your app.
207
+ - **The composer** sends it with the message. The Message log then shows the message against your
208
+ record ("Bookings · Sat 3pm"), with a link back to your screen (`view` + `params`).
209
+ - **The log** shows only the messages about that record.
210
+
211
+ ### Messaging many people
212
+
213
+ One message to many people (everyone who booked, entered or joined) is a **campaign**: it has opt-in, an
214
+ unsubscribe, a report, and no cap. Never loop over people sending one message each.
215
+ 1. Record an interaction or a tag on each person when they book.
216
+ 2. Make a segment in Customers for that interaction or tag.
217
+ 3. Open `campaign.new` with the segment.
218
+
219
+ A server function may still send one service message itself (a confirmation, a reminder:
220
+ `ctx.sl.messages.send`). A message a person writes goes through the composer.
221
+
222
+ ### Hosts
223
+
224
+ The host answers `smartlinks:open` `{ id, to, params, about?, appParams? }` with `smartlinks:open-result`
225
+ `{ id, to, ok, reason? }`. It posts `smartlinks:destinations` `{ available }` on load, on request
226
+ (`smartlinks:destinations-request`) and whenever the list changes. Helpers: `SL.adminViews.postDestinations`
227
+ and `SL.adminViews.postOpenResult`.
228
+
135
229
  ## `chrome=none`: the host carries the menu
136
230
 
137
231
  When a host's own menu already lists an app's views, it opens the app with `chrome=none`. The app then
@@ -400,6 +400,25 @@ page. Without this, those routes/modes are invisible to the platform and the Dev
400
400
 
401
401
  Read the URL params with **`SL.readContext()`** (merges hash → search) instead of hand-rolling it.
402
402
 
403
+ ##### The app's page on the business's address (`/_apps/<name>/`)
404
+
405
+ Every installed app with a public page also answers on the business's own address:
406
+ `https://<business>.smartlinks.host/_apps/<name>/#/your-route` (or their own domain). The name defaults to
407
+ the app id without its publisher handle and the business can rename it. There, the platform tells the page
408
+ who it belongs to, so **the URL carries no `collectionId` or `appId`**:
409
+
410
+ - Read context with **`SL.readContext()`**: it fills `collectionId` and `appId` from the page's address
411
+ when the URL doesn't carry them, and `basePath` (`/_apps/<name>`) for building share links:
412
+ `` `https://${location.host}${ctx.basePath ?? ''}/#/play` ``.
413
+ - Build with a **relative base** (`base: './'` in Vite) so assets load under `/_apps/<name>/`.
414
+ - Use hash routes (`#/play`); the path after `/_apps/<name>/` is served the app's `index.html` either way.
415
+ - Never put `collectionId` in your own share links: the address already says which business it is.
416
+ - **Linking to your page from anywhere else** (your admin's "Open the game", a QR code, an email): ask
417
+ where it is with **`await SL.address.page(collectionId, appId)`** and use its `url` plus your route
418
+ (`${link.url}#/play`). Never build `smartlinks.app/apps/<id>/stable/index.html…` by hand: the business
419
+ may have renamed the page, made it its front page, or put it on its own domain, and `url` follows all of
420
+ that. It's a test build's automatic address until the app is live there.
421
+
403
422
  ##### Public views vs the two portal surfaces
404
423
 
405
424
  An app can have any combination of three setup styles. Only public views are external:
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { iframe } from "./iframe.js";
5
5
  export { readContext } from "./context.js";
6
6
  export * as i18n from "./i18n.js";
7
7
  export * as adminViews from "./adminViews.js";
8
- export type { NavigateRequest, NavigateTarget, OpenAppRequest } from "./adminViews.js";
8
+ export type { NavigateRequest, NavigateTarget, OpenAppRequest, Destination, DestinationInfo, DestinationAbout, OpenParams, OpenResult } from "./adminViews.js";
9
9
  export { widgetStyleVars, widgetStyleControls, readableOn, WIDGET_STYLE_VARS } from "./widgetStyle.js";
10
10
  export type { WidgetStyling } from "./widgetStyle.js";
11
11
  export type { SmartLinksContext } from "./context.js";
package/dist/openapi.yaml CHANGED
@@ -10,6 +10,8 @@ servers:
10
10
  - url: "https://smartlinks.app/api/v1"
11
11
  description: Production
12
12
  tags:
13
+ - name: address
14
+ description: address API
13
15
  - name: responses
14
16
  description: Agentic responses API (server-tool runs).
15
17
  - name: completions
@@ -11954,6 +11956,37 @@ paths:
11954
11956
  description: Unauthorized
11955
11957
  404:
11956
11958
  description: Not found
11959
+ /public/collection/{collectionId}/app/{appId}/page:
11960
+ get:
11961
+ tags:
11962
+ - address
11963
+ summary: "Where an app's public page is, on the business's own address."
11964
+ operationId: address_page
11965
+ security: []
11966
+ parameters:
11967
+ - name: collectionId
11968
+ in: path
11969
+ required: true
11970
+ schema:
11971
+ type: string
11972
+ - name: appId
11973
+ in: path
11974
+ required: true
11975
+ schema:
11976
+ type: string
11977
+ responses:
11978
+ 200:
11979
+ description: Success
11980
+ content:
11981
+ application/json:
11982
+ schema:
11983
+ $ref: "#/components/schemas/AppPageLink"
11984
+ 400:
11985
+ description: Bad request
11986
+ 401:
11987
+ description: Unauthorized
11988
+ 404:
11989
+ description: Not found
11957
11990
  /public/collection/{collectionId}/asset:
11958
11991
  get:
11959
11992
  tags:
@@ -17408,6 +17441,115 @@ components:
17408
17441
  name: X-API-Key
17409
17442
  description: API key for server-to-server calls
17410
17443
  schemas:
17444
+ AddressPage:
17445
+ type: object
17446
+ properties:
17447
+ appId:
17448
+ type: string
17449
+ title:
17450
+ type: string
17451
+ name:
17452
+ type: string
17453
+ defaultName:
17454
+ type: string
17455
+ listed:
17456
+ type: boolean
17457
+ live:
17458
+ type: boolean
17459
+ url:
17460
+ type: string
17461
+ required:
17462
+ - appId
17463
+ - title
17464
+ - name
17465
+ - defaultName
17466
+ - listed
17467
+ - live
17468
+ - url
17469
+ AddressWebsite:
17470
+ type: object
17471
+ properties:
17472
+ appId:
17473
+ type: string
17474
+ title:
17475
+ type: string
17476
+ live:
17477
+ type: boolean
17478
+ channel:
17479
+ type: string
17480
+ required:
17481
+ - appId
17482
+ - title
17483
+ - live
17484
+ - channel
17485
+ AddressResponse:
17486
+ type: object
17487
+ properties:
17488
+ name:
17489
+ type: string
17490
+ host:
17491
+ type: string
17492
+ defaultHost:
17493
+ type: string
17494
+ domain:
17495
+ type: object
17496
+ additionalProperties: true
17497
+ front:
17498
+ $ref: "#/components/schemas/AddressFront"
17499
+ websites:
17500
+ type: array
17501
+ items:
17502
+ $ref: "#/components/schemas/AddressWebsite"
17503
+ pages:
17504
+ type: array
17505
+ items:
17506
+ $ref: "#/components/schemas/AddressPage"
17507
+ required:
17508
+ - name
17509
+ - host
17510
+ - defaultHost
17511
+ - domain
17512
+ - front
17513
+ - websites
17514
+ - pages
17515
+ AddressNameAvailability:
17516
+ type: object
17517
+ properties:
17518
+ available:
17519
+ type: boolean
17520
+ host:
17521
+ type: string
17522
+ required:
17523
+ - available
17524
+ - host
17525
+ AppPageLink:
17526
+ type: object
17527
+ properties:
17528
+ url:
17529
+ type: string
17530
+ pageUrl:
17531
+ type: string
17532
+ name:
17533
+ type: string
17534
+ live:
17535
+ type: boolean
17536
+ isFront:
17537
+ type: boolean
17538
+ host:
17539
+ type: string
17540
+ channel:
17541
+ type: string
17542
+ required:
17543
+ - url
17544
+ - pageUrl
17545
+ - name
17546
+ - live
17547
+ - isFront
17548
+ - host
17549
+ - channel
17550
+ AddressFront:
17551
+ type: object
17552
+ additionalProperties: true
17411
17553
  AdminCardRefresh:
17412
17554
  type: object
17413
17555
  properties:
package/dist/site.d.ts CHANGED
@@ -13,6 +13,11 @@ export interface SiteContext {
13
13
  channel: string;
14
14
  /** Where search engines consolidate the site (custom domain > chosen name > automatic address). */
15
15
  canonicalHost: string;
16
+ /**
17
+ * Set when the app is served as a page under the business's address (`/_apps/<name>`): build links and
18
+ * share buttons to the app from it, e.g. `https://${canonicalHost}${basePath}/`.
19
+ */
20
+ basePath?: string;
16
21
  }
17
22
  type HeaderSource = {
18
23
  headers: Headers | Record<string, string | string[] | undefined>;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * A business's ADDRESS (prove docs/design/business-address.md): its name on smartlinks.host, its own
3
+ * domain, what its front page shows, and its apps' public pages under `/_apps/<name>/`.
4
+ */
5
+ /** What the business's own address shows at its front page. */
6
+ export type AddressFront =
7
+ /** The collection's Hub (the default until the business chooses). `chosen: false` when never chosen. */
8
+ {
9
+ kind: 'hub';
10
+ chosen?: boolean;
11
+ }
12
+ /** A website built in Forge, installed on the collection and live (stable). */
13
+ | {
14
+ kind: 'website';
15
+ appId: string;
16
+ }
17
+ /** One of the business's apps as its whole front page (its only game, say): installed and live. */
18
+ | {
19
+ kind: 'app';
20
+ appId: string;
21
+ }
22
+ /** Send visitors to another address. Temporary (302) unless `permanent`; `keepPath` carries /about → target/about. */
23
+ | {
24
+ kind: 'redirect';
25
+ url: string;
26
+ keepPath?: boolean;
27
+ permanent?: boolean;
28
+ }
29
+ /** A simple page with the business's name, logo and the app pages it chose to show. */
30
+ | {
31
+ kind: 'holding';
32
+ };
33
+ /** An installed app's public page on the business's address. */
34
+ export interface AddressPage {
35
+ appId: string;
36
+ /** The app's name as installed. */
37
+ title: string;
38
+ /** The page name: `https://<address>/_apps/<name>/`. */
39
+ name: string;
40
+ /** What the name is when never changed: the app id without its publisher handle. */
41
+ defaultName: string;
42
+ /** Shown on the holding page. */
43
+ listed: boolean;
44
+ /** Live (stable, released): its page works on the business's chosen name, and it can be the front page. */
45
+ live: boolean;
46
+ /** The full address of the page, on the business's main address. */
47
+ url: string;
48
+ }
49
+ /** A website installed on the collection: what the front page can show. */
50
+ export interface AddressWebsite {
51
+ appId: string;
52
+ title: string;
53
+ /** Live (on stable): only a live website can be the front page. */
54
+ live: boolean;
55
+ channel: string | null;
56
+ }
57
+ export interface AddressResponse {
58
+ /** The business's chosen name, or null when it hasn't chosen one (it uses `defaultHost`). */
59
+ name: string | null;
60
+ /** Its address on smartlinks.host: the chosen name, else the automatic one. */
61
+ host: string;
62
+ /** The automatic address every collection has (`c-<id>.smartlinks.host`). */
63
+ defaultHost: string | null;
64
+ /** Its own domain for its front page, and whether that works yet. */
65
+ domain: {
66
+ host: string;
67
+ live: boolean;
68
+ } | null;
69
+ front: AddressFront;
70
+ websites: AddressWebsite[];
71
+ pages: AddressPage[];
72
+ }
73
+ export interface AddressNameAvailability {
74
+ available: boolean;
75
+ host: string;
76
+ }
77
+ /** Where an app's public page is (`address.page`): always a working address. */
78
+ export interface AppPageLink {
79
+ /** The one to link to: the business's address itself when the app IS its front page, else `pageUrl`. */
80
+ url: string;
81
+ /** The app's page under the business's address: `https://<address>/_apps/<name>/`. */
82
+ pageUrl: string;
83
+ /** The page name (the business can rename it in Studio → Your address). */
84
+ name: string;
85
+ /** Live (stable, released): on the business's own domain or name. A test build is on the automatic address. */
86
+ live: boolean;
87
+ /** This app is the business's whole front page. */
88
+ isFront: boolean;
89
+ host: string;
90
+ /** The release channel the collection runs the app on. */
91
+ channel: string | null;
92
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * A business's ADDRESS (prove docs/design/business-address.md): its name on smartlinks.host, its own
3
+ * domain, what its front page shows, and its apps' public pages under `/_apps/<name>/`.
4
+ */
5
+ export {};
@@ -29,6 +29,7 @@ export * from "./location.js";
29
29
  export * from "./jobs.js";
30
30
  export * from "./realtime.js";
31
31
  export * from "./adminCards.js";
32
+ export * from "./address.js";
32
33
  export * from "./tags.js";
33
34
  export * from "./navigation.js";
34
35
  export * from "./order.js";
@@ -31,6 +31,7 @@ export * from "./location.js";
31
31
  export * from "./jobs.js";
32
32
  export * from "./realtime.js";
33
33
  export * from "./adminCards.js";
34
+ export * from "./address.js";
34
35
  export * from "./tags.js";
35
36
  export * from "./navigation.js";
36
37
  export * from "./order.js";