@proveanything/smartlinks 1.3.6 → 1.3.9
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/api/collection.d.ts +8 -1
- package/dist/api/collection.js +11 -0
- package/dist/cache.d.ts +32 -0
- package/dist/cache.js +125 -0
- package/dist/docs/API_SUMMARY.md +448 -245
- package/dist/docs/iframe-responder.md +463 -0
- package/dist/iframe.d.ts +2 -0
- package/dist/iframe.js +2 -0
- package/dist/iframeResponder.d.ts +93 -0
- package/dist/iframeResponder.js +549 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/types/collection.d.ts +42 -0
- package/dist/types/iframeResponder.d.ts +112 -0
- package/dist/types/iframeResponder.js +18 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/docs/API_SUMMARY.md +194 -1
- package/docs/iframe-responder.md +463 -0
- package/package.json +3 -3
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export type { AuthKitUser } from './authKit';
|
|
2
|
+
export type { AppConfig as CollectionApp } from './collection';
|
|
3
|
+
import type { AppConfig } from './collection';
|
|
4
|
+
export interface CachedData {
|
|
5
|
+
collection?: Record<string, any>;
|
|
6
|
+
product?: Record<string, any>;
|
|
7
|
+
proof?: Record<string, any>;
|
|
8
|
+
user?: {
|
|
9
|
+
uid: string;
|
|
10
|
+
email?: string;
|
|
11
|
+
displayName?: string;
|
|
12
|
+
accountData?: Record<string, any>;
|
|
13
|
+
} | null;
|
|
14
|
+
apps?: AppConfig[];
|
|
15
|
+
}
|
|
16
|
+
export interface IframeResponderOptions {
|
|
17
|
+
collectionId: string;
|
|
18
|
+
appId: string;
|
|
19
|
+
productId?: string;
|
|
20
|
+
proofId?: string;
|
|
21
|
+
/** Version to load: 'stable' | 'development' | specific version */
|
|
22
|
+
version?: string;
|
|
23
|
+
/** Override auto-resolved URL (for local development) */
|
|
24
|
+
appUrl?: string;
|
|
25
|
+
/** Initial hash path (e.g., '/settings') */
|
|
26
|
+
initialPath?: string;
|
|
27
|
+
/** Is user an admin of this collection */
|
|
28
|
+
isAdmin?: boolean;
|
|
29
|
+
cache?: CachedData;
|
|
30
|
+
onAuthLogin?: (token: string, user: any, accountData?: Record<string, any>) => Promise<void>;
|
|
31
|
+
onAuthLogout?: () => Promise<void>;
|
|
32
|
+
onRouteChange?: (path: string, state: Record<string, string>) => void;
|
|
33
|
+
onResize?: (height: number) => void;
|
|
34
|
+
onError?: (error: Error) => void;
|
|
35
|
+
onReady?: () => void;
|
|
36
|
+
}
|
|
37
|
+
export interface RouteChangeMessage {
|
|
38
|
+
type: 'smartlinks-route-change';
|
|
39
|
+
path: string;
|
|
40
|
+
context: Record<string, string>;
|
|
41
|
+
state: Record<string, string>;
|
|
42
|
+
appId?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface SmartlinksIframeMessage {
|
|
45
|
+
_smartlinksIframeMessage: true;
|
|
46
|
+
type: 'smartlinks:resize' | 'smartlinks:redirect' | 'smartlinks:authkit:login' | 'smartlinks:authkit:logout' | 'smartlinks:authkit:redirect';
|
|
47
|
+
payload: Record<string, any>;
|
|
48
|
+
messageId?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ProxyRequest {
|
|
51
|
+
_smartlinksProxyRequest: true;
|
|
52
|
+
id: string;
|
|
53
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
54
|
+
path: string;
|
|
55
|
+
body?: any;
|
|
56
|
+
headers?: Record<string, string>;
|
|
57
|
+
}
|
|
58
|
+
export interface CustomProxyRequest {
|
|
59
|
+
_smartlinksProxyRequest: true;
|
|
60
|
+
_smartlinksCustomProxyRequest: true;
|
|
61
|
+
id: string;
|
|
62
|
+
request: 'REDIRECT' | string;
|
|
63
|
+
params: Record<string, any>;
|
|
64
|
+
}
|
|
65
|
+
export interface ProxyResponse {
|
|
66
|
+
_smartlinksProxyResponse: true;
|
|
67
|
+
id: string;
|
|
68
|
+
data?: any;
|
|
69
|
+
error?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface UploadStartMessage {
|
|
72
|
+
_smartlinksProxyUpload: true;
|
|
73
|
+
phase: 'start';
|
|
74
|
+
id: string;
|
|
75
|
+
fields: [string, string][];
|
|
76
|
+
fileInfo: {
|
|
77
|
+
type?: string;
|
|
78
|
+
name?: string;
|
|
79
|
+
key?: string;
|
|
80
|
+
};
|
|
81
|
+
path: string;
|
|
82
|
+
headers?: Record<string, string>;
|
|
83
|
+
}
|
|
84
|
+
export interface UploadChunkMessage {
|
|
85
|
+
_smartlinksProxyUpload: true;
|
|
86
|
+
phase: 'chunk';
|
|
87
|
+
id: string;
|
|
88
|
+
seq: number;
|
|
89
|
+
chunk: ArrayBuffer;
|
|
90
|
+
}
|
|
91
|
+
export interface UploadEndMessage {
|
|
92
|
+
_smartlinksProxyUpload: true;
|
|
93
|
+
phase: 'end';
|
|
94
|
+
id: string;
|
|
95
|
+
}
|
|
96
|
+
export interface UploadAckMessage {
|
|
97
|
+
_smartlinksProxyUpload: true;
|
|
98
|
+
phase: 'ack';
|
|
99
|
+
id: string;
|
|
100
|
+
seq: number;
|
|
101
|
+
}
|
|
102
|
+
export interface UploadDoneMessage {
|
|
103
|
+
_smartlinksProxyUpload: true;
|
|
104
|
+
phase: 'done';
|
|
105
|
+
id: string;
|
|
106
|
+
ok: boolean;
|
|
107
|
+
data?: any;
|
|
108
|
+
error?: string;
|
|
109
|
+
}
|
|
110
|
+
export type UploadMessage = UploadStartMessage | UploadChunkMessage | UploadEndMessage | UploadAckMessage | UploadDoneMessage;
|
|
111
|
+
/** Reserved iframe context parameters (not app state) */
|
|
112
|
+
export declare const KNOWN_IFRAME_PARAMS: Set<string>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// IframeResponder Types - Type definitions for iframe communication
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// =============================================================================
|
|
5
|
+
// Constants
|
|
6
|
+
// =============================================================================
|
|
7
|
+
/** Reserved iframe context parameters (not app state) */
|
|
8
|
+
export const KNOWN_IFRAME_PARAMS = new Set([
|
|
9
|
+
'collectionId',
|
|
10
|
+
'appId',
|
|
11
|
+
'productId',
|
|
12
|
+
'proofId',
|
|
13
|
+
'isAdmin',
|
|
14
|
+
'dark',
|
|
15
|
+
'parentUrl',
|
|
16
|
+
'theme',
|
|
17
|
+
'lang',
|
|
18
|
+
]);
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.9 | Generated: 2026-02-05T20:01:56.914Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -856,6 +856,37 @@ interface Collection {
|
|
|
856
856
|
}
|
|
857
857
|
```
|
|
858
858
|
|
|
859
|
+
**AppConfig** (interface)
|
|
860
|
+
```typescript
|
|
861
|
+
interface AppConfig {
|
|
862
|
+
id: string
|
|
863
|
+
srcAppId: string
|
|
864
|
+
name: string
|
|
865
|
+
description?: string
|
|
866
|
+
faIcon?: string
|
|
867
|
+
category: "Authenticity" | "Documentation" | "Commerce" | "Engagement" | "AI" | "Digital Product Passports" | "Integration" | "Web3" | "Other";
|
|
868
|
+
active?: boolean
|
|
869
|
+
ownersOnly?: boolean
|
|
870
|
+
hidden?: boolean
|
|
871
|
+
publicIframeUrl?: string
|
|
872
|
+
supportsDeepLinks?: boolean;
|
|
873
|
+
usage: {
|
|
874
|
+
collection: boolean; // use at the collecton level
|
|
875
|
+
product: boolean; // use at the product level
|
|
876
|
+
proof: boolean; // use at the proof level
|
|
877
|
+
widget: boolean; // has a widget component available
|
|
878
|
+
}
|
|
879
|
+
[key: string]: any
|
|
880
|
+
}
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
**AppsConfigResponse** (interface)
|
|
884
|
+
```typescript
|
|
885
|
+
interface AppsConfigResponse {
|
|
886
|
+
apps: AppConfig[]
|
|
887
|
+
}
|
|
888
|
+
```
|
|
889
|
+
|
|
859
890
|
**CollectionResponse** = `Collection`
|
|
860
891
|
|
|
861
892
|
**CollectionCreateRequest** = `Omit<Collection, 'id' | 'shortId'>`
|
|
@@ -1458,6 +1489,165 @@ interface ErrorResponse {
|
|
|
1458
1489
|
}
|
|
1459
1490
|
```
|
|
1460
1491
|
|
|
1492
|
+
### iframeResponder
|
|
1493
|
+
|
|
1494
|
+
**CachedData** (interface)
|
|
1495
|
+
```typescript
|
|
1496
|
+
interface CachedData {
|
|
1497
|
+
collection?: Record<string, any>;
|
|
1498
|
+
product?: Record<string, any>;
|
|
1499
|
+
proof?: Record<string, any>;
|
|
1500
|
+
user?: {
|
|
1501
|
+
uid: string;
|
|
1502
|
+
email?: string;
|
|
1503
|
+
displayName?: string;
|
|
1504
|
+
accountData?: Record<string, any>;
|
|
1505
|
+
} | null;
|
|
1506
|
+
apps?: AppConfig[];
|
|
1507
|
+
}
|
|
1508
|
+
```
|
|
1509
|
+
|
|
1510
|
+
**IframeResponderOptions** (interface)
|
|
1511
|
+
```typescript
|
|
1512
|
+
interface IframeResponderOptions {
|
|
1513
|
+
collectionId: string;
|
|
1514
|
+
appId: string;
|
|
1515
|
+
productId?: string;
|
|
1516
|
+
proofId?: string;
|
|
1517
|
+
version?: string;
|
|
1518
|
+
appUrl?: string;
|
|
1519
|
+
initialPath?: string;
|
|
1520
|
+
isAdmin?: boolean;
|
|
1521
|
+
cache?: CachedData;
|
|
1522
|
+
onAuthLogin?: (
|
|
1523
|
+
token: string,
|
|
1524
|
+
user: any,
|
|
1525
|
+
accountData?: Record<string, any>
|
|
1526
|
+
) => Promise<void>;
|
|
1527
|
+
onAuthLogout?: () => Promise<void>;
|
|
1528
|
+
onRouteChange?: (path: string, state: Record<string, string>) => void;
|
|
1529
|
+
onResize?: (height: number) => void;
|
|
1530
|
+
onError?: (error: Error) => void;
|
|
1531
|
+
onReady?: () => void;
|
|
1532
|
+
}
|
|
1533
|
+
```
|
|
1534
|
+
|
|
1535
|
+
**RouteChangeMessage** (interface)
|
|
1536
|
+
```typescript
|
|
1537
|
+
interface RouteChangeMessage {
|
|
1538
|
+
type: 'smartlinks-route-change';
|
|
1539
|
+
path: string;
|
|
1540
|
+
context: Record<string, string>;
|
|
1541
|
+
state: Record<string, string>;
|
|
1542
|
+
appId?: string;
|
|
1543
|
+
}
|
|
1544
|
+
```
|
|
1545
|
+
|
|
1546
|
+
**SmartlinksIframeMessage** (interface)
|
|
1547
|
+
```typescript
|
|
1548
|
+
interface SmartlinksIframeMessage {
|
|
1549
|
+
_smartlinksIframeMessage: true;
|
|
1550
|
+
type:
|
|
1551
|
+
| 'smartlinks:resize'
|
|
1552
|
+
| 'smartlinks:redirect'
|
|
1553
|
+
| 'smartlinks:authkit:login'
|
|
1554
|
+
| 'smartlinks:authkit:logout'
|
|
1555
|
+
| 'smartlinks:authkit:redirect';
|
|
1556
|
+
payload: Record<string, any>;
|
|
1557
|
+
messageId?: string;
|
|
1558
|
+
}
|
|
1559
|
+
```
|
|
1560
|
+
|
|
1561
|
+
**ProxyRequest** (interface)
|
|
1562
|
+
```typescript
|
|
1563
|
+
interface ProxyRequest {
|
|
1564
|
+
_smartlinksProxyRequest: true;
|
|
1565
|
+
id: string;
|
|
1566
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
1567
|
+
path: string;
|
|
1568
|
+
body?: any;
|
|
1569
|
+
headers?: Record<string, string>;
|
|
1570
|
+
}
|
|
1571
|
+
```
|
|
1572
|
+
|
|
1573
|
+
**CustomProxyRequest** (interface)
|
|
1574
|
+
```typescript
|
|
1575
|
+
interface CustomProxyRequest {
|
|
1576
|
+
_smartlinksProxyRequest: true;
|
|
1577
|
+
_smartlinksCustomProxyRequest: true;
|
|
1578
|
+
id: string;
|
|
1579
|
+
request: 'REDIRECT' | string;
|
|
1580
|
+
params: Record<string, any>;
|
|
1581
|
+
}
|
|
1582
|
+
```
|
|
1583
|
+
|
|
1584
|
+
**ProxyResponse** (interface)
|
|
1585
|
+
```typescript
|
|
1586
|
+
interface ProxyResponse {
|
|
1587
|
+
_smartlinksProxyResponse: true;
|
|
1588
|
+
id: string;
|
|
1589
|
+
data?: any;
|
|
1590
|
+
error?: string;
|
|
1591
|
+
}
|
|
1592
|
+
```
|
|
1593
|
+
|
|
1594
|
+
**UploadStartMessage** (interface)
|
|
1595
|
+
```typescript
|
|
1596
|
+
interface UploadStartMessage {
|
|
1597
|
+
_smartlinksProxyUpload: true;
|
|
1598
|
+
phase: 'start';
|
|
1599
|
+
id: string;
|
|
1600
|
+
fields: [string, string][];
|
|
1601
|
+
fileInfo: { type?: string; name?: string; key?: string };
|
|
1602
|
+
path: string;
|
|
1603
|
+
headers?: Record<string, string>;
|
|
1604
|
+
}
|
|
1605
|
+
```
|
|
1606
|
+
|
|
1607
|
+
**UploadChunkMessage** (interface)
|
|
1608
|
+
```typescript
|
|
1609
|
+
interface UploadChunkMessage {
|
|
1610
|
+
_smartlinksProxyUpload: true;
|
|
1611
|
+
phase: 'chunk';
|
|
1612
|
+
id: string;
|
|
1613
|
+
seq: number;
|
|
1614
|
+
chunk: ArrayBuffer;
|
|
1615
|
+
}
|
|
1616
|
+
```
|
|
1617
|
+
|
|
1618
|
+
**UploadEndMessage** (interface)
|
|
1619
|
+
```typescript
|
|
1620
|
+
interface UploadEndMessage {
|
|
1621
|
+
_smartlinksProxyUpload: true;
|
|
1622
|
+
phase: 'end';
|
|
1623
|
+
id: string;
|
|
1624
|
+
}
|
|
1625
|
+
```
|
|
1626
|
+
|
|
1627
|
+
**UploadAckMessage** (interface)
|
|
1628
|
+
```typescript
|
|
1629
|
+
interface UploadAckMessage {
|
|
1630
|
+
_smartlinksProxyUpload: true;
|
|
1631
|
+
phase: 'ack';
|
|
1632
|
+
id: string;
|
|
1633
|
+
seq: number;
|
|
1634
|
+
}
|
|
1635
|
+
```
|
|
1636
|
+
|
|
1637
|
+
**UploadDoneMessage** (interface)
|
|
1638
|
+
```typescript
|
|
1639
|
+
interface UploadDoneMessage {
|
|
1640
|
+
_smartlinksProxyUpload: true;
|
|
1641
|
+
phase: 'done';
|
|
1642
|
+
id: string;
|
|
1643
|
+
ok: boolean;
|
|
1644
|
+
data?: any;
|
|
1645
|
+
error?: string;
|
|
1646
|
+
}
|
|
1647
|
+
```
|
|
1648
|
+
|
|
1649
|
+
**UploadMessage** = ``
|
|
1650
|
+
|
|
1461
1651
|
### interaction
|
|
1462
1652
|
|
|
1463
1653
|
**AdminInteractionsQueryRequest** (interface)
|
|
@@ -2998,6 +3188,9 @@ Retrieve a collection by its shortId (public endpoint).
|
|
|
2998
3188
|
**getSettings**(collectionId: string, settingGroup: string, admin?: boolean) → `Promise<any>`
|
|
2999
3189
|
Retrieve a specific settings group for a collection (public endpoint).
|
|
3000
3190
|
|
|
3191
|
+
**getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
|
|
3192
|
+
Retrieve all configured app module definitions for a collection (public endpoint).
|
|
3193
|
+
|
|
3001
3194
|
**updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
|
|
3002
3195
|
Update a specific settings group for a collection (admin endpoint).
|
|
3003
3196
|
|