@proveanything/smartlinks 2.0.65 → 2.0.66
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 +23 -0
- package/dist/api/appConfiguration.js +32 -0
- package/dist/docs/API_SUMMARY.md +11 -1
- package/dist/docs/appConfig.md +37 -0
- package/dist/openapi.yaml +4 -0
- package/dist/types/appConfiguration.d.ts +8 -0
- package/docs/API_SUMMARY.md +11 -1
- package/docs/appConfig.md +37 -0
- package/openapi.yaml +4 -0
- package/package.json +1 -1
|
@@ -483,4 +483,27 @@ export declare namespace appConfiguration {
|
|
|
483
483
|
* ```
|
|
484
484
|
*/
|
|
485
485
|
function isFeatureEnabledSync(collectionId: string, flag: string): boolean | undefined;
|
|
486
|
+
/**
|
|
487
|
+
* Has the collection SWITCHED ON this part of the platform (`appConfig.enabled[key]`)? A missing
|
|
488
|
+
* key is on — only an explicit `false` is off. This is "does this business use it", not "does the
|
|
489
|
+
* plan allow it": for something a plan gates, check `resolveFeature()` as well. docs/appConfig.md §8a.
|
|
490
|
+
*/
|
|
491
|
+
function resolveEnabled(cfg: {
|
|
492
|
+
enabled?: Record<string, boolean>;
|
|
493
|
+
} | null | undefined, key: string): boolean;
|
|
494
|
+
/**
|
|
495
|
+
* Has the collection switched on `key` (`products`, `crm`, `analytics`, `hub`, `portal`,
|
|
496
|
+
* `printStudio`, or an app's own key)? Hide what's off: a website-only business switches off
|
|
497
|
+
* products and the CRM, so menus, cards and setup steps for them shouldn't appear.
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* ```typescript
|
|
501
|
+
* if (await appConfiguration.isEnabled(collectionId, 'products')) showProductsMenu();
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
function isEnabled(collectionId: string, key: string, options?: {
|
|
505
|
+
force?: boolean;
|
|
506
|
+
}): Promise<boolean>;
|
|
507
|
+
/** Cache-only `isEnabled` — `undefined` until `getAppConfig()` has been read this page load. */
|
|
508
|
+
function isEnabledSync(collectionId: string, key: string): boolean | undefined;
|
|
486
509
|
}
|
|
@@ -620,4 +620,36 @@ export var appConfiguration;
|
|
|
620
620
|
return resolveFeature(cfg.system, flag);
|
|
621
621
|
}
|
|
622
622
|
appConfiguration.isFeatureEnabledSync = isFeatureEnabledSync;
|
|
623
|
+
/**
|
|
624
|
+
* Has the collection SWITCHED ON this part of the platform (`appConfig.enabled[key]`)? A missing
|
|
625
|
+
* key is on — only an explicit `false` is off. This is "does this business use it", not "does the
|
|
626
|
+
* plan allow it": for something a plan gates, check `resolveFeature()` as well. docs/appConfig.md §8a.
|
|
627
|
+
*/
|
|
628
|
+
function resolveEnabled(cfg, key) {
|
|
629
|
+
var _a;
|
|
630
|
+
return ((_a = cfg === null || cfg === void 0 ? void 0 : cfg.enabled) === null || _a === void 0 ? void 0 : _a[key]) !== false;
|
|
631
|
+
}
|
|
632
|
+
appConfiguration.resolveEnabled = resolveEnabled;
|
|
633
|
+
/**
|
|
634
|
+
* Has the collection switched on `key` (`products`, `crm`, `analytics`, `hub`, `portal`,
|
|
635
|
+
* `printStudio`, or an app's own key)? Hide what's off: a website-only business switches off
|
|
636
|
+
* products and the CRM, so menus, cards and setup steps for them shouldn't appear.
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
* ```typescript
|
|
640
|
+
* if (await appConfiguration.isEnabled(collectionId, 'products')) showProductsMenu();
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
async function isEnabled(collectionId, key, options) {
|
|
644
|
+
return resolveEnabled(await getAppConfig(collectionId, options), key);
|
|
645
|
+
}
|
|
646
|
+
appConfiguration.isEnabled = isEnabled;
|
|
647
|
+
/** Cache-only `isEnabled` — `undefined` until `getAppConfig()` has been read this page load. */
|
|
648
|
+
function isEnabledSync(collectionId, key) {
|
|
649
|
+
const cfg = cache.peek(appConfigCacheKey(collectionId));
|
|
650
|
+
if (!cfg)
|
|
651
|
+
return undefined;
|
|
652
|
+
return resolveEnabled(cfg, key);
|
|
653
|
+
}
|
|
654
|
+
appConfiguration.isEnabledSync = isEnabledSync;
|
|
623
655
|
})(appConfiguration || (appConfiguration = {}));
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.66 | Generated: 2026-10-14T17:03:31.949Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -2479,6 +2479,7 @@ interface AppConfigSettings {
|
|
|
2479
2479
|
addOns?: string[]
|
|
2480
2480
|
requestedBasePlanId?: string
|
|
2481
2481
|
itemRecordMode?: 'registered' | 'owned' | null
|
|
2482
|
+
enabled?: Record<string, boolean>
|
|
2482
2483
|
system?: SystemBlock
|
|
2483
2484
|
}
|
|
2484
2485
|
```
|
|
@@ -10886,6 +10887,15 @@ Check whether a feature flag is enabled for a collection, per `appConfig.system.
|
|
|
10886
10887
|
**isFeatureEnabledSync**(collectionId: string, flag: string) → `boolean | undefined`
|
|
10887
10888
|
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 } ```
|
|
10888
10889
|
|
|
10890
|
+
**resolveEnabled**(cfg: { enabled?: Record<string, boolean> } | null | undefined, key: string) → `boolean`
|
|
10891
|
+
Has the collection SWITCHED ON this part of the platform (`appConfig.enabled[key]`)? A missing key is on — only an explicit `false` is off. This is "does this business use it", not "does the plan allow it": for something a plan gates, check `resolveFeature()` as well. docs/appConfig.md §8a.
|
|
10892
|
+
|
|
10893
|
+
**isEnabled**(collectionId: string, key: string, options?: { force?: boolean }) → `Promise<boolean>`
|
|
10894
|
+
Has the collection switched on `key` (`products`, `crm`, `analytics`, `hub`, `portal`, `printStudio`, or an app's own key)? Hide what's off: a website-only business switches off products and the CRM, so menus, cards and setup steps for them shouldn't appear. ```typescript if (await appConfiguration.isEnabled(collectionId, 'products')) showProductsMenu(); ```
|
|
10895
|
+
|
|
10896
|
+
**isEnabledSync**(collectionId: string, key: string) → `boolean | undefined`
|
|
10897
|
+
Cache-only `isEnabled` — `undefined` until `getAppConfig()` has been read this page load.
|
|
10898
|
+
|
|
10889
10899
|
### asset
|
|
10890
10900
|
|
|
10891
10901
|
**upload**(options: UploadAssetOptions) → `Promise<Asset>`
|
package/dist/docs/appConfig.md
CHANGED
|
@@ -36,6 +36,8 @@ export interface AppConfigSettings {
|
|
|
36
36
|
|
|
37
37
|
/** How the account handles individual physical items. */
|
|
38
38
|
itemRecordMode?: 'registered' | 'owned' | null;
|
|
39
|
+
/** What the collection has switched on (absent key = on) — see §8a. */
|
|
40
|
+
enabled?: Record<string, boolean>;
|
|
39
41
|
|
|
40
42
|
// ── SYSTEM-OWNED, PUBLIC (reconcile writes; client read-only) ─────
|
|
41
43
|
/** Resolved entitlement truth. Read this to gate features. */
|
|
@@ -501,6 +503,41 @@ the customer add-ons page (`src/components/pricing/ItemHandlingSection`)
|
|
|
501
503
|
because these settings change the whole UX shape (claim, ownership,
|
|
502
504
|
CRM visibility), not just a capability flag.
|
|
503
505
|
|
|
506
|
+
## 8a. What's switched on (`enabled`)
|
|
507
|
+
|
|
508
|
+
A root-level, user-owned map (like `itemRecordMode`; reconcile never touches it) saying which parts of
|
|
509
|
+
the platform this collection **uses** — separate from what its plan **allows** (`system.features`):
|
|
510
|
+
|
|
511
|
+
| | Plan allows (`system.features`) | Switched on (`enabled`) |
|
|
512
|
+
|---|---|---|
|
|
513
|
+
| Written by | billing (`entitlements-reconcile`) | the collection: sign-up wizards, admins |
|
|
514
|
+
| Means | "you may have this" | "this business uses this" |
|
|
515
|
+
| Missing key | standard: off · enterprise: on | **on** |
|
|
516
|
+
|
|
517
|
+
```json
|
|
518
|
+
{ "enabled": { "products": false, "crm": false, "hub": false, "portal": false, "printStudio": false } }
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
**A missing key is on**, so a collection that never set `enabled` behaves exactly as before. Only an
|
|
522
|
+
explicit `false` switches something off. A website-only sign-up switches off what it doesn't use
|
|
523
|
+
(products, CRM, Hub, Portal…), and Studio hides the menus, dashboard cards and setup steps for them;
|
|
524
|
+
an admin can switch them back on.
|
|
525
|
+
|
|
526
|
+
Known keys: `products`, `crm`, `analytics`, `hub`, `portal`, `printStudio`. The map is open — an app
|
|
527
|
+
may define its own key.
|
|
528
|
+
|
|
529
|
+
```ts
|
|
530
|
+
if (await SL.appConfiguration.isEnabled(collectionId, 'products')) showProducts()
|
|
531
|
+
// already have the config:
|
|
532
|
+
SL.appConfiguration.resolveEnabled(cfg, 'crm')
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
For something a plan gates, show it only when both hold: `resolveEnabled(cfg, key)` **and**
|
|
536
|
+
`resolveFeature(cfg.system, flag)`.
|
|
537
|
+
|
|
538
|
+
Write it through the admin settings route (`collection.updateSettings(collectionId, 'appConfig',
|
|
539
|
+
{ enabled: { products: true } })`) — keys merge, so set only the ones you change.
|
|
540
|
+
|
|
504
541
|
## 9. Migration notes
|
|
505
542
|
|
|
506
543
|
- Legacy `entitlements` settings group is deprecated. Everything moved
|
package/dist/openapi.yaml
CHANGED
|
@@ -19168,6 +19168,10 @@ components:
|
|
|
19168
19168
|
enum:
|
|
19169
19169
|
- registered
|
|
19170
19170
|
- owned
|
|
19171
|
+
enabled:
|
|
19172
|
+
type: object
|
|
19173
|
+
additionalProperties:
|
|
19174
|
+
type: boolean
|
|
19171
19175
|
system:
|
|
19172
19176
|
$ref: "#/components/schemas/SystemBlock"
|
|
19173
19177
|
required:
|
|
@@ -128,6 +128,14 @@ export interface AppConfigSettings {
|
|
|
128
128
|
requestedBasePlanId?: string;
|
|
129
129
|
/** How the account handles individual physical items. */
|
|
130
130
|
itemRecordMode?: 'registered' | 'owned' | null;
|
|
131
|
+
/**
|
|
132
|
+
* What this collection has SWITCHED ON — separate from what its plan allows (`system.features`).
|
|
133
|
+
* A missing key means on, so collections that never set it behave as they always have. A website
|
|
134
|
+
* sign-up switches off what it doesn't use, e.g. `{ products: false, crm: false, hub: false }`.
|
|
135
|
+
* Known keys: `products`, `crm`, `analytics`, `hub`, `portal`, `printStudio`; the map is open.
|
|
136
|
+
* Read it with `appConfiguration.isEnabled()` / `resolveEnabled()` — docs/appConfig.md §8a.
|
|
137
|
+
*/
|
|
138
|
+
enabled?: Record<string, boolean>;
|
|
131
139
|
/** Resolved entitlement truth. Read this to gate features. */
|
|
132
140
|
system?: SystemBlock;
|
|
133
141
|
}
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.66 | Generated: 2026-10-14T17:03:31.949Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -2479,6 +2479,7 @@ interface AppConfigSettings {
|
|
|
2479
2479
|
addOns?: string[]
|
|
2480
2480
|
requestedBasePlanId?: string
|
|
2481
2481
|
itemRecordMode?: 'registered' | 'owned' | null
|
|
2482
|
+
enabled?: Record<string, boolean>
|
|
2482
2483
|
system?: SystemBlock
|
|
2483
2484
|
}
|
|
2484
2485
|
```
|
|
@@ -10886,6 +10887,15 @@ Check whether a feature flag is enabled for a collection, per `appConfig.system.
|
|
|
10886
10887
|
**isFeatureEnabledSync**(collectionId: string, flag: string) → `boolean | undefined`
|
|
10887
10888
|
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 } ```
|
|
10888
10889
|
|
|
10890
|
+
**resolveEnabled**(cfg: { enabled?: Record<string, boolean> } | null | undefined, key: string) → `boolean`
|
|
10891
|
+
Has the collection SWITCHED ON this part of the platform (`appConfig.enabled[key]`)? A missing key is on — only an explicit `false` is off. This is "does this business use it", not "does the plan allow it": for something a plan gates, check `resolveFeature()` as well. docs/appConfig.md §8a.
|
|
10892
|
+
|
|
10893
|
+
**isEnabled**(collectionId: string, key: string, options?: { force?: boolean }) → `Promise<boolean>`
|
|
10894
|
+
Has the collection switched on `key` (`products`, `crm`, `analytics`, `hub`, `portal`, `printStudio`, or an app's own key)? Hide what's off: a website-only business switches off products and the CRM, so menus, cards and setup steps for them shouldn't appear. ```typescript if (await appConfiguration.isEnabled(collectionId, 'products')) showProductsMenu(); ```
|
|
10895
|
+
|
|
10896
|
+
**isEnabledSync**(collectionId: string, key: string) → `boolean | undefined`
|
|
10897
|
+
Cache-only `isEnabled` — `undefined` until `getAppConfig()` has been read this page load.
|
|
10898
|
+
|
|
10889
10899
|
### asset
|
|
10890
10900
|
|
|
10891
10901
|
**upload**(options: UploadAssetOptions) → `Promise<Asset>`
|
package/docs/appConfig.md
CHANGED
|
@@ -36,6 +36,8 @@ export interface AppConfigSettings {
|
|
|
36
36
|
|
|
37
37
|
/** How the account handles individual physical items. */
|
|
38
38
|
itemRecordMode?: 'registered' | 'owned' | null;
|
|
39
|
+
/** What the collection has switched on (absent key = on) — see §8a. */
|
|
40
|
+
enabled?: Record<string, boolean>;
|
|
39
41
|
|
|
40
42
|
// ── SYSTEM-OWNED, PUBLIC (reconcile writes; client read-only) ─────
|
|
41
43
|
/** Resolved entitlement truth. Read this to gate features. */
|
|
@@ -501,6 +503,41 @@ the customer add-ons page (`src/components/pricing/ItemHandlingSection`)
|
|
|
501
503
|
because these settings change the whole UX shape (claim, ownership,
|
|
502
504
|
CRM visibility), not just a capability flag.
|
|
503
505
|
|
|
506
|
+
## 8a. What's switched on (`enabled`)
|
|
507
|
+
|
|
508
|
+
A root-level, user-owned map (like `itemRecordMode`; reconcile never touches it) saying which parts of
|
|
509
|
+
the platform this collection **uses** — separate from what its plan **allows** (`system.features`):
|
|
510
|
+
|
|
511
|
+
| | Plan allows (`system.features`) | Switched on (`enabled`) |
|
|
512
|
+
|---|---|---|
|
|
513
|
+
| Written by | billing (`entitlements-reconcile`) | the collection: sign-up wizards, admins |
|
|
514
|
+
| Means | "you may have this" | "this business uses this" |
|
|
515
|
+
| Missing key | standard: off · enterprise: on | **on** |
|
|
516
|
+
|
|
517
|
+
```json
|
|
518
|
+
{ "enabled": { "products": false, "crm": false, "hub": false, "portal": false, "printStudio": false } }
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
**A missing key is on**, so a collection that never set `enabled` behaves exactly as before. Only an
|
|
522
|
+
explicit `false` switches something off. A website-only sign-up switches off what it doesn't use
|
|
523
|
+
(products, CRM, Hub, Portal…), and Studio hides the menus, dashboard cards and setup steps for them;
|
|
524
|
+
an admin can switch them back on.
|
|
525
|
+
|
|
526
|
+
Known keys: `products`, `crm`, `analytics`, `hub`, `portal`, `printStudio`. The map is open — an app
|
|
527
|
+
may define its own key.
|
|
528
|
+
|
|
529
|
+
```ts
|
|
530
|
+
if (await SL.appConfiguration.isEnabled(collectionId, 'products')) showProducts()
|
|
531
|
+
// already have the config:
|
|
532
|
+
SL.appConfiguration.resolveEnabled(cfg, 'crm')
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
For something a plan gates, show it only when both hold: `resolveEnabled(cfg, key)` **and**
|
|
536
|
+
`resolveFeature(cfg.system, flag)`.
|
|
537
|
+
|
|
538
|
+
Write it through the admin settings route (`collection.updateSettings(collectionId, 'appConfig',
|
|
539
|
+
{ enabled: { products: true } })`) — keys merge, so set only the ones you change.
|
|
540
|
+
|
|
504
541
|
## 9. Migration notes
|
|
505
542
|
|
|
506
543
|
- Legacy `entitlements` settings group is deprecated. Everything moved
|
package/openapi.yaml
CHANGED
|
@@ -19168,6 +19168,10 @@ components:
|
|
|
19168
19168
|
enum:
|
|
19169
19169
|
- registered
|
|
19170
19170
|
- owned
|
|
19171
|
+
enabled:
|
|
19172
|
+
type: object
|
|
19173
|
+
additionalProperties:
|
|
19174
|
+
type: boolean
|
|
19171
19175
|
system:
|
|
19172
19176
|
$ref: "#/components/schemas/SystemBlock"
|
|
19173
19177
|
required:
|