IAM (Longplay App Manifest) generates an App page map from application source during builds, for Console previews and visual experiment authoring. The independent build package is 0.7.10 and requires Node.js 22+. Its version is separate from the business SDK and CLI. Generating an IAM does not start experiments or publish visual changes.
For Next.js 15.4.1+, wrap the existing config to generate an IAM during normal production builds. This example disables uploads; strict mode fails the build if generation fails.
Run the project's existing next build. The plugin injects process.env.INDIANA_IAM_RELEASE_URL into browser code and writes this build's descriptor to public/.well-known/indiana/releases/<id>.json after compilation; with basePath, the URL includes that prefix. Add public/.well-known/indiana/ to .gitignore. next dev does not generate an IAM. The .well-known/indiana/ path and the indiana-app-manifest.json file name written by standalone generation are fixed protocol names in the IAM build package, not renamed with the Longplay brand, so use them exactly as shown.
Run the normal vite build. Client code reads import.meta.env.INDIANA_IAM_RELEASE_URL; descriptors are written under .well-known/indiana/releases/ in the build output, and an absolute base such as /shop/ prefixes the URL. SSR builds skip IAM. For multiple entries, set entry: "src/main.tsx" to the browser entry inside the project root.
The build plugin only generates the map; the application explicitly starts visual experiments. Choose npm or script loading and use the descriptor from that same build. These examples use the production API's Sandbox. environmentId is the App environment UUID, not the App UUID or the sandbox string.
1import {2 createVisualExperiments,3 loadAppManifestRelease,4} from"@tinkerlandai/longplay-sdk/visual";56// Call from the browser after the page has mounted.7exportasyncfunctionstartVisualChanges(releaseUrl: string, environmentId: string) {8const appManifestRelease = awaitloadAppManifestRelease(9 releaseUrl, document, newAbortController().signal,10 );11const visual = createVisualExperiments({12 baseUrl: "https://api.longplayai.com",13 environmentId,14 appManifestRelease,15 });16try {17await visual.start();18return () => visual.destroy();19 } catch (error) {20 visual.destroy();21throw error;22 }23}
Call startVisualChanges after mounting: pass the injected process.env.INDIANA_IAM_RELEASE_URL in Next.js, or import.meta.env.INDIANA_IAM_RELEASE_URL in Vite. Call the returned cleanup function on unmount, logout or identity change.
index.htmlHTML
1<scriptsrc="https://cdn.longplayai.com/sdk.js"></script>2<scripttype="module">3 const { createVisualExperiments, loadAppManifestRelease } = await Longplay.ready;4 // Use the descriptor written by this exact deployed build, after any base path such as /shop.5 const releaseUrl = "/.well-known/indiana/releases/<BUILD_RELEASE_ID>.json";6 const appManifestRelease = await loadAppManifestRelease(7 releaseUrl, document, new AbortController().signal,8 );9 const visual = createVisualExperiments({10 baseUrl: "https://api.longplayai.com",11 environmentId: "<ENVIRONMENT_UUID>",12 appManifestRelease,13 });14 addEventListener("pagehide", () => visual.destroy(), { once: true });15 try {16 await visual.start();17 } catch (error) {18 visual.destroy();19 throw error;20 }21</script>
The script example needs no business SDK npm dependency. Replace BUILD_RELEASE_ID with this build's actual ID and preserve that binding in the application's template or build step; do not use a mutable latest descriptor. Load the loader as a classic script; with async/defer, wait for its load event before accessing Longplay.
For the first layer, choose a uniquely identifiable Web page or button in the App page map, open Funnel entries, save to the existing Funnel draft and publish it. Install the latest stable business SDK (0.10.20 or later) and start the entry host below. The independent createVisualExperiments consumer does not start Funnels.
After mounting, pass this build's releaseUrl and options containing the App scope, environmentId, API baseUrl, shared Customer session and presentation container. The existing identity flow supplies the Customer session; IAM does not create an identity.
Use onStatus for identity_required, configuration_unavailable, incompatible and start_failed. A paused Funnel or a Run waiting on a timer/event step reports run_background and hides its UI. Configuration reads default to a five-second deadline and recover on later polls. Call the returned handle's retry() after an uncertain start, and destroy() on unmount.
From SDK 0.10.8, a full Customer Session retains the original entry request and target in this tab's sessionStorage, without Customer or Run credentials. The merchant must first restore the same logical Customer Session and renew it with its Refresh Token. SDK credentials are memory-only by default; the merchant isolates storage of the latest pair by native account and App/environment and clears it on sign-out or account changes. Reloading during a background Wait or after a lost start response then recovers the same Run in the original build and scene, without another allocation. Records are isolated by API, App, environment, Customer and IAM release; bare-token sessions remain memory-only. Set recoveryStorage: false to disable persistence; unavailable storage reports recovery_unavailable.
Screen entry matches the route template and render: dynamic routes cover all matching instances, and query/hash changes are not new visits. Entries are tried in stable order; a cooldown or existing-Run refusal allows the next entry. Each visit presents at most one automatic entry: others matched during or after that presentation wait for the next visit, while button clicks still start.
Button clicks preserve merchant handlers and navigation; a full-page departure may happen before the Funnel appears. Hidden retained pages do not count as active targets; multiple active targets still refuse entry.
For the second layer, select an experiment with IAM changes on a Funnel Split and enable its page experiment. A Local Funnel requires Local experiment rules. The entry host already passes the build binding; manual Run hosts use the binding below. Custom headless hosts can use createFunnelPageExperiments and own its start()/destroy() lifecycle.
The page uses the Run's accepted variation without rebucketing. Split-owned experiments leave standalone visitor delivery. Stop, completion or host destruction restores the page. Every eligible page changeset is returned with one assignment per accepted Split, within the visual payload's existing 100-item and 2 MiB budgets.
After a build upgrade, open Version applicability to check experiments and published Funnel entries. Invalid entries list the Funnel, entry and route with a link to the Funnel editor; reselect the page or button and publish. Missing current versions, failed reads and incomplete scans remain explicit. Applicability describes the current IAM, not proof that the merchant deployed that build.
Create a separate Key with only app-manifests:write in the selected App environment and store it as the build secret INDIANA_IAM_KEY. The IAM build package reads only INDIANA_IAM_-prefixed variables, unlike the LONGPLAY_ names in other guides, so set them exactly as shown. Do not combine it with other permissions or expose it in browsers, descriptors, source or logs. Review generated content before making it available to the App's members.
Change upload: false in the Next.js/Vite example to upload: "production". This skips Vercel Preview by default; other build environments upload when a Key is present. Use upload: "always" only for builds explicitly intended to upload.
Uploads go to Longplay Console (console.longplayai.com), not the api subdomain. BASE_URL, Key and App environment must belong to the same deployment.
client defaults to web; other builds can use names such as web-dashboard. Each client has its own current version and its first upload fixes its platform. Successful validation makes the version current but does not publish an experiment.
Keep strict: true so an upload failure fails the build. Rerun the same build or command after interruption to resume. CI can retain recovery state in a private INDIANA_IAM_CACHE_DIR; never include this cache in public artifacts.
The IAM /react-native entry is build tooling that generates separate iOS and Android source previews. It installs no native runtime, scans no Swift/Kotlin source, and does not let the Web visual script control native views.
build-iam.mjsJavaScript
1import {2 prepareReactNativeIam,3 finishReactNativeIam,4} from"@tinkerlandai/longplay-iam/react-native";56const options = {7 root: process.cwd(), platform: "ios", routerRoot: "app", strict: true,8 bundleDirectory: "dist/ios", // asset staging inside root, never scanned as source9};10const prepared = awaitprepareReactNativeIam(options);11if (!prepared) thrownewError("IAM preparation failed");12// Run your existing Expo / Metro bundle step using the same unchanged source.13const result = awaitfinishReactNativeIam({14 ...options, releaseId: prepared.releaseId,15 upload: { upload: false },16});17// Package dist/ios and result.descriptorPath with this native release.
Prepare first, run the application's existing Metro/Expo bundle step, then finish against the unchanged source. For Android, use platform: "android" and its bundleDirectory. Without Expo Router, use entry: "App.tsx". Uploads default to disabled; explicitly enable them in finish's upload options with the matching client.
Standalone generation uses a new output directory outside the project and executes no application code or server. Inspect coverage.gaps; missing runtime data is not fabricated.
Generation and completed upload are separate results. Confirm uploaded/already uploaded in the build log and inspect the client's current version in Console. Console has no manual upload button.
Serve the descriptor as public same-origin JSON without authentication or redirects for GET/HEAD. Only the release ID and digest are public; never place the complete IAM or upload credentials in public.
Allow the SDK script origin and API connections in CSP. The page and IAM must come from the same build. If changes do not apply, check the descriptor, environment UUID, website Origin, published experiment and coverage.gaps.