@proveanything/smartlinks 2.0.6 → 2.0.10
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/ai.d.ts +1 -1
- package/dist/api/ai.js +1 -1
- package/dist/api/analytics.d.ts +1 -1
- package/dist/api/analytics.js +1 -1
- package/dist/api/appConfiguration.d.ts +3 -3
- package/dist/api/appConfiguration.js +3 -3
- package/dist/api/appObjects.d.ts +1 -1
- package/dist/api/appObjects.js +1 -1
- package/dist/api/asset.d.ts +1 -1
- package/dist/api/asset.js +2 -2
- package/dist/api/async.d.ts +1 -1
- package/dist/api/async.js +1 -1
- package/dist/api/attestation.d.ts +1 -1
- package/dist/api/attestation.js +1 -1
- package/dist/api/attestations.d.ts +1 -1
- package/dist/api/attestations.js +1 -1
- package/dist/api/auth.d.ts +2 -2
- package/dist/api/auth.js +2 -2
- package/dist/api/authKit.d.ts +1 -1
- package/dist/api/authKit.js +1 -1
- package/dist/api/batch.d.ts +1 -1
- package/dist/api/batch.js +1 -1
- package/dist/api/broadcasts.d.ts +2 -2
- package/dist/api/broadcasts.js +1 -1
- package/dist/api/claimSet.d.ts +1 -1
- package/dist/api/claimSet.js +1 -1
- package/dist/api/collection.d.ts +1 -1
- package/dist/api/collection.js +1 -1
- package/dist/api/comms.d.ts +15 -15
- package/dist/api/comms.js +1 -1
- package/dist/api/config.d.ts +1 -1
- package/dist/api/config.js +1 -1
- package/dist/api/contact.d.ts +1 -1
- package/dist/api/contact.js +1 -1
- package/dist/api/containers.d.ts +1 -1
- package/dist/api/containers.js +1 -1
- package/dist/api/crate.d.ts +1 -1
- package/dist/api/crate.js +1 -1
- package/dist/api/facets.d.ts +1 -1
- package/dist/api/facets.js +1 -1
- package/dist/api/form.js +1 -1
- package/dist/api/http.js +1 -1
- package/dist/api/index.d.ts +46 -46
- package/dist/api/index.js +46 -46
- package/dist/api/integrations.d.ts +1 -1
- package/dist/api/integrations.js +1 -1
- package/dist/api/interactions.d.ts +1 -1
- package/dist/api/interactions.js +1 -1
- package/dist/api/jobs.d.ts +1 -1
- package/dist/api/jobs.js +1 -1
- package/dist/api/journeys.d.ts +1 -1
- package/dist/api/journeys.js +1 -1
- package/dist/api/journeysAnalytics.d.ts +1 -1
- package/dist/api/journeysAnalytics.js +1 -1
- package/dist/api/location.d.ts +1 -1
- package/dist/api/location.js +1 -1
- package/dist/api/lots.d.ts +1 -1
- package/dist/api/lots.js +1 -1
- package/dist/api/loyalty.d.ts +1 -1
- package/dist/api/loyalty.js +1 -1
- package/dist/api/navigation.d.ts +1 -1
- package/dist/api/navigation.js +1 -1
- package/dist/api/nfc.d.ts +1 -1
- package/dist/api/nfc.js +1 -1
- package/dist/api/order.d.ts +1 -1
- package/dist/api/order.js +1 -1
- package/dist/api/product.d.ts +1 -1
- package/dist/api/product.js +1 -1
- package/dist/api/products.d.ts +1 -1
- package/dist/api/products.js +1 -1
- package/dist/api/proof.d.ts +1 -1
- package/dist/api/proof.js +1 -1
- package/dist/api/qr.d.ts +1 -1
- package/dist/api/qr.js +1 -1
- package/dist/api/realtime.d.ts +1 -1
- package/dist/api/realtime.js +1 -1
- package/dist/api/research.d.ts +1 -1
- package/dist/api/research.js +1 -1
- package/dist/api/secrets.d.ts +1 -1
- package/dist/api/secrets.js +1 -1
- package/dist/api/segments.d.ts +1 -1
- package/dist/api/segments.js +1 -1
- package/dist/api/sequence.js +1 -1
- package/dist/api/tags.d.ts +1 -1
- package/dist/api/tags.js +1 -1
- package/dist/api/template.d.ts +1 -1
- package/dist/api/template.js +1 -1
- package/dist/api/translations.d.ts +1 -1
- package/dist/api/translations.js +2 -2
- package/dist/api/variant.d.ts +1 -1
- package/dist/api/variant.js +1 -1
- package/dist/containers/types.d.ts +1 -1
- package/dist/docs/API_SUMMARY.md +7 -7
- package/dist/docs/agent-tools.md +26 -14
- package/dist/docs/ai.md +14 -520
- package/dist/docs/analytics.md +41 -2
- package/dist/docs/app-data-storage.md +0 -38
- package/dist/docs/app-manifest.md +106 -7
- package/dist/docs/app-objects.md +0 -148
- package/dist/docs/app-records-pattern.md +2 -2
- package/dist/docs/building-react-components.md +6 -14
- package/dist/docs/caching.md +20 -21
- package/dist/docs/container-tracking.md +2 -0
- package/dist/docs/containers.md +14 -66
- package/dist/docs/executor.md +4 -4
- package/dist/docs/host-dependency-contract.md +27 -0
- package/dist/docs/iframe-responder.md +308 -0
- package/dist/docs/item-context.md +0 -2
- package/dist/docs/manifests.md +3 -3
- package/dist/docs/mobile-admin-container.md +4 -4
- package/dist/docs/mpa.md +5 -5
- package/dist/docs/native-facade.md +1 -1
- package/dist/docs/overview.md +35 -16
- package/dist/docs/portal-back-button.md +2 -3
- package/dist/docs/widgets.md +11 -69
- package/dist/http.d.ts +24 -8
- package/dist/http.js +32 -14
- package/dist/iframe.d.ts +2 -2
- package/dist/iframe.js +1 -1
- package/dist/iframeResponder.d.ts +7 -1
- package/dist/iframeResponder.js +45 -4
- package/dist/index.d.ts +30 -27
- package/dist/index.js +10 -8
- package/dist/mobile-admin/errors.d.ts +1 -1
- package/dist/mobile-admin/types.d.ts +2 -2
- package/dist/openapi.yaml +12 -0
- package/dist/shared-dependencies.d.ts +37 -0
- package/dist/shared-dependencies.js +79 -0
- package/dist/testing/index.d.ts +1 -1
- package/dist/translationCache.d.ts +1 -1
- package/dist/types/appManifest.d.ts +23 -0
- package/dist/types/broadcasts.d.ts +1 -1
- package/dist/types/collection.d.ts +2 -2
- package/dist/types/comms.d.ts +5 -5
- package/dist/types/contact.d.ts +1 -1
- package/dist/types/facets.d.ts +1 -1
- package/dist/types/iframeResponder.d.ts +3 -3
- package/dist/types/index.d.ts +44 -44
- package/dist/types/index.js +44 -44
- package/dist/types/interaction.d.ts +1 -1
- package/dist/types/itemContext.d.ts +1 -1
- package/dist/types/journeysAnalytics.d.ts +1 -1
- package/dist/types/navigation.d.ts +1 -1
- package/dist/types/product.d.ts +1 -1
- package/dist/types/proof.d.ts +1 -1
- package/dist/types/segments.d.ts +1 -1
- package/dist/types/widgets.d.ts +2 -2
- package/dist/utils/conditions.d.ts +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/utils/paths.d.ts +4 -4
- package/docs/API_SUMMARY.md +7 -7
- package/docs/agent-tools.md +26 -14
- package/docs/ai.md +14 -520
- package/docs/analytics.md +41 -2
- package/docs/app-data-storage.md +0 -38
- package/docs/app-manifest.md +106 -7
- package/docs/app-objects.md +0 -148
- package/docs/app-records-pattern.md +2 -2
- package/docs/building-react-components.md +6 -14
- package/docs/caching.md +20 -21
- package/docs/container-tracking.md +2 -0
- package/docs/containers.md +14 -66
- package/docs/executor.md +4 -4
- package/docs/host-dependency-contract.md +27 -0
- package/docs/iframe-responder.md +308 -0
- package/docs/item-context.md +0 -2
- package/docs/mobile-admin-container.md +4 -4
- package/docs/mpa.md +5 -5
- package/docs/native-facade.md +1 -1
- package/docs/overview.md +35 -16
- package/docs/portal-back-button.md +2 -3
- package/docs/widgets.md +11 -69
- package/openapi.yaml +12 -0
- package/package.json +17 -6
- package/scripts/doctor.mjs +171 -0
- package/docs/analytics-metadata-conventions.md +0 -88
- package/docs/iframe-streaming-parent-changes.md +0 -308
- package/docs/manifests.md +0 -204
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/shared-dependencies.ts
|
|
2
|
+
// -----------------------------------------------------------------------------
|
|
3
|
+
// The host↔app SHARED DEPENDENCY CONTRACT — the single source of truth for which
|
|
4
|
+
// libraries the R5 portal (host) provides as singletons, so apps externalize them
|
|
5
|
+
// instead of bundling their own copy.
|
|
6
|
+
//
|
|
7
|
+
// The host publishes these to modern (ESM) apps via a versioned import map, and to
|
|
8
|
+
// legacy (UMD) apps via window globals. Both hosts and app authors should read THIS
|
|
9
|
+
// list rather than hard-coding their own — a mismatch is what causes duplicate-React
|
|
10
|
+
// crashes and silent blank containers.
|
|
11
|
+
//
|
|
12
|
+
// See docs/host-dependency-contract.md.
|
|
13
|
+
/** Current contract revision. Bumped when the entry list or host versions change. */
|
|
14
|
+
export const SHARED_DEPENDENCY_CONTRACT_VERSION = 'v5';
|
|
15
|
+
/**
|
|
16
|
+
* Canonical import-map path for a specifier: drop the leading `@` scope marker and
|
|
17
|
+
* turn every `/` into `-`.
|
|
18
|
+
* 'react-dom/client' -> '/sl-shared/v5/react-dom-client.js'
|
|
19
|
+
* '@radix-ui/react-slot' -> '/sl-shared/v5/radix-ui-react-slot.js'
|
|
20
|
+
* Hosts MUST serve shims at these paths so the map the SDK advertises resolves.
|
|
21
|
+
*/
|
|
22
|
+
export function importMapPathFor(specifier, version = SHARED_DEPENDENCY_CONTRACT_VERSION) {
|
|
23
|
+
const slug = specifier.replace(/^@/, '').replace(/\//g, '-');
|
|
24
|
+
return `/sl-shared/${version}/${slug}.js`;
|
|
25
|
+
}
|
|
26
|
+
// The 25-entry v5 contract: the historical 23 plus `react-dom/client` and
|
|
27
|
+
// `react/jsx-dev-runtime`. minVersion follows the R5 host baseline (React 19,
|
|
28
|
+
// Router 7.18.4 security floor, LiquidJS 10.27+, current Radix majors).
|
|
29
|
+
const CONTRACT = [
|
|
30
|
+
{ specifier: 'react', globalName: 'React', minVersion: '19.0.0' },
|
|
31
|
+
{ specifier: 'react-dom', globalName: 'ReactDOM', minVersion: '19.0.0' },
|
|
32
|
+
{ specifier: 'react-dom/client', globalName: 'ReactDOMClient', minVersion: '19.0.0' },
|
|
33
|
+
{ specifier: 'react/jsx-runtime', globalName: 'jsxRuntime', minVersion: '19.0.0' },
|
|
34
|
+
{ specifier: 'react/jsx-dev-runtime', globalName: 'jsxDevRuntime', minVersion: '19.0.0' },
|
|
35
|
+
{ specifier: '@proveanything/smartlinks', globalName: 'SL', minVersion: '2.0.0' },
|
|
36
|
+
{ specifier: '@proveanything/smartlinks-auth-ui', globalName: 'SmartlinksAuthUI', minVersion: '2.0.0' },
|
|
37
|
+
{ specifier: 'react-router-dom', globalName: 'ReactRouterDOM', minVersion: '7.18.4' },
|
|
38
|
+
{ specifier: '@tanstack/react-query', globalName: 'ReactQuery', minVersion: '5.0.0' },
|
|
39
|
+
{ specifier: 'lucide-react', globalName: 'LucideReact', minVersion: '1.0.0' },
|
|
40
|
+
{ specifier: 'date-fns', globalName: 'dateFns', minVersion: '4.0.0' },
|
|
41
|
+
{ specifier: 'liquidjs', globalName: 'LiquidJS', minVersion: '10.27.0' },
|
|
42
|
+
{ specifier: 'class-variance-authority', globalName: 'CVA', minVersion: '0.7.0' },
|
|
43
|
+
{ specifier: '@radix-ui/react-slot', globalName: 'RadixSlot', minVersion: '1.2.0' },
|
|
44
|
+
{ specifier: '@radix-ui/react-dialog', globalName: 'RadixDialog', minVersion: '1.1.0' },
|
|
45
|
+
{ specifier: '@radix-ui/react-popover', globalName: 'RadixPopover', minVersion: '1.1.0' },
|
|
46
|
+
{ specifier: '@radix-ui/react-tooltip', globalName: 'RadixTooltip', minVersion: '1.2.0' },
|
|
47
|
+
{ specifier: '@radix-ui/react-tabs', globalName: 'RadixTabs', minVersion: '1.1.0' },
|
|
48
|
+
{ specifier: '@radix-ui/react-accordion', globalName: 'RadixAccordion', minVersion: '1.2.0' },
|
|
49
|
+
{ specifier: '@radix-ui/react-select', globalName: 'RadixSelect', minVersion: '2.3.0' },
|
|
50
|
+
{ specifier: '@radix-ui/react-scroll-area', globalName: 'RadixScrollArea', minVersion: '1.2.0' },
|
|
51
|
+
{ specifier: '@radix-ui/react-label', globalName: 'RadixLabel', minVersion: '2.1.0' },
|
|
52
|
+
{ specifier: '@radix-ui/react-toast', globalName: 'RadixToast', minVersion: '1.2.0' },
|
|
53
|
+
{ specifier: '@radix-ui/react-progress', globalName: 'RadixProgress', minVersion: '1.1.0' },
|
|
54
|
+
{ specifier: '@radix-ui/react-avatar', globalName: 'RadixAvatar', minVersion: '1.1.0' },
|
|
55
|
+
];
|
|
56
|
+
/** The full shared-dependency contract for {@link SHARED_DEPENDENCY_CONTRACT_VERSION}. */
|
|
57
|
+
export const SHARED_DEPENDENCIES = CONTRACT.map((d) => (Object.assign(Object.assign({}, d), { importMapPath: importMapPathFor(d.specifier) })));
|
|
58
|
+
/** Just the bare specifiers — handy for a bundler `external` list. */
|
|
59
|
+
export const SHARED_DEPENDENCY_SPECIFIERS = SHARED_DEPENDENCIES.map((d) => d.specifier);
|
|
60
|
+
/**
|
|
61
|
+
* Read the shared-dependency contract the current host advertises at runtime
|
|
62
|
+
* (via `window.__SMARTLINKS_SHARED__`). Returns `null` when there is no host
|
|
63
|
+
* marker — e.g. an older portal, or the bundle running outside a portal — so an
|
|
64
|
+
* app can degrade gracefully or fail with an actionable message instead of a
|
|
65
|
+
* bare-specifier resolution crash.
|
|
66
|
+
*/
|
|
67
|
+
export function getHostSharedDependencies() {
|
|
68
|
+
const g = globalThis;
|
|
69
|
+
const marker = g.__SMARTLINKS_SHARED__;
|
|
70
|
+
if (!marker || typeof marker !== 'object')
|
|
71
|
+
return null;
|
|
72
|
+
const version = typeof marker.version === 'string' ? marker.version : null;
|
|
73
|
+
const specifiers = Array.isArray(marker.specifiers)
|
|
74
|
+
? marker.specifiers.filter((s) => typeof s === 'string')
|
|
75
|
+
: null;
|
|
76
|
+
if (!version || !specifiers)
|
|
77
|
+
return null;
|
|
78
|
+
return { version, specifiers };
|
|
79
|
+
}
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResolvedTranslationItem, TranslationContext, TranslationHashOptions } from './types/translations';
|
|
1
|
+
import type { ResolvedTranslationItem, TranslationContext, TranslationHashOptions } from './types/translations.js';
|
|
2
2
|
interface LocalTranslationCacheEntry {
|
|
3
3
|
collectionId: string;
|
|
4
4
|
sourceLanguage: string;
|
|
@@ -405,6 +405,29 @@ export interface AppManifest {
|
|
|
405
405
|
version: string;
|
|
406
406
|
platformRevision?: string;
|
|
407
407
|
appId: string;
|
|
408
|
+
/**
|
|
409
|
+
* How this app's bundles are packaged, so the host knows how to load them:
|
|
410
|
+
* - `"umd"` (default when absent) — host loads the UMD bundle (`files.js.umd`)
|
|
411
|
+
* via the CommonJS `require` shim, resolving shared deps from window globals.
|
|
412
|
+
* Every existing app keeps working with no change.
|
|
413
|
+
* - `"dual"` — host prefers the ESM bundle (`files.js.esm`) when it has an import
|
|
414
|
+
* map for the declared `sharedDependencies` contract; falls back to UMD otherwise.
|
|
415
|
+
* - `"esm"` — host loads ESM natively; if it has no matching import map it fails
|
|
416
|
+
* with an actionable error rather than a bare-specifier resolution crash.
|
|
417
|
+
*/
|
|
418
|
+
moduleFormat?: 'umd' | 'esm' | 'dual';
|
|
419
|
+
/**
|
|
420
|
+
* Shared-dependency contract version this bundle was built against, e.g. `"v5"`
|
|
421
|
+
* (see `SHARED_DEPENDENCY_CONTRACT_VERSION`). The host uses it to select a
|
|
422
|
+
* compatible import map for the ESM load path.
|
|
423
|
+
*/
|
|
424
|
+
sharedDependencies?: string;
|
|
425
|
+
/**
|
|
426
|
+
* Per-app namespaced UMD globals (R4.7+), e.g. `{ widgets: "MyAppWidgets" }`.
|
|
427
|
+
* UMD-only: ESM bundles expose their exports through the module namespace and
|
|
428
|
+
* don't need this. Absent → legacy bundle (colliding `window.SmartLinks{Surface}`).
|
|
429
|
+
*/
|
|
430
|
+
globals?: Record<string, string>;
|
|
408
431
|
/**
|
|
409
432
|
* SEO configuration for this app.
|
|
410
433
|
* `priority` controls which app's singular fields (title, description, ogImage) win
|
package/dist/types/comms.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IdField } from './common';
|
|
2
|
-
import type { BroadcastChannel } from './broadcasts';
|
|
1
|
+
import type { IdField } from './common.js';
|
|
2
|
+
import type { BroadcastChannel } from './broadcasts.js';
|
|
3
3
|
/**
|
|
4
4
|
* Target subject for notifications (product, collection, etc.)
|
|
5
5
|
*/
|
|
@@ -93,7 +93,7 @@ export interface AppendBulkResult {
|
|
|
93
93
|
success: true;
|
|
94
94
|
count: number;
|
|
95
95
|
}
|
|
96
|
-
export type Recipient = import('./contact').Contact;
|
|
96
|
+
export type Recipient = import('./contact.js').Contact;
|
|
97
97
|
export interface RecipientsPage {
|
|
98
98
|
items: Recipient[];
|
|
99
99
|
total: number;
|
|
@@ -181,7 +181,7 @@ export interface UnsubscribeResponse {
|
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
183
|
export type ConsentChannels = Partial<Record<BroadcastChannel, boolean>>;
|
|
184
|
-
type SubjectType = import('./contact').SubjectType;
|
|
184
|
+
type SubjectType = import('./contact.js').SubjectType;
|
|
185
185
|
export interface CommsConsentUpsertRequest {
|
|
186
186
|
contactId: string;
|
|
187
187
|
channels?: ConsentChannels;
|
|
@@ -229,7 +229,7 @@ export interface CommsListMethodsQuery {
|
|
|
229
229
|
}
|
|
230
230
|
export interface CommsListMethodsResponse {
|
|
231
231
|
ok: true;
|
|
232
|
-
methods: import('./contact').CommMethod[];
|
|
232
|
+
methods: import('./contact.js').CommMethod[];
|
|
233
233
|
}
|
|
234
234
|
export interface RegisterEmailMethodRequest {
|
|
235
235
|
contactId?: string;
|
package/dist/types/contact.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export interface PublicUpdateMyContactResponse {
|
|
|
103
103
|
ok: boolean;
|
|
104
104
|
contact: ContactPublic;
|
|
105
105
|
}
|
|
106
|
-
export type ChannelName = import('./broadcasts').BroadcastChannel;
|
|
106
|
+
export type ChannelName = import('./broadcasts.js').BroadcastChannel;
|
|
107
107
|
export type SubjectType = 'product' | 'proof' | 'batch';
|
|
108
108
|
/** Registered delivery method for a contact */
|
|
109
109
|
export interface CommMethodMeta {
|
package/dist/types/facets.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type { AuthKitUser } from './authKit';
|
|
2
|
-
export type { AppConfig as CollectionApp } from './collection';
|
|
3
|
-
import type { AppConfig } from './collection';
|
|
1
|
+
export type { AuthKitUser } from './authKit.js';
|
|
2
|
+
export type { AppConfig as CollectionApp } from './collection.js';
|
|
3
|
+
import type { AppConfig } from './collection.js';
|
|
4
4
|
export interface CachedData {
|
|
5
5
|
collection?: Record<string, any>;
|
|
6
6
|
product?: Record<string, any>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
export * from "./collection";
|
|
2
|
-
export * from "./facets";
|
|
3
|
-
export * from "./product";
|
|
4
|
-
export * from "./proof";
|
|
5
|
-
export * from "./appConfiguration";
|
|
6
|
-
export * from "./error";
|
|
7
|
-
export * from "./asset";
|
|
8
|
-
export * from "./batch";
|
|
9
|
-
export * from "./variant";
|
|
10
|
-
export * from "./claimSet";
|
|
11
|
-
export * from "./auth";
|
|
12
|
-
export * from "./comms";
|
|
13
|
-
export * from "./nfc";
|
|
14
|
-
export * from "./itemContext";
|
|
15
|
-
export * from "./contact";
|
|
16
|
-
export * from "./broadcasts";
|
|
17
|
-
export * from "./segments";
|
|
18
|
-
export * from "./common";
|
|
19
|
-
export * from "./journeys";
|
|
20
|
-
export * from "./journeysAnalytics";
|
|
21
|
-
export * from "./qr";
|
|
22
|
-
export * from "./template";
|
|
23
|
-
export * from "./interaction";
|
|
24
|
-
export * from "./analytics";
|
|
25
|
-
export * from "./location";
|
|
26
|
-
export * from "./jobs";
|
|
27
|
-
export * from "./realtime";
|
|
28
|
-
export * from "./tags";
|
|
29
|
-
export * from "./navigation";
|
|
30
|
-
export * from "./order";
|
|
31
|
-
export * from "./crate";
|
|
32
|
-
export * from "./attestations";
|
|
33
|
-
export * from "./containers";
|
|
34
|
-
export * from "./authKit";
|
|
35
|
-
export * from "./iframeResponder";
|
|
36
|
-
export * from "./ai";
|
|
37
|
-
export * from "./appManifest";
|
|
38
|
-
export * from "./appObjects";
|
|
39
|
-
export * from "./loyalty";
|
|
40
|
-
export * from "./translations";
|
|
41
|
-
export * from "./integrations";
|
|
42
|
-
export * from "./research";
|
|
43
|
-
export * from "./config";
|
|
44
|
-
export * from "./widgets";
|
|
1
|
+
export * from "./collection.js";
|
|
2
|
+
export * from "./facets.js";
|
|
3
|
+
export * from "./product.js";
|
|
4
|
+
export * from "./proof.js";
|
|
5
|
+
export * from "./appConfiguration.js";
|
|
6
|
+
export * from "./error.js";
|
|
7
|
+
export * from "./asset.js";
|
|
8
|
+
export * from "./batch.js";
|
|
9
|
+
export * from "./variant.js";
|
|
10
|
+
export * from "./claimSet.js";
|
|
11
|
+
export * from "./auth.js";
|
|
12
|
+
export * from "./comms.js";
|
|
13
|
+
export * from "./nfc.js";
|
|
14
|
+
export * from "./itemContext.js";
|
|
15
|
+
export * from "./contact.js";
|
|
16
|
+
export * from "./broadcasts.js";
|
|
17
|
+
export * from "./segments.js";
|
|
18
|
+
export * from "./common.js";
|
|
19
|
+
export * from "./journeys.js";
|
|
20
|
+
export * from "./journeysAnalytics.js";
|
|
21
|
+
export * from "./qr.js";
|
|
22
|
+
export * from "./template.js";
|
|
23
|
+
export * from "./interaction.js";
|
|
24
|
+
export * from "./analytics.js";
|
|
25
|
+
export * from "./location.js";
|
|
26
|
+
export * from "./jobs.js";
|
|
27
|
+
export * from "./realtime.js";
|
|
28
|
+
export * from "./tags.js";
|
|
29
|
+
export * from "./navigation.js";
|
|
30
|
+
export * from "./order.js";
|
|
31
|
+
export * from "./crate.js";
|
|
32
|
+
export * from "./attestations.js";
|
|
33
|
+
export * from "./containers.js";
|
|
34
|
+
export * from "./authKit.js";
|
|
35
|
+
export * from "./iframeResponder.js";
|
|
36
|
+
export * from "./ai.js";
|
|
37
|
+
export * from "./appManifest.js";
|
|
38
|
+
export * from "./appObjects.js";
|
|
39
|
+
export * from "./loyalty.js";
|
|
40
|
+
export * from "./translations.js";
|
|
41
|
+
export * from "./integrations.js";
|
|
42
|
+
export * from "./research.js";
|
|
43
|
+
export * from "./config.js";
|
|
44
|
+
export * from "./widgets.js";
|
package/dist/types/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
// src/types/index.ts
|
|
2
2
|
// Re-export all type modules so consumers can import types directly
|
|
3
|
-
export * from "./collection";
|
|
4
|
-
export * from "./facets";
|
|
5
|
-
export * from "./product";
|
|
6
|
-
export * from "./proof";
|
|
7
|
-
export * from "./appConfiguration";
|
|
8
|
-
export * from "./error";
|
|
9
|
-
export * from "./asset";
|
|
10
|
-
export * from "./batch";
|
|
11
|
-
export * from "./variant";
|
|
12
|
-
export * from "./claimSet";
|
|
13
|
-
export * from "./auth";
|
|
14
|
-
export * from "./comms";
|
|
15
|
-
export * from "./nfc";
|
|
16
|
-
export * from "./itemContext";
|
|
17
|
-
export * from "./contact";
|
|
18
|
-
export * from "./broadcasts";
|
|
19
|
-
export * from "./segments";
|
|
20
|
-
export * from "./common";
|
|
21
|
-
export * from "./journeys";
|
|
22
|
-
export * from "./journeysAnalytics";
|
|
23
|
-
export * from "./qr";
|
|
24
|
-
export * from "./template";
|
|
25
|
-
export * from "./interaction";
|
|
26
|
-
export * from "./analytics";
|
|
27
|
-
export * from "./location";
|
|
28
|
-
export * from "./jobs";
|
|
29
|
-
export * from "./realtime";
|
|
30
|
-
export * from "./tags";
|
|
31
|
-
export * from "./navigation";
|
|
32
|
-
export * from "./order";
|
|
33
|
-
export * from "./crate";
|
|
34
|
-
export * from "./attestations";
|
|
35
|
-
export * from "./containers";
|
|
36
|
-
export * from "./authKit";
|
|
37
|
-
export * from "./iframeResponder";
|
|
38
|
-
export * from "./ai";
|
|
39
|
-
export * from "./appManifest";
|
|
40
|
-
export * from "./appObjects";
|
|
41
|
-
export * from "./loyalty";
|
|
42
|
-
export * from "./translations";
|
|
43
|
-
export * from "./integrations";
|
|
44
|
-
export * from "./research";
|
|
45
|
-
export * from "./config";
|
|
46
|
-
export * from "./widgets";
|
|
3
|
+
export * from "./collection.js";
|
|
4
|
+
export * from "./facets.js";
|
|
5
|
+
export * from "./product.js";
|
|
6
|
+
export * from "./proof.js";
|
|
7
|
+
export * from "./appConfiguration.js";
|
|
8
|
+
export * from "./error.js";
|
|
9
|
+
export * from "./asset.js";
|
|
10
|
+
export * from "./batch.js";
|
|
11
|
+
export * from "./variant.js";
|
|
12
|
+
export * from "./claimSet.js";
|
|
13
|
+
export * from "./auth.js";
|
|
14
|
+
export * from "./comms.js";
|
|
15
|
+
export * from "./nfc.js";
|
|
16
|
+
export * from "./itemContext.js";
|
|
17
|
+
export * from "./contact.js";
|
|
18
|
+
export * from "./broadcasts.js";
|
|
19
|
+
export * from "./segments.js";
|
|
20
|
+
export * from "./common.js";
|
|
21
|
+
export * from "./journeys.js";
|
|
22
|
+
export * from "./journeysAnalytics.js";
|
|
23
|
+
export * from "./qr.js";
|
|
24
|
+
export * from "./template.js";
|
|
25
|
+
export * from "./interaction.js";
|
|
26
|
+
export * from "./analytics.js";
|
|
27
|
+
export * from "./location.js";
|
|
28
|
+
export * from "./jobs.js";
|
|
29
|
+
export * from "./realtime.js";
|
|
30
|
+
export * from "./tags.js";
|
|
31
|
+
export * from "./navigation.js";
|
|
32
|
+
export * from "./order.js";
|
|
33
|
+
export * from "./crate.js";
|
|
34
|
+
export * from "./attestations.js";
|
|
35
|
+
export * from "./containers.js";
|
|
36
|
+
export * from "./authKit.js";
|
|
37
|
+
export * from "./iframeResponder.js";
|
|
38
|
+
export * from "./ai.js";
|
|
39
|
+
export * from "./appManifest.js";
|
|
40
|
+
export * from "./appObjects.js";
|
|
41
|
+
export * from "./loyalty.js";
|
|
42
|
+
export * from "./translations.js";
|
|
43
|
+
export * from "./integrations.js";
|
|
44
|
+
export * from "./research.js";
|
|
45
|
+
export * from "./config.js";
|
|
46
|
+
export * from "./widgets.js";
|
package/dist/types/product.d.ts
CHANGED
package/dist/types/proof.d.ts
CHANGED
package/dist/types/segments.d.ts
CHANGED
package/dist/types/widgets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TagContext } from './nfc';
|
|
2
|
-
import type { ItemContext } from './itemContext';
|
|
1
|
+
import type { TagContext } from './nfc.js';
|
|
2
|
+
import type { ItemContext } from './itemContext.js';
|
|
3
3
|
/**
|
|
4
4
|
* Structured navigation request emitted via the `onNavigate` prop when a
|
|
5
5
|
* widget or container needs to navigate the parent platform shell to another
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Utility functions and helpers for working with smartlinks data.
|
|
3
3
|
* @module utils
|
|
4
4
|
*/
|
|
5
|
-
export * from './paths';
|
|
6
|
-
export * from './conditions';
|
|
7
|
-
export * from './anonId';
|
|
5
|
+
export * from './paths.js';
|
|
6
|
+
export * from './conditions.js';
|
|
7
|
+
export * from './anonId.js';
|
package/dist/utils/index.js
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Utility functions and helpers for working with smartlinks data.
|
|
4
4
|
* @module utils
|
|
5
5
|
*/
|
|
6
|
-
export * from './paths';
|
|
7
|
-
export * from './conditions';
|
|
8
|
-
export * from './anonId';
|
|
6
|
+
export * from './paths.js';
|
|
7
|
+
export * from './conditions.js';
|
|
8
|
+
export * from './anonId.js';
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Product } from '../types/product';
|
|
2
|
-
import type { Collection } from '../types/collection';
|
|
3
|
-
import type { BatchResponse } from '../types/batch';
|
|
4
|
-
import type { Proof } from '../types/proof';
|
|
1
|
+
import type { Product } from '../types/product.js';
|
|
2
|
+
import type { Collection } from '../types/collection.js';
|
|
3
|
+
import type { BatchResponse } from '../types/batch.js';
|
|
4
|
+
import type { Proof } from '../types/proof.js';
|
|
5
5
|
/**
|
|
6
6
|
* Parameters for building a portal path.
|
|
7
7
|
* Pass in objects where available - the function will extract the needed properties.
|
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.10 | Generated: 2026-09-21T16:50:28.412Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -17,15 +17,13 @@ For detailed guides on specific features:
|
|
|
17
17
|
- **[Containers](containers.md)** - Building full-app embeddable containers (lazy-loaded)
|
|
18
18
|
- **[Mobile Admin Container](mobile-admin-container.md)** - Building mobile-optimised operator/admin containers as a separate bundle
|
|
19
19
|
- **[Container Tracking](container-tracking.md)** - Hierarchical physical/logical container groupings with item membership
|
|
20
|
-
- **[Scanner Containers](scanner-container.md)** - Building scanner microapps for the SmartLinks Scanner Android host (RFID, NFC, QR, key events)
|
|
21
20
|
- **[Multi-Page App Architecture](mpa.md)** - Vite MPA build pipeline: public/admin entry points, widget/container/executor bundles, content-hashed CDN assets
|
|
22
21
|
- **[App Configuration Files](app-manifest.md)** - `app.manifest.json` and `app.admin.json` reference — bundles, components, setup questions, import schemas, tunable fields, and metrics
|
|
23
22
|
- **[Executor Model](executor.md)** - Programmatic JS bundles for AI-driven setup, server-side SEO metadata generation, and LLM content for AI crawlers
|
|
24
23
|
- **[Server Functions](server-functions.md)** - App-authored server-side "edge functions" (`async (ctx, event) => result`): http/event/cron triggers, the visibility/authority/capabilities security model, and the pre-scoped `ctx` (authority-scoped SDK, capability-gated secrets + fetch)
|
|
25
24
|
- **[Deploying & Registering an App](deploying-apps.md)** - Publish → build → register: the app CDN layout (smartlinks.app), dev/beta/prod channels, channel-scoped deploy keys, the `POST /apps/:appId/releases` registration endpoint + validation, and how to wire it into your build so a bad manifest fails the deploy
|
|
26
25
|
- **[Realtime](realtime.md)** - Real-time data updates and WebSocket connections
|
|
27
|
-
- **[iframe Responder](iframe-responder.md)** - iframe integration and cross-origin communication
|
|
28
|
-
- **[iframe Streaming Parent Changes](iframe-streaming-parent-changes.md)** - Parent-side changes required to support AI streaming in iframe proxy mode
|
|
26
|
+
- **[iframe Responder](iframe-responder.md)** - iframe integration and cross-origin communication (incl. hand-rolled streaming protocol)
|
|
29
27
|
- **[Utilities](utils.md)** - Helper functions for building portal paths, URLs, and common tasks
|
|
30
28
|
- **[UI Utils](ui-utils.md)** - Reusable, themeable admin UI React component library for microapps
|
|
31
29
|
- **[Caching](caching.md)** - Multi-tier caching strategy (in-memory, SessionStorage, IndexedDB) used by the SDK
|
|
@@ -63,7 +61,6 @@ For detailed guides on specific features:
|
|
|
63
61
|
- **[Integrations](integrations.md)** - Inbound/outbound integration flows + the sealed-secret store; triggers (manual/event/schedule), field mappings, and the Syndigo/Event Hub outbound path
|
|
64
62
|
- **[AI Tools & Skills](ai-tools-and-skills.md)** - The AI capability catalog: skills apps invoke by name (e.g. research.brand), the tools the AI reaches for (web fetch/screenshot/brand assets/image gen), the agent loop, and how apps discover them
|
|
65
63
|
- **[Deep Link Discovery](deep-link-discovery.md)** - Registering and discovering navigable app states for portal menus and AI orchestration
|
|
66
|
-
- **[AI-Native App Manifests](manifests.md)** - How AI workflows discover, configure, and import apps via structured manifests and prose guides
|
|
67
64
|
- **[AI Guide Template](ai-guide-template.md)** - A sample for an app on how to build an AI setup guide
|
|
68
65
|
|
|
69
66
|
## Choosing App Storage
|
|
@@ -220,8 +217,8 @@ Returns true if the SDK currently has any auth credential set (bearer token or A
|
|
|
220
217
|
}) → `void`
|
|
221
218
|
Configure the SDK's built-in in-memory GET cache. The cache is transparent — it sits inside the HTTP layer and requires no changes to your existing API calls. All GET requests benefit automatically. Per-resource rules (collections/products → 1 h, proofs → 30 s, etc.) override this value. in-memory only (`'none'`, default). Ignored in Node.js. fallback, from the original fetch time (default: 7 days). `SmartlinksOfflineError` with stale data instead of propagating the network error. caches on page load/refresh. IndexedDB persists for offline. ```ts // Enable IndexedDB persistence for offline support configureSdkCache({ persistence: 'indexeddb' }) // Disable cache entirely in test environments configureSdkCache({ enabled: false }) // Keep caches across page refreshes (not recommended for production) configureSdkCache({ clearOnPageLoad: false }) ```
|
|
222
219
|
|
|
223
|
-
**invalidateCache**(urlPattern?: string) → `void`
|
|
224
|
-
Manually invalidate entries in the SDK's GET cache. *contains* this string is removed.
|
|
220
|
+
**invalidateCache**(urlPattern?: string, options?: InvalidateCacheOptions) → `void`
|
|
221
|
+
Manually invalidate entries in the SDK's GET cache. Note: the GET cache is **in-memory, per page load** (with an optional L2 IndexedDB layer when persistence is enabled) — it does not persist across reloads unless you opt into persistence, so it rarely needs disabling "for correctness". *contains* this string is removed). With `{ exact: true }`, matches the path precisely. Omit to wipe the entire cache. ```ts invalidateCache() // clear everything invalidateCache('/collection/abc123') // that collection AND everything under it invalidateCache('/collection/abc123', { exact: true }) // ONLY that collection entry invalidateCache('/products/') // all canonical plural product responses ```
|
|
225
222
|
|
|
226
223
|
**proxyUploadFormData**(path: string,
|
|
227
224
|
formData: FormData,
|
|
@@ -1841,6 +1838,9 @@ interface AppManifest {
|
|
|
1841
1838
|
version: string;
|
|
1842
1839
|
platformRevision?: string;
|
|
1843
1840
|
appId: string;
|
|
1841
|
+
moduleFormat?: 'umd' | 'esm' | 'dual';
|
|
1842
|
+
sharedDependencies?: string;
|
|
1843
|
+
globals?: Record<string, string>;
|
|
1844
1844
|
seo?: {
|
|
1845
1845
|
strategy?: 'executor' | string;
|
|
1846
1846
|
priority?: number;
|
package/docs/agent-tools.md
CHANGED
|
@@ -81,12 +81,21 @@ Identical to server functions — nothing new to reason about:
|
|
|
81
81
|
Untrusted third-party tools run in the platform's isolated runner — the same boundary as untrusted
|
|
82
82
|
server functions.
|
|
83
83
|
|
|
84
|
-
##
|
|
84
|
+
## Working with `app.admin.json` (complement, not replacement)
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
`app.admin.json` stays the **canonical declarative config contract** — setup questions, config schema,
|
|
87
|
+
import fields, tunable settings, content hints. It's inspectable, validatable, deterministic, and
|
|
88
|
+
reused by many consumers at once (the admin form renderer, AI setup, a signup journey asking the same
|
|
89
|
+
questions, bulk import). Agent tools **do not replace it — they serve and adapt it**:
|
|
90
|
+
|
|
91
|
+
- Keep the declarative schema as the default and source of truth.
|
|
92
|
+
- When you want *dynamic, contextual* behaviour — "which questions for **this** collection?", "the
|
|
93
|
+
config schema as it stands right now", "apply these answers" — expose a small function/tool that
|
|
94
|
+
reads the declaration and returns a tailored result. **Static-first; dynamic only where it earns its
|
|
95
|
+
keep.**
|
|
96
|
+
|
|
97
|
+
There's no rip-and-replace and nothing to migrate off: an app happy with its `app.admin.json` keeps
|
|
98
|
+
it untouched.
|
|
90
99
|
|
|
91
100
|
## What ships now vs staged
|
|
92
101
|
|
|
@@ -96,16 +105,19 @@ capability-scoped actions** the agent invokes — with multi-turn and streaming.
|
|
|
96
105
|
| SDK types for it; tool descriptors surfaced for discovery | `tools/call` streaming, cancellation, cross-app toolbelt arbitration |
|
|
97
106
|
| Your handlers run today via http/event | Human-approval UX for `approval: "require"` |
|
|
98
107
|
|
|
99
|
-
## Adopting this in
|
|
108
|
+
## Adopting this — opt-in, per app, no fleet migration
|
|
109
|
+
|
|
110
|
+
Agent tools are **purely additive**. There is **no migration pass**, and nothing breaks if you never
|
|
111
|
+
adopt them — an existing app on the V2 SDK simply *gains the ability* to add them whenever you want.
|
|
112
|
+
You do **not** touch every app; you turn it on for one app at a time.
|
|
100
113
|
|
|
101
|
-
|
|
102
|
-
SDK). Roughly:
|
|
114
|
+
To turn them on for a single app (say, an FAQ app), once it's on the V2 SDK:
|
|
103
115
|
|
|
104
|
-
1. **Server functions** — add the `functions` block + build target + test harness
|
|
105
|
-
|
|
116
|
+
1. **Server functions** — add the `functions` block + build target + test harness if the app doesn't
|
|
117
|
+
already have them. See [server-functions.md](server-functions.md).
|
|
106
118
|
2. **Expose tools** — add the `agent` block to the functions you want the agent to call; give each a
|
|
107
|
-
title/description/input schema and an approval mode.
|
|
108
|
-
3. **Retire `app.admin.json` AI setup** — move any AI-authoring behaviour to tools; drop the
|
|
109
|
-
AI-schema block.
|
|
119
|
+
title / description / input schema and an approval mode.
|
|
110
120
|
|
|
111
|
-
|
|
121
|
+
That's it — declare and build. The live agent loop is staged (see the table above); until it ships,
|
|
122
|
+
your handlers still run via http/event, so declaring tools now is **forward-compatible, not
|
|
123
|
+
speculative breakage**. `app.admin.json` stays as-is throughout — nothing to retire.
|