@proveanything/smartlinks 1.9.4 → 1.9.5
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/docs/API_SUMMARY.md +138 -1
- package/dist/docs/translations.md +82 -0
- package/dist/openapi.yaml +1435 -496
- package/docs/API_SUMMARY.md +138 -1
- package/docs/translations.md +82 -0
- package/openapi.yaml +1435 -496
- package/package.json +1 -1
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.9.
|
|
3
|
+
Version: 1.9.5 | Generated: 2026-03-23T20:19:00.201Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -10,13 +10,16 @@ For detailed guides on specific features:
|
|
|
10
10
|
|
|
11
11
|
- **[SmartLinks Microapp Overview](overview.md)** - Platform architecture, data model, auth patterns, storage, anti-patterns, and quick-reference for all SDK docs
|
|
12
12
|
- **[AI & Chat Completions](ai.md)** - Chat completions, RAG (document-grounded Q&A), voice integration, streaming, tool calling, podcast generation
|
|
13
|
+
- **[Translations](translations.md)** - Runtime translation lookup, browser-side IndexedDB caching, and admin translation management
|
|
13
14
|
- **[Widgets](widgets.md)** - Embeddable React components for parent applications
|
|
14
15
|
- **[Containers](containers.md)** - Building full-app embeddable containers (lazy-loaded)
|
|
16
|
+
- **[Scanner Containers](scanner-container.md)** - Building scanner microapps for the SmartLinks Scanner Android host (RFID, NFC, QR, key events)
|
|
15
17
|
- **[Multi-Page App Architecture](mpa.md)** - Vite MPA build pipeline: public/admin entry points, widget/container/executor bundles, content-hashed CDN assets
|
|
16
18
|
- **[App Configuration Files](app-manifest.md)** - `app.manifest.json` and `app.admin.json` reference — bundles, components, setup questions, import schemas, tunable fields, and metrics
|
|
17
19
|
- **[Executor Model](executor.md)** - Programmatic JS bundles for AI-driven setup, server-side SEO metadata generation, and LLM content for AI crawlers
|
|
18
20
|
- **[Realtime](realtime.md)** - Real-time data updates and WebSocket connections
|
|
19
21
|
- **[iframe Responder](iframe-responder.md)** - iframe integration and cross-origin communication
|
|
22
|
+
- **[Utilities](utils.md)** - Helper functions for building portal paths, URLs, and common tasks
|
|
20
23
|
- **[i18n](i18n.md)** - Internationalization and localization
|
|
21
24
|
- **[Liquid Templates](liquid-templates.md)** - Dynamic templating for content generation
|
|
22
25
|
- **[Theme System](theme.system.md)** - Theme configuration and customization
|
|
@@ -6560,6 +6563,140 @@ type VerifyTokenResponse = {
|
|
|
6560
6563
|
}
|
|
6561
6564
|
```
|
|
6562
6565
|
|
|
6566
|
+
### conditions (utils)
|
|
6567
|
+
|
|
6568
|
+
**BaseCondition** (interface)
|
|
6569
|
+
```typescript
|
|
6570
|
+
interface BaseCondition {
|
|
6571
|
+
type: string
|
|
6572
|
+
contains?: boolean
|
|
6573
|
+
passes?: boolean
|
|
6574
|
+
}
|
|
6575
|
+
```
|
|
6576
|
+
|
|
6577
|
+
**ConditionSet** (interface)
|
|
6578
|
+
```typescript
|
|
6579
|
+
interface ConditionSet {
|
|
6580
|
+
id?: string
|
|
6581
|
+
type?: 'and' | 'or'
|
|
6582
|
+
conditions?: Condition[]
|
|
6583
|
+
}
|
|
6584
|
+
```
|
|
6585
|
+
|
|
6586
|
+
**UserLocation** (interface)
|
|
6587
|
+
```typescript
|
|
6588
|
+
interface UserLocation {
|
|
6589
|
+
country?: string
|
|
6590
|
+
latitude?: number
|
|
6591
|
+
longitude?: number
|
|
6592
|
+
}
|
|
6593
|
+
```
|
|
6594
|
+
|
|
6595
|
+
**PlatformInfo** (interface)
|
|
6596
|
+
```typescript
|
|
6597
|
+
interface PlatformInfo {
|
|
6598
|
+
android?: boolean
|
|
6599
|
+
ios?: boolean
|
|
6600
|
+
win?: boolean
|
|
6601
|
+
mac?: boolean
|
|
6602
|
+
}
|
|
6603
|
+
```
|
|
6604
|
+
|
|
6605
|
+
**StatsInfo** (interface)
|
|
6606
|
+
```typescript
|
|
6607
|
+
interface StatsInfo {
|
|
6608
|
+
version?: string | null
|
|
6609
|
+
platform?: PlatformInfo
|
|
6610
|
+
mobile?: boolean
|
|
6611
|
+
}
|
|
6612
|
+
```
|
|
6613
|
+
|
|
6614
|
+
**UserInfo** (interface)
|
|
6615
|
+
```typescript
|
|
6616
|
+
interface UserInfo {
|
|
6617
|
+
valid: boolean
|
|
6618
|
+
uid?: string
|
|
6619
|
+
location?: UserLocation
|
|
6620
|
+
groups?: string[]
|
|
6621
|
+
}
|
|
6622
|
+
```
|
|
6623
|
+
|
|
6624
|
+
**ProductInfo** (interface)
|
|
6625
|
+
```typescript
|
|
6626
|
+
interface ProductInfo {
|
|
6627
|
+
id: string
|
|
6628
|
+
tags?: Record<string, any>
|
|
6629
|
+
}
|
|
6630
|
+
```
|
|
6631
|
+
|
|
6632
|
+
**ProofInfo** (interface)
|
|
6633
|
+
```typescript
|
|
6634
|
+
interface ProofInfo {
|
|
6635
|
+
id?: string
|
|
6636
|
+
userId?: string
|
|
6637
|
+
claimable?: boolean
|
|
6638
|
+
virtual?: boolean
|
|
6639
|
+
}
|
|
6640
|
+
```
|
|
6641
|
+
|
|
6642
|
+
**CollectionInfo** (interface)
|
|
6643
|
+
```typescript
|
|
6644
|
+
interface CollectionInfo {
|
|
6645
|
+
id: string
|
|
6646
|
+
roles?: Record<string, any>
|
|
6647
|
+
}
|
|
6648
|
+
```
|
|
6649
|
+
|
|
6650
|
+
**ConditionParams** (interface)
|
|
6651
|
+
```typescript
|
|
6652
|
+
interface ConditionParams {
|
|
6653
|
+
condition?: ConditionSet
|
|
6654
|
+
conditionId?: string
|
|
6655
|
+
conditionStack?: string[]
|
|
6656
|
+
user?: UserInfo
|
|
6657
|
+
product?: ProductInfo
|
|
6658
|
+
proof?: ProofInfo
|
|
6659
|
+
collection?: CollectionInfo
|
|
6660
|
+
stats?: StatsInfo
|
|
6661
|
+
fetchCondition?: (collectionId: string, conditionId: string) => Promise<ConditionSet | null>
|
|
6662
|
+
getLocation?: () => Promise<{ latitude: number; longitude: number }>
|
|
6663
|
+
debugConditions?: boolean | ConditionDebugOptions
|
|
6664
|
+
[key: string]: any
|
|
6665
|
+
}
|
|
6666
|
+
```
|
|
6667
|
+
|
|
6668
|
+
**ConditionDebugOptions** (interface)
|
|
6669
|
+
```typescript
|
|
6670
|
+
interface ConditionDebugOptions {
|
|
6671
|
+
enabled?: boolean
|
|
6672
|
+
logger?: ConditionDebugLogger
|
|
6673
|
+
label?: string
|
|
6674
|
+
}
|
|
6675
|
+
```
|
|
6676
|
+
|
|
6677
|
+
**RegionKey** = `keyof typeof REGION_COUNTRIES`
|
|
6678
|
+
|
|
6679
|
+
**Condition** = ``
|
|
6680
|
+
|
|
6681
|
+
**ConditionDebugLogger** = `(...args: any[]) => void`
|
|
6682
|
+
|
|
6683
|
+
### paths (utils)
|
|
6684
|
+
|
|
6685
|
+
**PortalPathParams** (interface)
|
|
6686
|
+
```typescript
|
|
6687
|
+
interface PortalPathParams {
|
|
6688
|
+
collection: Collection | { shortId: string; portalUrl?: string }
|
|
6689
|
+
product?: Product
|
|
6690
|
+
productId?: string
|
|
6691
|
+
batch?: BatchResponse
|
|
6692
|
+
batchId?: string
|
|
6693
|
+
variant?: { id: string } | string
|
|
6694
|
+
proof?: Proof | string
|
|
6695
|
+
queryParams?: Record<string, string>
|
|
6696
|
+
pathOnly?: boolean
|
|
6697
|
+
}
|
|
6698
|
+
```
|
|
6699
|
+
|
|
6563
6700
|
## API Functions
|
|
6564
6701
|
|
|
6565
6702
|
### analytics.admin
|
|
@@ -92,6 +92,88 @@ const response = await translations.lookup('collection-123', {
|
|
|
92
92
|
})
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
## Content Types
|
|
96
|
+
|
|
97
|
+
`contentType` is part of the translation cache identity. Use it to tell the backend what kind of content is being translated so it can preserve structure correctly.
|
|
98
|
+
|
|
99
|
+
### `text/plain`
|
|
100
|
+
|
|
101
|
+
Use this for normal strings, paragraphs, labels, and other plain text content with no markup.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
await translations.resolve('collection-123', {
|
|
105
|
+
targetLanguage: 'fr',
|
|
106
|
+
sourceLanguage: 'en',
|
|
107
|
+
contentType: 'text/plain',
|
|
108
|
+
texts: [
|
|
109
|
+
'Welcome to the product page',
|
|
110
|
+
'Scan to verify authenticity',
|
|
111
|
+
],
|
|
112
|
+
})
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `text/html`
|
|
116
|
+
|
|
117
|
+
Use this when the source contains HTML tags that must survive translation unchanged. This is important for rich text descriptions, CMS content, and formatted snippets.
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
await translations.resolve('collection-123', {
|
|
121
|
+
targetLanguage: 'de',
|
|
122
|
+
sourceLanguage: 'en',
|
|
123
|
+
contentType: 'text/html',
|
|
124
|
+
context: {
|
|
125
|
+
surface: 'portal-product-page',
|
|
126
|
+
field: 'rich-description',
|
|
127
|
+
},
|
|
128
|
+
texts: [
|
|
129
|
+
'<p>Welcome to the <strong>product page</strong>.</p>',
|
|
130
|
+
'<p>Scan the tag to <a href="/verify">verify authenticity</a>.</p>',
|
|
131
|
+
],
|
|
132
|
+
})
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Use `text/html` when you want the translation system to preserve tags such as:
|
|
136
|
+
|
|
137
|
+
- `<p>`, `<strong>`, `<em>`
|
|
138
|
+
- `<ul>`, `<li>`
|
|
139
|
+
- `<a>`
|
|
140
|
+
- inline markup embedded in CMS-rendered HTML
|
|
141
|
+
|
|
142
|
+
### `text/x-liquid`
|
|
143
|
+
|
|
144
|
+
Use this when the content includes Liquid syntax that must be preserved exactly, including output tags, control-flow blocks, and filters.
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
await translations.resolve('collection-123', {
|
|
148
|
+
targetLanguage: 'es',
|
|
149
|
+
sourceLanguage: 'en',
|
|
150
|
+
contentType: 'text/x-liquid',
|
|
151
|
+
context: {
|
|
152
|
+
surface: 'portal-email-template',
|
|
153
|
+
field: 'body',
|
|
154
|
+
},
|
|
155
|
+
texts: [
|
|
156
|
+
'Hello {{ customer.first_name }}, your item {{ product.title }} is ready.',
|
|
157
|
+
'{% if claimable %}Claim your item{% else %}View item details{% endif %}',
|
|
158
|
+
],
|
|
159
|
+
})
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Use `text/x-liquid` when the source includes constructs such as:
|
|
163
|
+
|
|
164
|
+
- `{{ customer.first_name }}`
|
|
165
|
+
- `{{ product.title | upcase }}`
|
|
166
|
+
- `{% if claimable %}...{% endif %}`
|
|
167
|
+
- loop or conditional blocks used in templates
|
|
168
|
+
|
|
169
|
+
### Choosing The Right Value
|
|
170
|
+
|
|
171
|
+
- use `text/plain` for normal strings with no markup
|
|
172
|
+
- use `text/html` when HTML tags are part of the source and must be preserved
|
|
173
|
+
- use `text/x-liquid` when Liquid template syntax is part of the source and must be preserved
|
|
174
|
+
|
|
175
|
+
Do not mix plain text, HTML, and Liquid under the same `contentType` if you want stable cache keys and predictable translation behavior.
|
|
176
|
+
|
|
95
177
|
## Local-First Resolution
|
|
96
178
|
|
|
97
179
|
`resolve(...)` is intended for browser rendering paths where repeated translations should not keep hitting the network.
|