@proveanything/smartlinks 2.1.31 → 2.1.33
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/adminViews.d.ts +86 -0
- package/dist/adminViews.js +178 -0
- package/dist/api/address.d.ts +39 -0
- package/dist/api/address.js +45 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/interactions.d.ts +3 -0
- package/dist/api/interactions.js +3 -0
- package/dist/api/translations.d.ts +6 -1
- package/dist/api/translations.js +11 -1
- package/dist/context.d.ts +5 -0
- package/dist/context.js +4 -1
- package/dist/docs/API_SUMMARY.md +104 -10
- package/dist/docs/admin-views.md +93 -0
- package/dist/docs/app-manifest.md +14 -0
- package/dist/docs/translations.md +24 -0
- package/dist/index.d.ts +2 -2
- package/dist/openapi.yaml +187 -0
- package/dist/site.d.ts +5 -0
- package/dist/types/address.d.ts +69 -0
- package/dist/types/address.js +5 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/translations.d.ts +33 -0
- package/docs/API_SUMMARY.md +104 -10
- package/docs/admin-views.md +93 -0
- package/docs/app-manifest.md +14 -0
- package/docs/translations.md +24 -0
- package/openapi.yaml +187 -0
- package/package.json +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
/** Send visitors to another address. Temporary (302) unless `permanent`; `keepPath` carries /about → target/about. */
|
|
18
|
+
| {
|
|
19
|
+
kind: 'redirect';
|
|
20
|
+
url: string;
|
|
21
|
+
keepPath?: boolean;
|
|
22
|
+
permanent?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** A simple page with the business's name, logo and the app pages it chose to show. */
|
|
25
|
+
| {
|
|
26
|
+
kind: 'holding';
|
|
27
|
+
};
|
|
28
|
+
/** An installed app's public page on the business's address. */
|
|
29
|
+
export interface AddressPage {
|
|
30
|
+
appId: string;
|
|
31
|
+
/** The app's name as installed. */
|
|
32
|
+
title: string;
|
|
33
|
+
/** The page name: `https://<address>/_apps/<name>/`. */
|
|
34
|
+
name: string;
|
|
35
|
+
/** What the name is when never changed: the app id without its publisher handle. */
|
|
36
|
+
defaultName: string;
|
|
37
|
+
/** Shown on the holding page. */
|
|
38
|
+
listed: boolean;
|
|
39
|
+
/** The full address of the page, on the business's main address. */
|
|
40
|
+
url: string;
|
|
41
|
+
}
|
|
42
|
+
/** A website installed on the collection: what the front page can show. */
|
|
43
|
+
export interface AddressWebsite {
|
|
44
|
+
appId: string;
|
|
45
|
+
title: string;
|
|
46
|
+
/** Live (on stable): only a live website can be the front page. */
|
|
47
|
+
live: boolean;
|
|
48
|
+
channel: string | null;
|
|
49
|
+
}
|
|
50
|
+
export interface AddressResponse {
|
|
51
|
+
/** The business's chosen name, or null when it hasn't chosen one (it uses `defaultHost`). */
|
|
52
|
+
name: string | null;
|
|
53
|
+
/** Its address on smartlinks.host: the chosen name, else the automatic one. */
|
|
54
|
+
host: string;
|
|
55
|
+
/** The automatic address every collection has (`c-<id>.smartlinks.host`). */
|
|
56
|
+
defaultHost: string | null;
|
|
57
|
+
/** Its own domain for its front page, and whether that works yet. */
|
|
58
|
+
domain: {
|
|
59
|
+
host: string;
|
|
60
|
+
live: boolean;
|
|
61
|
+
} | null;
|
|
62
|
+
front: AddressFront;
|
|
63
|
+
websites: AddressWebsite[];
|
|
64
|
+
pages: AddressPage[];
|
|
65
|
+
}
|
|
66
|
+
export interface AddressNameAvailability {
|
|
67
|
+
available: boolean;
|
|
68
|
+
host: string;
|
|
69
|
+
}
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -90,6 +90,8 @@ export interface TranslationListParams {
|
|
|
90
90
|
contextKey?: string;
|
|
91
91
|
q?: string;
|
|
92
92
|
isOverride?: boolean;
|
|
93
|
+
/** Only translations that don't use the site's required wording (see TranslationRules). */
|
|
94
|
+
termIssues?: boolean;
|
|
93
95
|
limit?: number;
|
|
94
96
|
offset?: number;
|
|
95
97
|
}
|
|
@@ -105,3 +107,34 @@ export interface TranslationUpdateRequest {
|
|
|
105
107
|
quality?: TranslationQuality;
|
|
106
108
|
metadata?: Record<string, any>;
|
|
107
109
|
}
|
|
110
|
+
/** One required term: the English wording and what each language must use, or kept as written. */
|
|
111
|
+
export interface TranslationTerm {
|
|
112
|
+
source: string;
|
|
113
|
+
/** Keep exactly as written in every language (brand names, drug names, units). */
|
|
114
|
+
keep?: boolean;
|
|
115
|
+
/** Language code -> required wording. */
|
|
116
|
+
translations?: Record<string, string>;
|
|
117
|
+
note?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A site's own rules for its machine translations: a brief for the whole site, notes per language, and
|
|
121
|
+
* required terms. Used for every new translation; translations missing a required term are flagged
|
|
122
|
+
* (record metadata.termIssues / termIssueCount).
|
|
123
|
+
*/
|
|
124
|
+
export interface TranslationRules {
|
|
125
|
+
guidance: string;
|
|
126
|
+
languages: Record<string, {
|
|
127
|
+
guidance: string;
|
|
128
|
+
}>;
|
|
129
|
+
terms: TranslationTerm[];
|
|
130
|
+
/** Fingerprint of these rules; each machine translation stores the one it was made under (metadata.rulesVersion). */
|
|
131
|
+
version?: string | null;
|
|
132
|
+
updatedAt?: string | null;
|
|
133
|
+
limits?: {
|
|
134
|
+
guidance: number;
|
|
135
|
+
languageGuidance: number;
|
|
136
|
+
terms: number;
|
|
137
|
+
term: number;
|
|
138
|
+
note: number;
|
|
139
|
+
};
|
|
140
|
+
}
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.33 | Generated: 2026-11-20T18:06:02.523Z
|
|
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,53 @@ 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
|
+
url: string
|
|
502
|
+
}
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**AddressWebsite** (interface)
|
|
506
|
+
```typescript
|
|
507
|
+
interface AddressWebsite {
|
|
508
|
+
appId: string
|
|
509
|
+
title: string
|
|
510
|
+
live: boolean
|
|
511
|
+
channel: string | null
|
|
512
|
+
}
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
**AddressResponse** (interface)
|
|
516
|
+
```typescript
|
|
517
|
+
interface AddressResponse {
|
|
518
|
+
name: string | null
|
|
519
|
+
host: string
|
|
520
|
+
defaultHost: string | null
|
|
521
|
+
domain: { host: string; live: boolean } | null
|
|
522
|
+
front: AddressFront
|
|
523
|
+
websites: AddressWebsite[]
|
|
524
|
+
pages: AddressPage[]
|
|
525
|
+
}
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
**AddressNameAvailability** (interface)
|
|
529
|
+
```typescript
|
|
530
|
+
interface AddressNameAvailability {
|
|
531
|
+
available: boolean
|
|
532
|
+
host: string
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
**AddressFront** = ``
|
|
537
|
+
|
|
490
538
|
### adminCards
|
|
491
539
|
|
|
492
540
|
**AdminCardRefresh** (interface)
|
|
@@ -12079,6 +12127,7 @@ interface TranslationListParams {
|
|
|
12079
12127
|
contextKey?: string
|
|
12080
12128
|
q?: string
|
|
12081
12129
|
isOverride?: boolean
|
|
12130
|
+
termIssues?: boolean
|
|
12082
12131
|
limit?: number
|
|
12083
12132
|
offset?: number
|
|
12084
12133
|
}
|
|
@@ -12104,6 +12153,28 @@ interface TranslationUpdateRequest {
|
|
|
12104
12153
|
}
|
|
12105
12154
|
```
|
|
12106
12155
|
|
|
12156
|
+
**TranslationTerm** (interface)
|
|
12157
|
+
```typescript
|
|
12158
|
+
interface TranslationTerm {
|
|
12159
|
+
source: string
|
|
12160
|
+
keep?: boolean
|
|
12161
|
+
translations?: Record<string, string>
|
|
12162
|
+
note?: string
|
|
12163
|
+
}
|
|
12164
|
+
```
|
|
12165
|
+
|
|
12166
|
+
**TranslationRules** (interface)
|
|
12167
|
+
```typescript
|
|
12168
|
+
interface TranslationRules {
|
|
12169
|
+
guidance: string
|
|
12170
|
+
languages: Record<string, { guidance: string }>
|
|
12171
|
+
terms: TranslationTerm[]
|
|
12172
|
+
version?: string | null
|
|
12173
|
+
updatedAt?: string | null
|
|
12174
|
+
limits?: { guidance: number; languageGuidance: number; terms: number; term: number; note: number }
|
|
12175
|
+
}
|
|
12176
|
+
```
|
|
12177
|
+
|
|
12107
12178
|
**TranslationLookupMode** = `'cache-fill' | 'cache-only'`
|
|
12108
12179
|
|
|
12109
12180
|
**TranslationContentType** = `'text/plain' | 'text/html' | 'text/x-liquid' | (string & {})`
|
|
@@ -12773,6 +12844,23 @@ interface Gs1DigitalLinkParams {
|
|
|
12773
12844
|
|
|
12774
12845
|
## API Functions
|
|
12775
12846
|
|
|
12847
|
+
### address
|
|
12848
|
+
|
|
12849
|
+
**get**(collectionId: string) → `Promise<AddressResponse>`
|
|
12850
|
+
Everything about the business's address: name, own domain, front page, websites that can take it, app pages.
|
|
12851
|
+
|
|
12852
|
+
**checkName**(collectionId: string, name: string) → `Promise<AddressNameAvailability>`
|
|
12853
|
+
Is this name free? (lower-case letters, numbers and hyphens)
|
|
12854
|
+
|
|
12855
|
+
**setName**(collectionId: string, name: string) → `Promise<`
|
|
12856
|
+
Choose (or change) the business's name: `<name>.smartlinks.host`. The previous name is released.
|
|
12857
|
+
|
|
12858
|
+
**setFront**(collectionId: string, front: AddressFront) → `Promise<`
|
|
12859
|
+
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.
|
|
12860
|
+
|
|
12861
|
+
**setPage**(collectionId: string, appId: string, change: { name?: string; listed?: boolean }) → `Promise<`
|
|
12862
|
+
Rename an app's page (old names keep redirecting) and/or show it on the holding page.
|
|
12863
|
+
|
|
12776
12864
|
### adminCards
|
|
12777
12865
|
|
|
12778
12866
|
**list**(collectionId: string) → `Promise<AdminCardsResponse>`
|
|
@@ -14545,38 +14633,38 @@ POST /api/v1/public/collection/:collectionId/interactions/submit Submits an inte
|
|
|
14545
14633
|
|
|
14546
14634
|
**ensureType**(collectionId: string,
|
|
14547
14635
|
input: EnsureInteractionTypeInput) → `Promise<InteractionTypeRecord>`
|
|
14548
|
-
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
|
|
14636
|
+
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.)
|
|
14549
14637
|
|
|
14550
14638
|
**get**(collectionId: string,
|
|
14551
14639
|
id: string) → `Promise<InteractionTypeRecord>`
|
|
14552
|
-
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
|
|
14640
|
+
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.)
|
|
14553
14641
|
|
|
14554
14642
|
**update**(collectionId: string,
|
|
14555
14643
|
id: string,
|
|
14556
14644
|
patchBody: UpdateInteractionTypeBody) → `Promise<InteractionTypeRecord>`
|
|
14557
|
-
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
|
|
14645
|
+
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.)
|
|
14558
14646
|
|
|
14559
14647
|
**remove**(collectionId: string,
|
|
14560
14648
|
id: string) → `Promise<void>`
|
|
14561
|
-
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
|
|
14649
|
+
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.)
|
|
14562
14650
|
|
|
14563
14651
|
**publicCountsByOutcome**(collectionId: string,
|
|
14564
14652
|
body: PublicInteractionsCountsByOutcomeRequest,
|
|
14565
14653
|
authToken?: string) → `Promise<OutcomeCount[]>`
|
|
14566
|
-
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
|
|
14654
|
+
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.)
|
|
14567
14655
|
|
|
14568
14656
|
**publicMyInteractions**(collectionId: string,
|
|
14569
14657
|
body: PublicInteractionsByUserRequest,
|
|
14570
14658
|
authToken?: string) → `Promise<InteractionEventRow[]>`
|
|
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
|
|
14659
|
+
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
14660
|
|
|
14573
14661
|
**publicList**(collectionId: string,
|
|
14574
14662
|
query: ListInteractionTypesQuery = {}) → `Promise<InteractionTypeList>`
|
|
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
|
|
14663
|
+
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
14664
|
|
|
14577
14665
|
**publicGet**(collectionId: string,
|
|
14578
14666
|
id: string) → `Promise<InteractionTypeRecord>`
|
|
14579
|
-
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
|
|
14667
|
+
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.)
|
|
14580
14668
|
|
|
14581
14669
|
### jobs
|
|
14582
14670
|
|
|
@@ -15538,8 +15626,14 @@ Admin: where translated text appears for one language (context keys), with count
|
|
|
15538
15626
|
**reset**(collectionId: string, translationId: string) → `Promise<TranslationRecord>`
|
|
15539
15627
|
Admin: undo a person's edit with a fresh machine translation.
|
|
15540
15628
|
|
|
15629
|
+
**rules**(collectionId: string) → `Promise<TranslationRules>`
|
|
15630
|
+
Admin: the site's translation rules (brief, notes per language, required terms).
|
|
15631
|
+
|
|
15632
|
+
**saveRules**(collectionId: string, body: Pick<TranslationRules, 'guidance' | 'languages' | 'terms'>) → `Promise<TranslationRules>`
|
|
15633
|
+
Admin: replace the site's translation rules. They apply to new translations from now on.
|
|
15634
|
+
|
|
15541
15635
|
**clearLocalCache**(collectionId?: string) → `Promise<void>`
|
|
15542
|
-
Admin:
|
|
15636
|
+
Admin: replace the site's translation rules. They apply to new translations from now on.
|
|
15543
15637
|
|
|
15544
15638
|
### tts
|
|
15545
15639
|
|
package/docs/admin-views.md
CHANGED
|
@@ -132,6 +132,99 @@ 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.domain` · `.languages` · `.translations` · `.email` · `.team` · `.userGroups` | | That Studio page |
|
|
195
|
+
| `settings.setupLists` | appId | Set-up lists, for that app |
|
|
196
|
+
| `settings.portal` · `.hub` · `.signIn` | | The Portal, the Hub, customer sign-in |
|
|
197
|
+
| `media` | | Images and files |
|
|
198
|
+
| `app` | **appId**, view, params | Another app at one of its screens, as `openApp` |
|
|
199
|
+
|
|
200
|
+
`SL.adminViews.DESTINATIONS` has the same list in code.
|
|
201
|
+
|
|
202
|
+
### `about`: what a message is for
|
|
203
|
+
|
|
204
|
+
`message.compose` and `message.log` take `about`, the same shape as `comms.sendTransactional`
|
|
205
|
+
([comms.md](comms.md), "What a message is about"). `appId` defaults to your app.
|
|
206
|
+
- **The composer** sends it with the message. The Message log then shows the message against your
|
|
207
|
+
record ("Bookings · Sat 3pm"), with a link back to your screen (`view` + `params`).
|
|
208
|
+
- **The log** shows only the messages about that record.
|
|
209
|
+
|
|
210
|
+
### Messaging many people
|
|
211
|
+
|
|
212
|
+
One message to many people (everyone who booked, entered or joined) is a **campaign**: it has opt-in, an
|
|
213
|
+
unsubscribe, a report, and no cap. Never loop over people sending one message each.
|
|
214
|
+
1. Record an interaction or a tag on each person when they book.
|
|
215
|
+
2. Make a segment in Customers for that interaction or tag.
|
|
216
|
+
3. Open `campaign.new` with the segment.
|
|
217
|
+
|
|
218
|
+
A server function may still send one service message itself (a confirmation, a reminder:
|
|
219
|
+
`ctx.sl.messages.send`). A message a person writes goes through the composer.
|
|
220
|
+
|
|
221
|
+
### Hosts
|
|
222
|
+
|
|
223
|
+
The host answers `smartlinks:open` `{ id, to, params, about?, appParams? }` with `smartlinks:open-result`
|
|
224
|
+
`{ id, to, ok, reason? }`. It posts `smartlinks:destinations` `{ available }` on load, on request
|
|
225
|
+
(`smartlinks:destinations-request`) and whenever the list changes. Helpers: `SL.adminViews.postDestinations`
|
|
226
|
+
and `SL.adminViews.postOpenResult`.
|
|
227
|
+
|
|
135
228
|
## `chrome=none`: the host carries the menu
|
|
136
229
|
|
|
137
230
|
When a host's own menu already lists an app's views, it opens the app with `chrome=none`. The app then
|
package/docs/app-manifest.md
CHANGED
|
@@ -400,6 +400,20 @@ 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
|
+
|
|
403
417
|
##### Public views vs the two portal surfaces
|
|
404
418
|
|
|
405
419
|
An app can have any combination of three setup styles. Only public views are external:
|
package/docs/translations.md
CHANGED
|
@@ -357,6 +357,30 @@ translation or puts a machine one back. When it has changed, that collection's s
|
|
|
357
357
|
dropped and fetched again (from the server's store, no AI). A slow or failed answer never holds the
|
|
358
358
|
page for more than 1.5 s, and the saved copies are used as before.
|
|
359
359
|
|
|
360
|
+
### Translation rules (a site's own terminology)
|
|
361
|
+
|
|
362
|
+
A site can give the AI a brief, notes per language and a list of required terms, for example a
|
|
363
|
+
pharmaceutical company whose leaflets must use regulatory wording. They apply to every new machine
|
|
364
|
+
translation for that collection; existing translations are not changed.
|
|
365
|
+
|
|
366
|
+
```ts
|
|
367
|
+
await translations.saveRules(collectionId, {
|
|
368
|
+
guidance: 'Patient information for prescription medicines. Formal register.',
|
|
369
|
+
languages: { de: { guidance: 'Address the reader with Sie.' } },
|
|
370
|
+
terms: [
|
|
371
|
+
{ source: 'tablet', translations: { de: 'Tablette', 'zh-Hans': '片剂' } },
|
|
372
|
+
{ source: 'Lumora', keep: true, note: 'brand name' }, // never translated
|
|
373
|
+
],
|
|
374
|
+
})
|
|
375
|
+
await translations.rules(collectionId) // what is saved, with its version
|
|
376
|
+
await translations.list(collectionId, { targetLanguage: 'de', termIssues: true }) // translations missing a required term
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Only the terms a text mentions are sent with it. After translating, each result is checked: if the
|
|
380
|
+
source mentions a term and the translation doesn't contain the required wording (any case, endings
|
|
381
|
+
allowed), its `metadata.termIssues` lists the term and `summary()` counts it under `issues`. A person's
|
|
382
|
+
edit is checked the same way. Each machine translation records `metadata.rulesVersion`.
|
|
383
|
+
|
|
360
384
|
## Recommended Usage Pattern
|
|
361
385
|
|
|
362
386
|
For front-end rendering:
|