@proveanything/smartlinks 1.15.4 → 1.15.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/api/appConfiguration.d.ts +90 -1
- package/dist/api/appConfiguration.js +117 -0
- package/dist/api/collection.d.ts +6 -2
- package/dist/api/collection.js +6 -2
- package/dist/cache.d.ts +19 -0
- package/dist/cache.js +25 -0
- package/dist/docs/API_SUMMARY.md +93 -9
- package/dist/docs/appConfig.md +483 -0
- package/dist/docs/overview.md +13 -0
- package/dist/openapi.yaml +135 -1
- package/dist/types/appConfiguration.d.ts +83 -0
- package/dist/types/collection.d.ts +11 -2
- package/docs/API_SUMMARY.md +93 -9
- package/docs/appConfig.md +483 -0
- package/docs/overview.md +13 -0
- package/openapi.yaml +135 -1
- package/package.json +1 -1
|
@@ -33,3 +33,86 @@ export interface WidgetInstanceSummary {
|
|
|
33
33
|
type?: string;
|
|
34
34
|
[key: string]: any;
|
|
35
35
|
}
|
|
36
|
+
/** One installed module instance on a collection. */
|
|
37
|
+
export interface AppEntry {
|
|
38
|
+
/** Instance id (typically === uniqueName). */
|
|
39
|
+
id: string;
|
|
40
|
+
/** Module id from the module catalog. */
|
|
41
|
+
uniqueName: string;
|
|
42
|
+
/** Display name, overrideable. */
|
|
43
|
+
customName?: string;
|
|
44
|
+
/** User toggle. */
|
|
45
|
+
active: boolean;
|
|
46
|
+
/** Legacy scope flag. */
|
|
47
|
+
all?: boolean;
|
|
48
|
+
/** Legacy flag. */
|
|
49
|
+
live?: boolean;
|
|
50
|
+
/** Optional FA icon override. */
|
|
51
|
+
faIcon?: string;
|
|
52
|
+
versionChannel?: 'stable' | 'beta' | 'dev';
|
|
53
|
+
/** Set by reconcile when app category is outside entitledAppGroups. */
|
|
54
|
+
reason?: 'not_entitled';
|
|
55
|
+
/** Per-module inline settings preserved verbatim. */
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
export interface MeterEntry {
|
|
59
|
+
included: number;
|
|
60
|
+
stripePriceId?: string;
|
|
61
|
+
stripeMeterId?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface AppliedOverridesSummary {
|
|
64
|
+
features?: string[];
|
|
65
|
+
meters?: string[];
|
|
66
|
+
entitledAppGroups?: string[];
|
|
67
|
+
addOnKeys?: string[];
|
|
68
|
+
apps?: string[];
|
|
69
|
+
accountType?: boolean;
|
|
70
|
+
note?: string;
|
|
71
|
+
}
|
|
72
|
+
/** Resolved entitlements — written only by `entitlements-reconcile`, safe for every client to read. */
|
|
73
|
+
export interface SystemBlock {
|
|
74
|
+
basePlanId?: string;
|
|
75
|
+
addOnKeys?: string[];
|
|
76
|
+
/** Apps unlocked by add-ons. */
|
|
77
|
+
apps?: string[];
|
|
78
|
+
/**
|
|
79
|
+
* Explicit overrides only — an absent key is NOT "off". Resolve with
|
|
80
|
+
* `resolveFeature()` / `isFeatureEnabled()`, which apply the accountType
|
|
81
|
+
* default: `enterprise` defaults every flag to on unless explicitly
|
|
82
|
+
* `false` here; `standard` defaults every flag to off unless explicitly
|
|
83
|
+
* `true` here.
|
|
84
|
+
*/
|
|
85
|
+
features?: Record<string, boolean>;
|
|
86
|
+
meters?: Record<string, MeterEntry>;
|
|
87
|
+
/** Lowercased category names. */
|
|
88
|
+
entitledAppGroups?: string[];
|
|
89
|
+
/**
|
|
90
|
+
* Explicit account tier. `'enterprise'` flips the default for every
|
|
91
|
+
* feature flag to on (see `features`), not just an "unlimited baseline" —
|
|
92
|
+
* absence of a flag no longer means disabled for enterprise accounts.
|
|
93
|
+
*/
|
|
94
|
+
accountType?: 'enterprise' | 'standard';
|
|
95
|
+
/** ISO-8601 UTC. */
|
|
96
|
+
syncedAt?: string;
|
|
97
|
+
syncedFromSubscriptionId?: string;
|
|
98
|
+
/** Diagnostic: which override keys reconcile applied on this pass. */
|
|
99
|
+
appliedOverrides?: AppliedOverridesSummary;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Full `appConfig` settings document for a SmartLinks collection.
|
|
103
|
+
* Fetch with `appConfiguration.getAppConfig(collectionId)`.
|
|
104
|
+
*/
|
|
105
|
+
export interface AppConfigSettings {
|
|
106
|
+
id: 'appConfig';
|
|
107
|
+
/** Installed modules — the customer's chosen surface. */
|
|
108
|
+
apps: AppEntry[];
|
|
109
|
+
/** Optional mirror of add-on keys the customer has toggled. */
|
|
110
|
+
addOns?: string[];
|
|
111
|
+
/** Wizard hint — which base plan the customer picked pre-checkout. */
|
|
112
|
+
requestedBasePlanId?: string;
|
|
113
|
+
/** How the account handles individual physical items. */
|
|
114
|
+
itemRecordMode?: 'registered' | 'owned' | null;
|
|
115
|
+
virtualItemsEnabled?: boolean;
|
|
116
|
+
/** Resolved entitlement truth. Read this to gate features. */
|
|
117
|
+
system?: SystemBlock;
|
|
118
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AssetRef } from "./asset";
|
|
2
|
+
import type { AppConfigSettings } from "./appConfiguration";
|
|
2
3
|
/**
|
|
3
4
|
* Represents a Collection object.
|
|
4
5
|
*/
|
|
@@ -118,8 +119,16 @@ export interface AppConfig {
|
|
|
118
119
|
}
|
|
119
120
|
/**
|
|
120
121
|
* Response containing app configurations for a collection.
|
|
122
|
+
*
|
|
123
|
+
* As of 2026-07-18 this endpoint (`/public/collection/:id/app/config`) also
|
|
124
|
+
* carries the `appConfig` settings-group entitlements data (`system`,
|
|
125
|
+
* `addOns`, `itemRecordMode`, etc.) alongside the app catalog — the same
|
|
126
|
+
* dataset documented in docs/appConfig.md, delivered by this endpoint
|
|
127
|
+
* instead of a separate `appConfiguration.getConfig({ appId: 'appConfig' })`
|
|
128
|
+
* call. Admin-only overrides are never included here since this is a
|
|
129
|
+
* public-only endpoint.
|
|
121
130
|
*/
|
|
122
|
-
export interface AppsConfigResponse {
|
|
123
|
-
/** Array of app
|
|
131
|
+
export interface AppsConfigResponse extends Omit<AppConfigSettings, 'id' | 'apps'> {
|
|
132
|
+
/** Array of app catalog definitions for this collection. */
|
|
124
133
|
apps: AppConfig[];
|
|
125
134
|
}
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.15.
|
|
3
|
+
Version: 1.15.5 | Generated: 2026-07-18T14:07:37.915Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -43,6 +43,7 @@ For detailed guides on specific features:
|
|
|
43
43
|
- **[Contact Search](contact-search.md)** - Admin contact search: free-text, typeahead, identity/tag/JSONB filters, and pagination
|
|
44
44
|
- **[App Data Storage](app-data-storage.md)** - User-specific and collection-scoped app data storage
|
|
45
45
|
- **[Product/Proof Data Scoping](proof-product-data-scoping.md)** - Canonical spec for `product.data`/`.admin` and `proof.data`/`.admin`/`.values` (owner/personal) buckets, read/write authority, and the `productFields`/`proofFields` collection-settings schemas
|
|
46
|
+
- **[appConfig / Feature Flags](appConfig.md)** - `appConfig` settings contract, entitlements (`system.features`/`entitledAppGroups`/`meters`), and the `isFeatureEnabled()` / `isFeatureEnabledSync()` SDK helpers
|
|
46
47
|
- **[Forms](forms.md)** - Platform-managed form definitions, submissions, and schema-driven React form UI
|
|
47
48
|
- **[App Objects: Cases, Threads & Records](app-objects.md)** - Generic app-scoped building blocks for support cases, discussions, bookings, registrations, and more
|
|
48
49
|
- **[App Records Pattern](app-records-pattern.md)** - Canonical pattern for storing per-product, per-facet, or rule-targeted app data
|
|
@@ -1376,6 +1377,81 @@ interface WidgetInstanceSummary {
|
|
|
1376
1377
|
}
|
|
1377
1378
|
```
|
|
1378
1379
|
|
|
1380
|
+
**AppEntry** (interface)
|
|
1381
|
+
```typescript
|
|
1382
|
+
interface AppEntry {
|
|
1383
|
+
id: string
|
|
1384
|
+
uniqueName: string
|
|
1385
|
+
customName?: string
|
|
1386
|
+
active: boolean
|
|
1387
|
+
all?: boolean
|
|
1388
|
+
live?: boolean
|
|
1389
|
+
faIcon?: string
|
|
1390
|
+
versionChannel?: 'stable' | 'beta' | 'dev'
|
|
1391
|
+
reason?: 'not_entitled'
|
|
1392
|
+
[key: string]: unknown
|
|
1393
|
+
}
|
|
1394
|
+
```
|
|
1395
|
+
|
|
1396
|
+
**MeterEntry** (interface)
|
|
1397
|
+
```typescript
|
|
1398
|
+
interface MeterEntry {
|
|
1399
|
+
included: number
|
|
1400
|
+
stripePriceId?: string
|
|
1401
|
+
stripeMeterId?: string
|
|
1402
|
+
}
|
|
1403
|
+
```
|
|
1404
|
+
|
|
1405
|
+
**AppliedOverridesSummary** (interface)
|
|
1406
|
+
```typescript
|
|
1407
|
+
interface AppliedOverridesSummary {
|
|
1408
|
+
features?: string[]
|
|
1409
|
+
meters?: string[]
|
|
1410
|
+
entitledAppGroups?: string[]
|
|
1411
|
+
addOnKeys?: string[]
|
|
1412
|
+
apps?: string[]
|
|
1413
|
+
accountType?: boolean
|
|
1414
|
+
note?: string
|
|
1415
|
+
}
|
|
1416
|
+
```
|
|
1417
|
+
|
|
1418
|
+
**SystemBlock** (interface)
|
|
1419
|
+
```typescript
|
|
1420
|
+
interface SystemBlock {
|
|
1421
|
+
basePlanId?: string
|
|
1422
|
+
addOnKeys?: string[]
|
|
1423
|
+
apps?: string[]
|
|
1424
|
+
* Explicit overrides only — an absent key is NOT "off". Resolve with
|
|
1425
|
+
* `resolveFeature()` / `isFeatureEnabled()`, which apply the accountType
|
|
1426
|
+
* default: `enterprise` defaults every flag to on unless explicitly
|
|
1427
|
+
* `false` here; `standard` defaults every flag to off unless explicitly
|
|
1428
|
+
* `true` here.
|
|
1429
|
+
features?: Record<string, boolean>
|
|
1430
|
+
meters?: Record<string, MeterEntry>
|
|
1431
|
+
entitledAppGroups?: string[]
|
|
1432
|
+
* Explicit account tier. `'enterprise'` flips the default for every
|
|
1433
|
+
* feature flag to on (see `features`), not just an "unlimited baseline" —
|
|
1434
|
+
* absence of a flag no longer means disabled for enterprise accounts.
|
|
1435
|
+
accountType?: 'enterprise' | 'standard'
|
|
1436
|
+
syncedAt?: string
|
|
1437
|
+
syncedFromSubscriptionId?: string
|
|
1438
|
+
appliedOverrides?: AppliedOverridesSummary
|
|
1439
|
+
}
|
|
1440
|
+
```
|
|
1441
|
+
|
|
1442
|
+
**AppConfigSettings** (interface)
|
|
1443
|
+
```typescript
|
|
1444
|
+
interface AppConfigSettings {
|
|
1445
|
+
id: 'appConfig'
|
|
1446
|
+
apps: AppEntry[]
|
|
1447
|
+
addOns?: string[]
|
|
1448
|
+
requestedBasePlanId?: string
|
|
1449
|
+
itemRecordMode?: 'registered' | 'owned' | null
|
|
1450
|
+
virtualItemsEnabled?: boolean
|
|
1451
|
+
system?: SystemBlock
|
|
1452
|
+
}
|
|
1453
|
+
```
|
|
1454
|
+
|
|
1379
1455
|
### appManifest
|
|
1380
1456
|
|
|
1381
1457
|
**AppBundle** (interface)
|
|
@@ -3662,13 +3738,6 @@ interface AppConfig {
|
|
|
3662
3738
|
}
|
|
3663
3739
|
```
|
|
3664
3740
|
|
|
3665
|
-
**AppsConfigResponse** (interface)
|
|
3666
|
-
```typescript
|
|
3667
|
-
interface AppsConfigResponse {
|
|
3668
|
-
apps: AppConfig[]
|
|
3669
|
-
}
|
|
3670
|
-
```
|
|
3671
|
-
|
|
3672
3741
|
**CollectionResponse** = `Collection`
|
|
3673
3742
|
|
|
3674
3743
|
**CollectionCreateRequest** = `Omit<Collection, 'id' | 'shortId'>`
|
|
@@ -8171,6 +8240,21 @@ Delete a keyed data item by ID within a scope. Requires admin authentication. ``
|
|
|
8171
8240
|
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
8172
8241
|
Fetches ALL widget data (manifests + bundle files) for a collection in one call. Returns everything needed to render widgets with zero additional requests. This solves N+1 query problems by fetching manifests, JavaScript bundles, and CSS files in parallel on the server. ```typescript // Fetch all widget data for a collection const { apps } = await Api.AppConfiguration.getWidgets(collectionId); // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...] // Convert bundle source to dynamic imports for (const app of apps) { const blob = new Blob([app.bundleSource], { type: 'application/javascript' }); const blobUrl = URL.createObjectURL(blob); const widgetModule = await import(blobUrl); // Inject CSS if present if (app.bundleCss) { const styleTag = document.createElement('style'); styleTag.textContent = app.bundleCss; document.head.appendChild(styleTag); } } // Force refresh all widgets const { apps } = await Api.AppConfiguration.getWidgets(collectionId, { force: true }); ```
|
|
8173
8242
|
|
|
8243
|
+
**resolveFeature**(system: SystemBlock | undefined, flag: string) → `boolean`
|
|
8244
|
+
Resolve whether a feature flag is on, applying the `accountType` default: `enterprise` accounts default every flag to **on** unless `features[flag]` is explicitly `false`; `standard` accounts (or missing `accountType`) default every flag to **off** unless `features[flag]` is explicitly `true`. An explicit value always wins over the default either way. This is the same logic `isFeatureEnabled()` / `isFeatureEnabledSync()` use internally — call those instead in normal code. `system.features` and `accountType` are public data (no admin-only feature-check path exists), so there's no reason to fetch differently for an admin surface. This is exposed separately only for the rare case where you already have a `system` block in hand from somewhere other than `getAppConfig()` (e.g. server-rendered props) and want to resolve a flag from it directly. ```typescript const enabled = appConfiguration.resolveFeature(someSystemBlock, 'custom_domain'); ```
|
|
8245
|
+
|
|
8246
|
+
**getAppConfig**(collectionId: string,
|
|
8247
|
+
options?: { force?: boolean }) → `Promise<AppsConfigResponse>`
|
|
8248
|
+
Fetch the collection's app catalog + `appConfig` entitlements data in one call — installed modules (`apps`), resolved entitlements (`system.features`, `system.meters`, etc.), and item-handling settings. This is `/public/collection/:id/app/config` (`collection.getAppsConfig()`), which now carries both; there's no need to separately call `appConfiguration.getConfig({ appId: 'appConfig' })` for public reads. Cached in-memory (and sessionStorage) for `ttl` so repeated calls across a page/session are cheap; pass `force` to bypass the cache after a mutation (e.g. after `entitlements-reconcile`). For admin-only data (`systemPrivate`), use `appConfiguration.getConfig({ collectionId, appId: 'appConfig', admin: true })` directly — this endpoint is public-only and never returns it. See docs/appConfig.md for the full contract. ```typescript const cfg = await appConfiguration.getAppConfig(collectionId); console.log(cfg.system?.features); ```
|
|
8249
|
+
|
|
8250
|
+
**isFeatureEnabled**(collectionId: string,
|
|
8251
|
+
flag: string,
|
|
8252
|
+
options?: { force?: boolean }) → `Promise<boolean>`
|
|
8253
|
+
Check whether a feature flag is enabled for a collection, per `appConfig.system.features` — applying the `accountType` default (see `resolveFeature()`): enterprise accounts default every flag to on unless explicitly set to `false`. This is the standard way for subapps to gate features — it reads through the same cache as `getAppConfig`, so calling it repeatedly (e.g. once per component) does not re-fetch on every call. This is always async because the very first call for a collection has nothing to read yet. If you need a synchronous check (e.g. inside a render function), call this once during app init to warm the cache, then use `isFeatureEnabledSync()` afterwards. ```typescript if (await appConfiguration.isFeatureEnabled(collectionId, 'custom_domain')) { enableCustomDomainUI(); } ```
|
|
8254
|
+
|
|
8255
|
+
**isFeatureEnabledSync**(collectionId: string, flag: string) → `boolean | undefined`
|
|
8256
|
+
Synchronous, cache-only check for a feature flag. Returns `undefined` if `getAppConfig()` / `isFeatureEnabled()` hasn't been called yet for this collection this page load (i.e. nothing to read without an await) — treat `undefined` as "not yet known", not as "disabled". ```typescript // Warm the cache once, e.g. in a top-level effect: useEffect(() => { appConfiguration.isFeatureEnabled(collectionId, 'custom_domain') }, [collectionId]); // Elsewhere, read synchronously without an await: const enabled = appConfiguration.isFeatureEnabledSync(collectionId, 'custom_domain'); if (enabled === undefined) { // not warmed yet — fall back to a loading state or the async version } ```
|
|
8257
|
+
|
|
8174
8258
|
### asset
|
|
8175
8259
|
|
|
8176
8260
|
**upload**(options: UploadAssetOptions) → `Promise<Asset>`
|
|
@@ -8719,7 +8803,7 @@ Get the managed-certificate status for a collection's custom domain (admin only)
|
|
|
8719
8803
|
Retrieve a specific settings group for a collection. Public reads return the public view of the settings group. If the stored payload contains a top-level `admin` object, that block is omitted from public responses and included when `admin === true`.
|
|
8720
8804
|
|
|
8721
8805
|
**getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
|
|
8722
|
-
Retrieve all configured app module definitions for a collection (public endpoint).
|
|
8806
|
+
Retrieve all configured app module definitions for a collection (public endpoint), plus the collection's `appConfig` entitlements data (`system.features`, `system.meters`, `entitledAppGroups`, `itemRecordMode`, etc.) in the same response. See docs/appConfig.md. Prefer `appConfiguration.getAppConfig()` / `isFeatureEnabled()` for entitlement reads — they call this endpoint under the hood and cache the result.
|
|
8723
8807
|
|
|
8724
8808
|
**updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
|
|
8725
8809
|
Update a specific settings group for a collection (admin endpoint). This writes through the admin endpoint, but root-level fields are still part of the public settings payload. Put confidential values under `settings.admin` if they should only be returned on admin reads.
|