@tinkerlandai/indiana-sdk 0.6.2 → 0.6.4
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/CHANGELOG.md +17 -1
- package/README.md +10 -6
- package/README.zh-CN.md +9 -5
- package/THIRD_PARTY_NOTICES.md +28 -0
- package/dist/{chunk-M3DG6ZCT.js → chunk-2EJSV6BA.js} +1 -1
- package/dist/chunk-4K25DELJ.js +1 -0
- package/dist/chunk-63BWE27V.js +1 -0
- package/dist/chunk-CB63JLGT.js +1 -0
- package/dist/{chunk-N6UIDDAX.js → chunk-D7YHFS6B.js} +2 -2
- package/dist/chunk-HTRQPMJO.js +11 -0
- package/dist/chunk-ISUXYPYL.js +1 -0
- package/dist/chunk-QG3WUJG5.js +1 -0
- package/dist/chunk-U6S6AZM6.js +1 -0
- package/dist/chunk-VVSQKVE7.js +1 -0
- package/dist/client-OYRHOMUQ.js +1 -0
- package/dist/{configuration-sync-Bnu8s4pc.d.ts → configuration-sync-C2mytNwU.d.ts} +18 -0
- package/dist/errors-DrdTlPwf.d.ts +57 -0
- package/dist/funnel-runtime-host-NWS3URFA.js +1 -0
- package/dist/{funnel-runtime-start-Zbd5ro5r.d.ts → funnel-runtime-start-sZ8ZCNlq.d.ts} +42 -58
- package/dist/iam.d.ts +131 -0
- package/dist/iam.js +1 -0
- package/dist/index.d.ts +41 -4
- package/dist/index.js +1 -1
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +1 -1
- package/dist/page.js +1 -1
- package/dist/paywall-4XZ6NDMY.js +1 -0
- package/dist/popup.d.ts +2 -5
- package/dist/popup.js +3 -14
- package/dist/react-native.d.ts +327 -0
- package/dist/react-native.js +1 -0
- package/dist/server.d.ts +4 -3
- package/dist/server.js +1 -1
- package/dist/src-WV6GZYWA.js +1 -0
- package/dist/visual.d.ts +10 -1
- package/dist/visual.js +2 -1
- package/package.json +15 -2
- package/dist/chunk-BIFEEVQO.js +0 -1
- package/dist/chunk-ET4NANGB.js +0 -1
- package/dist/chunk-J7M7UH74.js +0 -1
- package/dist/chunk-OHDY27EI.js +0 -1
- package/dist/chunk-VMLGV5OS.js +0 -11
- package/dist/funnel-runtime-host-3STQUS6F.js +0 -1
- package/dist/paywall-LBDMGVWZ.js +0 -1
- package/dist/src-X6KT6WIH.js +0 -1
- package/dist/visual-editor-agent-WW65CMKW.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as g}from"./chunk-U6S6AZM6.js";import{l as u,n as y}from"./chunk-S2MSIA57.js";import{z as x}from"zod";var E=x.enum(["sandbox","live"]),O=x.object({projectId:x.string().min(1),environment:E}).strict();import{z as t}from"zod";var f=t.tuple([t.number().min(0).max(1),t.number().min(0).max(1)]).refine(([r,p])=>r<=p),$=t.strictObject({attribute:t.string().optional(),seed:t.string(),hashVersion:t.literal(2),ranges:t.array(f).max(100)}),H=t.strictObject({id:t.string().min(1).max(255),condition:y,gate:t.boolean().optional()}),C=t.strictObject({key:t.string().optional(),name:t.string().optional(),passthrough:t.boolean().optional()}),k={condition:y.optional(),parentConditions:t.array(H).max(100).optional(),weights:t.array(t.number().min(0).max(1)).max(20).optional(),coverage:t.number().min(0).max(1).optional(),hashAttribute:t.string().optional(),fallbackAttribute:t.string().optional(),hashVersion:t.literal(2).optional(),disableStickyBucketing:t.boolean().optional(),bucketVersion:t.number().int().nonnegative().optional(),minBucketVersion:t.number().int().nonnegative().optional(),filters:t.array($).max(100).optional(),ranges:t.array(f).max(20).optional(),meta:t.array(C).max(20).optional(),seed:t.string().optional(),name:t.string().optional(),phase:t.string().optional()},b=t.strictObject({...k,key:t.string().min(1).max(255),variations:t.tuple([u,u]).rest(u).refine(r=>r.length<=20),urlPatterns:t.array(t.strictObject({include:t.boolean(),type:t.enum(["regex","simple"]),pattern:t.string()})).max(100).optional(),force:t.number().int().nonnegative().optional(),active:t.boolean().optional(),persistQueryString:t.boolean().optional()}),U=t.strictObject({value:u,variationId:t.number().int(),key:t.string(),name:t.string().optional(),bucket:t.number().optional(),passthrough:t.boolean().optional(),inExperiment:t.boolean(),hashUsed:t.boolean().optional(),hashAttribute:t.string(),hashValue:t.string(),featureId:t.string().nullable(),stickyBucketUsed:t.boolean().optional()}),_=t.strictObject({...k,id:t.string().max(255).optional(),force:u.optional(),variations:t.array(u).min(2).max(20).optional(),key:t.string().optional(),range:f.optional(),tracks:t.array(t.strictObject({experiment:b,result:U})).max(100).optional()}),D=t.strictObject({defaultValue:u.optional(),rules:t.array(_).max(500).optional()}),v=t.record(t.string(),t.union([t.strictObject({type:t.literal("hashed"),attributeKey:t.string(),values:t.array(t.string().regex(/^[a-f0-9]{64}$/))}),t.strictObject({type:t.literal("list"),attributeKey:t.string(),values:t.array(t.union([t.string(),t.number()]))}),t.strictObject({type:t.literal("condition"),condition:y})])),J=t.strictObject({scope:O,generation:t.string().regex(/^[a-f0-9]{64}$/),evaluatedAt:t.iso.datetime({offset:!0}),expiresAt:t.iso.datetime({offset:!0}).nullable(),features:t.record(t.string(),D),savedGroups:v,experiments:t.record(t.uuid(),b)});import{z as n}from"zod";import{z as e}from"zod";import{z as i}from"zod";var M=i.strictObject({schemaVersion:i.literal(1),renderKey:i.string().min(1).max(256),routeTemplate:i.string().startsWith("/").max(2048),selectors:i.array(i.string().regex(/^[a-z][a-z0-9-]*\[data-indiana-id="(?:[^"\\\x00-\x1f]|\\["\\])*"\]$/).max(512)).max(512),present:i.array(i.number().int().min(0).max(511)).min(1).max(512),absent:i.array(i.number().int().min(0).max(511)).max(512)}).superRefine((r,p)=>{let o=[...r.present,...r.absent];(new Set(r.selectors).size!==r.selectors.length||new Set(o).size!==o.length||o.length!==r.selectors.length||o.some(s=>s>=r.selectors.length))&&p.addIssue({code:"custom",message:"Incomplete or ambiguous render signature"})}),w=i.strictObject({renderKey:i.string().min(1).max(256),routeKey:i.string().min(1).max(256),stateKey:i.string().min(1).max(256),documentKey:i.string().min(1).max(256),documentHash:i.string().regex(/^[a-f0-9]{64}$/),compositionKey:i.string().min(1).max(256),entryMode:i.enum(["hard","soft"]),match:i.strictObject({present:i.array(i.number().int().min(0).max(511)).max(512),absent:i.array(i.number().int().min(0).max(511)).max(512)})});import{z as m}from"zod";var N={"enterprise-internal-indiana-test":"indiana-admin-vercel@enterprise-internal-490516.iam.gserviceaccount.com","tinkerland-indiana-prod":"indiana-admin-vercel@tinkerland-indiana.iam.gserviceaccount.com"},S="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",B=m.string().regex(new RegExp(`^${S}/${S}/${S}/manifest\\.json$`)),X="content-length;content-type;host;x-goog-if-generation-match",A=m.strictObject({kind:m.literal("gcs-v4-put"),url:m.url(),bucket:m.enum(["enterprise-internal-indiana-test","tinkerland-indiana-prod"]),objectKey:B,byteLength:m.number().int().min(1).max(8388608),expiresAt:m.iso.datetime(),headers:m.strictObject({"Content-Type":m.literal("application/json"),"x-goog-if-generation-match":m.literal("0")})}).superRefine((r,p)=>{let o=new URL(r.url),s=o.searchParams,j=["X-Goog-Algorithm","X-Goog-Credential","X-Goog-Date","X-Goog-Expires","X-Goog-Signature","X-Goog-SignedHeaders"],l=s.get("X-Goog-Date")??"",R=/^\d{8}T\d{6}Z$/.test(l)?Date.parse(`${l.slice(0,4)}-${l.slice(4,6)}-${l.slice(6,8)}T${l.slice(9,11)}:${l.slice(11,13)}:${l.slice(13,15)}Z`):NaN,d=Number(s.get("X-Goog-Expires"));(o.origin!=="https://storage.googleapis.com"||o.username||o.password||o.hash||o.pathname!==`/${r.bucket}/app-manifests/${r.objectKey}`||[...s.keys()].length!==j.length||j.some(z=>s.getAll(z).length!==1)||s.get("X-Goog-Algorithm")!=="GOOG4-RSA-SHA256"||s.get("X-Goog-Credential")!==`${N[r.bucket]}/${l.slice(0,8)}/auto/storage/goog4_request`||s.get("X-Goog-SignedHeaders")!==X||!/^[a-f0-9]{512,1024}$/.test(s.get("X-Goog-Signature")??"")||!Number.isFinite(R)||!Number.isInteger(d)||d<1||d>900||R+d*1e3!==Date.parse(r.expiresAt))&&p.addIssue({code:"custom",message:"Invalid IAM upload capability"})});var G=8388608;var a=e.string().min(1).max(256),c=e.string().regex(/^[a-f0-9]{64}$/),me=e.strictObject({versionId:e.uuid(),manifestDigest:c,sourceGraphDigest:c,pageKey:a,stateKey:a,documentKey:a,documentHash:c,elementKey:a.optional(),nodeId:a.optional(),contentHash:c.optional(),renderKey:a.optional(),observed:e.optional(g)}),P=e.strictObject({observed:e.optional(g),pageKey:a,documentKey:a,expectedDocumentHash:c,renderKey:a.optional(),nodeId:a,elementKey:a,expectedContentHash:c,property:e.enum(["text","fontSize","color"]),value:e.union([e.string().max(4e3),e.number().finite()])}),V=e.strictObject({versionId:e.uuid(),manifestDigest:c,sourceGraphDigest:c,pageKey:a,stateKey:a,documentKey:a,documentHash:c,renderKey:a.optional(),observed:e.optional(g),patches:e.array(P.omit({pageKey:!0,documentKey:!0,expectedDocumentHash:!0,renderKey:!0})).min(1).max(200)}),le=e.discriminatedUnion("action",[e.strictObject({action:e.literal("register"),requestId:e.uuid(),label:e.string().trim().min(1).max(100),sha256:c,bytes:e.number().int().min(1).max(G),transferBytes:e.number().int().min(1).max(G)}),e.strictObject({action:e.literal("complete"),versionId:e.uuid()}),e.strictObject({action:e.literal("materialize"),versionId:e.uuid()}),e.strictObject({action:e.literal("current"),versionId:e.uuid(),expectedCurrent:e.uuid().nullable()}),e.strictObject({action:e.literal("delivery"),enabled:e.boolean()}),e.strictObject({action:e.literal("changes"),versionId:e.uuid(),experimentId:e.uuid(),observed:e.optional(g),variationId:a,changesetId:e.uuid().nullable(),expectedRevision:c.nullable(),editorUrl:e.string().url().max(2048),patches:e.array(P).min(1).max(200)})]),h=e.strictObject({id:e.uuid(),projectId:e.uuid(),environmentId:e.uuid(),label:e.string(),sha256:c,bytes:e.number().int().positive(),objectKey:e.string(),state:e.enum(["uploading","ready","rejected"]),isCurrent:e.boolean(),revision:e.number().int().nonnegative(),createdAt:e.string(),expiresAt:e.string(),readyAt:e.string().nullable(),summary:e.record(e.string(),e.json()),routeTree:e.json().nullable(),validation:e.record(e.string(),e.json())}),ue=e.strictObject({rows:e.array(h).max(100),nextCursor:e.uuid().nullable(),currentId:e.uuid().nullable()}),I=e.strictObject({storedBytes:e.number().int().nonnegative(),reservedBytes:e.number().int().nonnegative(),chargedBytes:e.number().int().nonnegative(),versions:e.number().int().nonnegative(),objects:e.number().int().nonnegative(),orphanObjects:e.number().int().nonnegative(),missingReadyObjects:e.number().int().nonnegative(),unknownObjectSizes:e.number().int().nonnegative(),byteLimit:e.number().int().positive(),versionLimit:e.number().int().positive(),remainingBytes:e.number().int().nonnegative()}),pe=e.strictObject({asOf:e.iso.datetime({offset:!0}),reclamation:e.literal("manual-review-required"),buckets:e.strictObject({source:I,runtime:I,previews:I})}),ge=e.strictObject({asOf:e.iso.datetime({offset:!0}),reviewOnly:e.literal(!0),complete:e.boolean(),issues:e.strictObject({scanLimit:e.boolean(),invalidReferences:e.number().int().nonnegative(),missingVersions:e.number().int().nonnegative()}),totals:e.strictObject({versions:e.number().int().nonnegative(),protected:e.number().int().nonnegative(),reviewCandidates:e.number().int().nonnegative()}),rows:e.array(e.strictObject({versionId:e.uuid(),kind:e.enum(["source","runtime"]),state:e.enum(["uploading","ready","rejected"]),createdAt:e.iso.datetime({offset:!0}),reviewAfter:e.iso.datetime({offset:!0}),reasons:e.array(e.enum(["current","upload-capability","retention-grace","incomplete-inventory","retained-observation","gb","gb-observation","funnel-draft","funnel-draft-observation","funnel-version","funnel-version-observation"])).max(11)})).max(50),nextCursor:e.uuid().nullable()}),de=e.strictObject({version:h,actorId:e.uuid(),claims:e.record(e.string(),e.json())}),ye=e.strictObject({version:h,upload:A.nullable()}),be=e.strictObject({version:h,readOnly:e.boolean(),download:e.strictObject({url:e.url(),origin:e.url(),expiresIn:e.number().int().positive()})}),he=e.object({format:e.literal("indiana-route-state-index"),schemaVersion:e.literal(3),routes:e.array(e.object({routeKey:a,path:e.string(),documentKey:a,documentHash:c,initialStateKey:a,initialRenderKey:a})),renders:e.array(w).max(1e3)}).loose().superRefine((r,p)=>{(!r.renders||r.routes.some(o=>!r.renders?.some(s=>s.renderKey===o.initialRenderKey&&s.routeKey===o.routeKey&&s.documentKey===o.documentKey&&s.stateKey===o.initialStateKey&&s.documentHash===o.documentHash&&s.entryMode==="hard")))&&p.addIssue({code:"custom",message:"Incomplete render catalog"})}),xe=e.strictObject({rows:e.array(e.object({id:e.uuid(),name:e.string(),status:e.string(),variations:e.array(e.object({id:a,key:a,name:e.string().optional()}).loose())}).loose()),limited:e.boolean()}),fe=e.strictObject({enabled:e.boolean(),allowedOrigins:e.array(e.string())});var T=n.strictObject({selector:n.string().min(1).max(2048),action:n.enum(["set","append","remove"]),attribute:n.string().min(1).max(128).refine(r=>["html","class","style","position","href","src","alt","title","id","role","hidden"].includes(r)||/^(aria|data)-[a-z0-9_-]+$/.test(r)),value:n.string().max(5e4).optional(),parentSelector:n.string().max(2048).optional(),insertBeforeSelector:n.string().max(2048).optional()}),F=n.strictObject({variation:n.string().min(1).max(128),description:n.string().max(2e3).default(""),css:n.string().max(1e5).default(""),js:n.string().max(1e5).default(""),domMutations:n.array(T).max(200).default([]),iam:V.optional(),renderGuard:M.optional()}),K=F.omit({variation:!0,description:!0,iam:!0}),L=b.omit({variations:!0,active:!0}).extend({changeId:n.string().regex(/^[a-f0-9]{64}$/),variations:n.tuple([K,K]).rest(K).refine(r=>r.length<=20)}),Re=n.strictObject({trackExposures:n.boolean(),environmentId:n.uuid(),generation:n.string().regex(/^[a-f0-9]{64}$/),experiments:n.array(L).max(100),savedGroups:v}),Oe="__indiana_visual_editor",ke=n.object({selector:n.string().max(2048),tag:n.string().max(64),text:n.string().max(1e3),href:n.string().max(2048),src:n.string().max(2048),alt:n.string().max(2048).optional(),matches:n.number().int().nonnegative(),html:n.string().max(5e4).optional(),inlineStyle:n.string().max(5e4).optional(),styles:n.record(n.string(),n.string().max(1e3)).optional()});export{E as a,O as b,b as c,U as d,_ as e,D as f,v as g,J as h,me as i,T as j,F as k,K as l,L as m,Re as n,Oe as o,ke as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{kb as T,lb as P,ob as v}from"./chunk-HTRQPMJO.js";import{a as j}from"./chunk-S5TVMQRC.js";import{b as E}from"./chunk-ISUXYPYL.js";import{a as e}from"./chunk-5TEZEOHX.js";import{D as _,G as C,J as k,v as O}from"./chunk-RMJJOSVZ.js";var L={name:"@tinkerlandai/indiana-sdk",version:"0.6.4",description:"Framework-independent Indiana SDK for customer identity, entitlements, credits, offers and growth surfaces.",license:"UNLICENSED",repository:{type:"git",url:"git+https://github.com/tinkerlandai/Indiana.git",directory:"packages/sdk"},engines:{node:">=22"},publishConfig:{access:"public",tag:"beta"},type:"module",sideEffects:!1,files:["dist","README.md","README.zh-CN.md","CHANGELOG.md","THIRD_PARTY_NOTICES.md"],exports:{"./react-native":{types:"./dist/react-native.d.ts","react-native":"./dist/react-native.js",import:"./dist/react-native.js",default:"./dist/react-native.js"},".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./popup":{types:"./dist/popup.d.ts",import:"./dist/popup.js"},"./server":{types:"./dist/server.d.ts",import:"./dist/server.js"},"./openrouter":{types:"./dist/openrouter.d.ts",import:"./dist/openrouter.js"},"./native-shell":{types:"./dist/native-shell.d.ts",import:"./dist/native-shell.js"},"./page":{types:"./dist/page.d.ts",import:"./dist/page.js"},"./visual":{types:"./dist/visual.d.ts",import:"./dist/visual.js"},"./iam":{types:"./dist/iam.d.ts",import:"./dist/iam.js"}},scripts:{build:"tsup",prepack:"pnpm run build",typecheck:"tsc --noEmit",lint:"node ../../scripts/lint.mjs --workspace packages/sdk"},dependencies:{"@ai-sdk/provider":"4.0.26","@types/json-schema":"7.0.15","css-tree":"^3.2.1","dom-mutator":"0.7.0",dompurify:"^3.4.15",zod:"4.6.5"},devDependencies:{"@indiana/contracts":"workspace:*","@openrouter/sdk":"^1.4.25","@rrweb/types":"2.1.7","@types/css-tree":"^3.2.0",ai:"7.0.136","rrweb-snapshot":"2.1.7",tsup:"^8.5.1",typescript:"^5.9.3","whatwg-url-minimum":"0.2.0"},peerDependencies:{"@openrouter/sdk":"^1.4.25"},peerDependenciesMeta:{"@openrouter/sdk":{optional:!0}}};var $=Symbol("IndianaNoContent");function Z(a,U,V=URL){let S=a.webView??"hosted";if(!["hosted","embedded"].includes(S))throw new e("INVALID_REQUEST","Invalid Web View mode");let d=a.scope?E.parse(a.scope):void 0,s=new V(a.baseUrl??j);if(s.username||s.password||s.search||s.hash)throw new e("INVALID_URL","baseUrl must not contain credentials, query, or fragment");if(s.protocol!=="https:"&&!(s.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(s.hostname)))throw new e("INVALID_URL","Use HTTPS, or HTTP on localhost during development");let M=a.fetch??globalThis.fetch.bind(globalThis),u=a.timeoutMs??1e4;if(!Number.isFinite(u)||u<=0||u>12e4)throw new e("INVALID_TIMEOUT","timeoutMs must be between 1 and 120000");let p=null,g,c=0,l=null,m=new Set;function R(){c+=1,p=null,l=null;for(let i of m)i.abort();m.clear()}async function H(i,q={},N="POST",K={}){if(!p)throw new e("NOT_IDENTIFIED","Call identify with a server-issued customer token first");let y=c,n=new AbortController;m.add(n);let h=()=>y!==c?new e("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):new e("TIMEOUT","Indiana request timed out"),I,x=new Promise((t,o)=>{I=()=>o(h()),n.signal.addEventListener("abort",I,{once:!0})}),F=setTimeout(()=>n.abort(),u),G=async()=>{let t=await M(`${s.href.replace(/\/$/,"")}/api/v1/${i}`,{method:N,headers:{"Content-Type":"application/json",Authorization:`Bearer ${p}`,[T]:v.current,[P]:L.version,...d?{"X-Indiana-Project":d.projectId,"X-Indiana-Environment":d.environment}:{}},body:N==="POST"?JSON.stringify(q):void 0,signal:n.signal,credentials:"omit",cache:"no-store",redirect:"error",...K.keepalive?{keepalive:!0}:{}});if(n.signal.aborted)throw h();let o;try{o=t.status===204?$:await t.json()}catch{throw n.signal.aborted?h():new e(t.ok?"INVALID_RESPONSE":"HTTP_ERROR","The gateway returned an unreadable response",t.status,t.headers.get("X-Request-Id")??void 0)}if(n.signal.aborted)throw h();if(y!==c)throw new e("IDENTITY_CHANGED","Customer identity changed while the request was in flight");if(!t.ok){let r=C.safeParse(o),w=r.success&&(!O.safeParse(r.data.error.code).success||_(r.data.error.code,t.status)),A=w?r.data.error.code:"HTTP_ERROR",D=k(A,t.status,{retryAfter:t.headers.get("Retry-After"),recovery:w?r.data.error.recovery:void 0,reason:w?r.data.error.reason:void 0});throw new e(A,w?r.data.error.message:"Indiana request failed",t.status,t.headers.get("X-Request-Id")??(r.success?r.data.requestId:void 0),{...D,...r.success&&r.data.error.retryable===!1?{retryable:!1}:{},...D.retryAfterSeconds===void 0&&r.success&&r.data.error.retryAfterSeconds!==void 0?{retryAfterSeconds:r.data.error.retryAfterSeconds}:{}})}if(t.headers.get(T)!==v.current)throw new e("PROTOCOL_MISMATCH","Response protocol does not match this SDK");if(d&&o&&typeof o=="object"&&"scope"in o){let r=E.safeParse(o.scope);if(!r.success||r.data.projectId!==d.projectId||r.data.environment!==d.environment)throw new e("SCOPE_MISMATCH","Response scope does not match this SDK instance")}let b=t.headers.get("X-Indiana-Web-View");if(b){if(!/^\/web-view\/renderer\/[a-f0-9]{64}$/.test(b))throw new e("INVALID_RESPONSE","Invalid Web View renderer metadata");g=b}let f=t.headers.get("X-Indiana-Telemetry-Subject");if(f){if(!/^[a-f0-9]{64}$/.test(f))throw new e("INVALID_RESPONSE","Invalid telemetry identity");l!==f&&(l=f,U?.(l))}return o};try{return await Promise.race([G(),x])}catch(t){throw y!==c?new e("IDENTITY_CHANGED","Customer identity changed while the request was in flight"):t instanceof e?t:new e(n.signal.aborted?"TIMEOUT":"NETWORK_ERROR",n.signal.aborted?"Indiana request timed out":"Unable to read the Indiana response")}finally{clearTimeout(F),n.signal.removeEventListener("abort",I),m.delete(n)}}return{subjectKey:()=>l,webViewUrl(){if(S!=="embedded"){if(!g)throw new e("INVALID_RESPONSE","The gateway did not provide a hosted Web View renderer");return new URL(g,s.href).href}},identify(i){if(!i.trim()||/\s/.test(i)||i.length>4096)throw new e("INVALID_TOKEN","A nonempty server-issued token is required");R(),p=i},reset:R,request:H}}export{Z as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as z}from"./chunk-4K25DELJ.js";var W=new Set(["script","noscript","iframe","object","embed","base","link","meta","canvas","video","audio","source","track"]),M='[data-indiana-private],[data-private],input,textarea,select,[contenteditable]:not([contenteditable="false"])',R=/password|passwd|secret|token|authorization|api.?key|email|phone|ssn|card.?number/i,b=e=>e.replace(/\b([a-z][a-z0-9+.-]*:\/\/)[^\s/?#]*@/gi,"$1[redacted-credentials]@").replace(/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,"[redacted]").replace(/\b(?:sk_(?:live|test)_\w{12,}|gh[pousr]_\w{16,}|eyJ[\w-]{8,}\.[\w-]{8,}\.[\w-]+)\b/g,"[redacted]").replace(/\bBearer\s+[\w.~+/=-]{12,}/gi,"[redacted]"),y=e=>/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}|\d{7,}|[a-f0-9]{32,}/i.test(e)||b(e)!==e;function O(e,i){let r=e;for(let s=0;r&&s<=80;s++){if(r.closest(i))return!0;let n=r.getRootNode();if(!("host"in n))return!1;r=n.host}return!0}function D(e,i){return!!(O(e,[M,...i.blockedSelectors].join(","))||e.matches("input,textarea,select")&&R.test(e.getAttribute("name")||e.id))}function K(e,i,r){return!i||D(i,r)||!r.publicSelectors.some(s=>i.closest(s))?e.replace(/\S/g,"\u2022"):b(e)}function Z(e,i){let r={};for(let s of e.getAttributeNames()){let n=s.toLowerCase(),a=e.getAttribute(s);if(a!==null&&/^(?:class|id|role|type|dir|lang|hidden|open|disabled|checked|width|height|viewbox|preserveaspectratio|transform|opacity|fill-opacity|stroke-opacity|stroke-dasharray|stroke-dashoffset|stroke-miterlimit|clip-path|gradientunits|gradienttransform|spreadmethod|offset|stop-color|stop-opacity|fx|fy|fr|d|fill|fill-rule|clip-rule|stroke|stroke-width|stroke-linecap|stroke-linejoin|cx|cy|r|rx|ry|x|y|x1|x2|y1|y2|points|data-indiana-id|data-indiana-public|data-indiana-private|data-(?:state|side|align|orientation|disabled|highlighted|slot|variant|size)|aria-(?:hidden|expanded|selected|checked|disabled|modal|busy|invalid|required))$/.test(n)&&!(b(a)!==a||R.test(a)&&n==="id")){if(/(?:[a-z][a-z0-9+.-]*:\/\/|\b(?:data|blob):|url\s*\()/i.test(a)){let t=/^(?:fill|stroke|clip-path)$/.test(n)&&/^url\(\s*["']?#([\w:-]{1,160})["']?\s*\)$/i.exec(a);t&&t[1]!==void 0&&!y(t[1])&&(r[n]=a);continue}{if(n==="data-indiana-id"&&!i?.sourceAnchors.includes(a)||n==="id"&&(y(a)||!/^[\w:-]{1,160}$/.test(a)))continue;if(n==="class"){let t=a.split(/\s+/).filter(d=>d&&!y(d));t.length&&(r[n]=t.join(" "));continue}}if(n==="data-indiana-public"||n==="data-indiana-private"){r[n]="";continue}if(/^data-(?:slot|variant|size)$/.test(n)){/^[a-z][a-z0-9-]{0,63}$/.test(a)&&!y(a)&&(r[n]=a);continue}n.startsWith("data-")&&n!=="data-indiana-id"&&!/^(?:open|closed|checked|unchecked|on|off|active|inactive|top|bottom|left|right|start|center|end|horizontal|vertical|true|false|)$/.test(a)||(r[n]=a)}}return e.hasAttribute("style")&&(r.style=e.getAttribute("style")||""),e.tagName==="INPUT"&&["checkbox","radio"].includes(e.type)&&(e.checked?r.checked="":delete r.checked),e.tagName==="DIALOG"&&e.open&&(r.open=""),r}function V(e){let i=new Map,r=new Map,s=0,n=0,a=0;for(let t of e){if(i.has(t.id)||Object.keys(t.attributes).length>40)throw Error("Invalid capture tree");if(t.parentId===null){if(++s>1||t.kind!=="element"||t.tag!=="html")throw Error("Invalid capture root");i.set(t.id,0)}else{let d=i.get(t.parentId),u=r.get(t.parentId);if(d===void 0||d>=80||u?.kind!=="element")throw Error("Invalid capture depth");i.set(t.id,d+1)}if(t.shadow&&(t.parentId===null||t.tag==="html"||t.tag==="body"||t.tag==="head"))throw Error("Invalid shadow root");if(t.tag==="html"&&t.parentId!==null)throw Error("Nested document");if((t.tag==="head"||t.tag==="body")&&(r.get(t.parentId)?.tag!=="html"||(t.tag==="head"?++n:++a)>1))throw Error("Invalid document structure");if(t.kind==="element"&&(!t.tag||t.text!==null)||t.kind==="text"&&(t.tag!==null||t.text===null||Object.keys(t.attributes).length))throw Error("Invalid capture node");r.set(t.id,t)}if(s!==1||a!==1)throw Error("Missing capture root/body")}import{array as f,boolean as B,discriminatedUnion as N,enum as U,literal as l,number as c,record as j,string as p,url as $,uuid as g}from"zod";import{refine as P,strictObject as o}from"zod/mini";function Q(e,i,r){try{let s=new URL(i).origin,n=new URL(e,i);if(n.origin!==s||n.username||n.password||n.hash)return null;if(!n.search)return r.includes(n.pathname)?n.pathname:null;if(n.pathname!=="/_next/image")return null;let a=[...n.searchParams];if(a.length!==3||new Set(a.map(([x])=>x)).size!==3||a.some(([x])=>!["url","w","q"].includes(x)))return null;let t=n.searchParams.get("w"),d=n.searchParams.get("q");if(!/^[1-9]\d{0,4}$/.test(t)||Number(t)>8192||!/^[1-9]\d?$|^100$/.test(d))return null;let u=n.searchParams.get("url");if(!u.startsWith("/")||u.startsWith("//")||u.includes("\\")||/[\u0000-\u0020]/.test(u))return null;let m=new URL(u,s);return m.origin!==s||m.search||m.hash||m.pathname==="/_next/image"?null:r.includes(m.pathname)?m.pathname:null}catch{return null}}var h=p().regex(/^[a-f0-9]{64}$/),v=p().min(1).max(256),q=p().regex(/^[\p{L}\p{N} _.-]{1,64}$/u).refine(e=>b(e)===e&&!y(e),"Use a public state label");var S=Object.freeze({maxNodes:5e3,maxDepth:80,maxAttributes:40,maxText:4096,maxBytes:2097152,maxCssBytes:524288,maxStyleSheets:256,maxCssRules:5e3,sliceMs:1,maxSliceMs:8,deadlineMs:3e3,quietMs:300,minIntervalMs:1e3,maxSnapshots:10,urgentIntervalMs:250,maxBufferedSnapshots:2}),F=o({pageKey:v,path:p().startsWith("/").max(2048)}),w=p().regex(/^(?:#[A-Za-z][\w-]{0,80}|\.[A-Za-z][\w-]{0,80}|\[data-indiana-(?:public|private)\])$/),L=o({environmentId:g(),privacy:l("masked-default-v2"),sourceAnchors:f(p().min(1).max(256)).max(1e3).default([]),sourceVersionId:g(),manifestDigest:h,origin:$(),routes:f(F).min(1).max(200),publicSelectors:f(w).max(8),blockedSelectors:f(w).max(8),assetPaths:f(p().startsWith("/").max(2048)).max(128)}),re=o({policy:L.check(P(e=>e.privacy==="masked-default-v2"&&!!e.environmentId)),expiresAt:c().int().positive(),serverTime:c().int().positive(),progress:o({sequence:c().int().min(0).max(10),lastContentHash:h.nullable(),readyCount:c().int().min(0).max(10)}).check(P(e=>e.readyCount<=e.sequence))}),ae=N("ready",[o({versionId:g(),ready:l(!0),upload:l(null)}),o({versionId:g(),ready:l(!1),upload:o({mode:l("proxy")})})]),ie=o({versionId:g(),ready:l(!0)}),H=o({id:c().int().nonnegative().max(5e3),parentId:c().int().nonnegative().max(5e3).nullable(),kind:U(["element","text"]),tag:p().regex(/^[a-z][a-z0-9-]*$/).max(64).nullable(),text:p().max(4096).nullable(),attributes:j(p().max(100),p().max(4096)),shadow:B()}),J=o({nodes:f(H).min(1).max(S.maxNodes),css:p().max(S.maxCssBytes),shadowCss:f(o({hostId:c().int().nonnegative().max(5e3),css:p().max(S.maxCssBytes)})).max(128),scroll:o({x:c().finite().nonnegative().max(1e7),y:c().finite().nonnegative().max(1e7)})}),oe=o({format:l("indiana-runtime-snapshot"),schemaVersion:l(1),collector:o({name:l("indiana-bounded-dom"),version:l(2),buildSha256:h.optional()}),sourceVersionId:g(),manifestDigest:h,pageKey:v,routeTemplate:p().startsWith("/").max(2048),sequence:c().int().min(1).max(10),label:q,viewport:o({width:c().int().min(100).max(8192),height:c().int().min(100).max(8192),dpr:c().finite().min(.1).max(10)}),privacy:l("masked-default-v2"),contentHash:h,previousContentHash:h.nullable(),document:J,gaps:f(p().regex(/^[A-Z_]{1,80}$/)).max(32),metrics:o({maxSliceMs:c().finite().nonnegative(),totalWorkMs:c().finite().nonnegative(),elapsedMs:c().finite().nonnegative()})});function se(e){let{sourceVersionId:i,manifestDigest:r,pageKey:s,viewport:n,document:a,privacy:t}=e;return{sourceVersionId:i,manifestDigest:r,pageKey:s,viewport:n,document:a,privacy:t}}function E(e){if(e===null||typeof e=="boolean")return JSON.stringify(e);if(typeof e=="string"){if(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(e))throw Error("Invalid Unicode");return JSON.stringify(e)}if(typeof e=="number"&&Number.isFinite(e))return JSON.stringify(e);if(Array.isArray(e))return"["+e.map(E).join(",")+"]";if(e&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype)return"{"+Object.keys(e).sort().map(i=>JSON.stringify(i)+":"+E(e[i])).join(",")+"}";throw Error("Invalid capture JSON")}function ce(e,i){let r=i.replace(/\/$/,"").split("/").filter(Boolean),s=[];for(let t of e){let d=t.path.replace(/\/$/,"").split("/").filter(Boolean),u=[],m=0,x=!0;for(let[_,k]of d.entries()){let I=/^\[\[\.\.\.[^\[\]]+\]\]$/.test(k),T=I||/^\[\.\.\.[^\[\]]+\]$/.test(k),A=/^\[[^\[\]]+\]$/.test(k);if(T){(_!==d.length-1||!I&&m===r.length)&&(x=!1),m=r.length,u.push(I?0:1);break}let C=r[m++];if(C===void 0){x=!1;break}try{!A&&decodeURIComponent(k)!==decodeURIComponent(C)&&(x=!1),decodeURIComponent(C)}catch{x=!1}u.push(A?2:3)}x&&m===r.length&&s.push({route:t,rank:u})}s.sort((t,d)=>{for(let u=0;u<Math.max(t.rank.length,d.rank.length);u++){let m=(d.rank[u]??4)-(t.rank[u]??4);if(m)return m}return 0});let[n,a]=s;if(n&&a&&JSON.stringify(n.rank)===JSON.stringify(a.rank))throw Error("Ambiguous capture route");return n?.route??null}var ue=N("action",[o({action:l("authorize")}),o({action:l("policy")}),o({action:l("register"),requestId:g(),sha256:h,bytes:c().int().min(1).max(S.maxBytes),pageKey:v,sequence:c().int().min(1).max(10),contentHash:h}),o({action:l("complete"),versionId:g()})]),le=o({action:l("capture-grant"),versionId:g(),origin:$().refine(z,"Capture requires HTTPS or loopback HTTP"),routeKeys:f(v).min(1).max(20),publicSelectors:f(w).max(8),blockedSelectors:f(w).max(8)}),pe=o({versionId:g(),sha256:h,contentHash:h});export{Q as a,W as b,b as c,y as d,O as e,D as f,K as g,Z as h,V as i,q as j,S as k,re as l,ae as m,ie as n,se as o,E as p,ce as q,pe as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k,b as L,c as O}from"./chunk-4K25DELJ.js";function N(r){let e=r.document,o=/^zh\b/i.test(e.documentElement.lang),t=e.createElement("div"),v=t.attachShadow({mode:"open"}),h=e.createElement("style");t.setAttribute("data-indiana-private",""),t.setAttribute("data-indiana-capture-controls",""),t.setAttribute("aria-live","off");let b=typeof t.showPopover=="function";b&&t.setAttribute("popover","manual"),t.hidden=!0,r.nonce&&(h.nonce=r.nonce),h.textContent=":host{all:initial!important;position:fixed!important;margin:0!important;inset:auto!important;right:12px!important;bottom:12px!important;z-index:2147483647!important;display:block!important;width:340px!important;max-width:calc(100vw - 24px)!important;color:#17202d!important;font:13px/1.4 system-ui,sans-serif!important;color-scheme:light!important}:host([hidden]){display:none!important}*{box-sizing:border-box}.panel{background:white;border:1px solid #98a4b4;border-radius:2px;padding:12px;box-shadow:0 2px 10px #17202d20}.top,.actions{display:flex;align-items:center;gap:8px}.top{justify-content:space-between}strong{font-weight:600}small{font-size:12px;font-variant-numeric:tabular-nums}.message{margin:6px 0;color:#465467;overflow-wrap:anywhere}.actions{justify-content:flex-end}button{font:inherit;min-height:40px;border:1px solid #98a4b4;border-radius:2px;padding:6px 12px;background:white;color:#17202d;cursor:pointer}button:focus-visible{outline:2px solid #155eef;outline-offset:2px}button:disabled{cursor:default;color:#5b6778;background:#f2f4f7}button.primary:enabled{background:#155eef;border-color:#155eef;color:white}@media(forced-colors:active){.panel,button{border:1px solid CanvasText}button:focus-visible{outline:2px solid Highlight}}";let l=e.createElement("section"),u=e.createElement("div"),f=e.createElement("strong"),I=e.createElement("small"),g=e.createElement("p"),R=e.createElement("div"),d=e.createElement("button"),A=e.createElement("button");if(l.className="panel",u.className="top",R.className="actions",l.setAttribute("aria-label",o?"Indiana \u9875\u9762\u91C7\u96C6":"Indiana page capture"),l.setAttribute("role","region"),f.textContent=o?"Indiana \u9875\u9762\u91C7\u96C6":"Indiana page capture",g.className="message",g.setAttribute("role","status"),d.type=A.type="button",d.className="primary",d.textContent=o?"\u91CD\u8BD5\u91C7\u96C6":"Retry capture",u.append(f,I),R.append(d,A),l.append(u,g,R),v.append(h,l),(e.body??e.documentElement).append(t),!h.sheet)throw t.remove(),Object.assign(Error("Authoring controls blocked by style policy"),{code:"AUTHORING_CONTROLS_BLOCKED"});t.hidden=!1;let a={state:"connecting",snapshots:0},E=!1,w,p;function y(c=e.activeElement){if(E||c===t||c&&t.contains(c))return;let i,m=c;for(let S=0;m&&S<80;S++,m=m.parentElement)if(m.matches('dialog[open],[role="dialog"],[role="alertdialog"],[role="menu"],[role="listbox"]')&&m.getAttribute("aria-hidden")!=="true"){i=m;break}w=i;let x=i??e.body??e.documentElement;if(t.parentElement!==x&&x.append(t),t.removeAttribute("aria-hidden"),b)try{t.showPopover()}catch{}}let C=c=>{c.target instanceof e.defaultView.Element&&y(c.target)},_=c=>{c.target===w&&y(e.body)};e.addEventListener("focusin",C,!0),e.addEventListener("close",_,!0);let n={connecting:["\u6B63\u5728\u8FDE\u63A5\u91C7\u96C6\u670D\u52A1\u2026","Connecting to capture service\u2026"],authorized:["\u91C7\u96C6\u6388\u6743\u5DF2\u786E\u8BA4\uFF0C\u6B63\u5728\u52A0\u8F7D\u2026","Capture authorized; loading\u2026"],idle:["\u9875\u9762\u7A33\u5B9A\u540E\u81EA\u52A8\u91C7\u96C6\uFF0C\u8F93\u5165\u6587\u672C\u4F1A\u906E\u853D\u3002","Stable page states are captured automatically. Input text is masked."],capturing:["\u6B63\u5728\u91C7\u96C6\u9875\u9762\u7ED3\u6784\u2026","Capturing page structure\u2026"],uploading:["\u6B63\u5728\u4FDD\u5B58\u8131\u654F\u5FEB\u7167\u2026","Saving a masked snapshot\u2026"],waiting:["\u4E0A\u4F20\u5904\u7406\u4E2D\uFF0C\u540E\u7EED\u53D8\u5316\u5DF2\u5408\u5E76\u7B49\u5F85\u3002","Upload in progress; later changes are coalesced."],paused:["\u91C7\u96C6\u5DF2\u6682\u505C\u3002\u68C0\u67E5\u9875\u9762\u6216\u8FDE\u63A5\u540E\uFF0C\u53EF\u624B\u52A8\u91CD\u8BD5\u3002","Capture paused. Check the page or connection, then retry."],stopped:["\u91C7\u96C6\u5DF2\u505C\u6B62\u3002\u5237\u65B0\u9875\u9762\u540E\u6062\u590D\u666E\u901A\u8BBF\u95EE\u3002","Capture stopped. Reload the page to resume ordinary delivery."]};function s(){if(E)return;if(t.isConnected||w&&!w.isConnected&&y(),!t.isConnected){E=!0,clearInterval(p),e.removeEventListener("focusin",C,!0),e.removeEventListener("close",_,!0),r.stop();return}let c=Number.isInteger(a.snapshots)?Math.min(10,Math.max(0,a.snapshots)):0,i=a.expiresAt&&Number.isFinite(a.expiresAt)?Math.max(0,Math.ceil((a.expiresAt-Date.now())/1e3)):null;I.textContent=(o?`\u5DF2\u4FDD\u5B58 ${c} \u4EFD`:`${c} saved`)+(i===null?"":` \xB7 ${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`);let m=n[a.state]??n.paused;a.state==="paused"&&/(?:429|QUOTA)/.test(a.reason??"")&&(m=["\u5DF2\u8FBE\u5230\u91C7\u96C6\u914D\u989D\uFF0C\u8BF7\u8FD4\u56DE\u63A7\u5236\u53F0\u67E5\u770B\u3002","Capture quota reached. Check the Console before retrying."]),a.state==="paused"&&a.reason==="OFFLINE"&&(m=["\u7F51\u7EDC\u5DF2\u65AD\u5F00\u3002\u6062\u590D\u8FDE\u63A5\u540E\uFF0C\u8BF7\u624B\u52A8\u91CD\u8BD5\u3002","You are offline. Reconnect, then retry explicitly."]),a.state==="paused"&&/(?:SLICE|ENCODING|NODE|BYTE|TEXT|ATTRIBUTE|CSS|DEADLINE)/.test(a.reason??"")&&(m=["\u9875\u9762\u8D85\u51FA\u91C7\u96C6\u9884\u7B97\u3002\u7F29\u5C0F\u9875\u9762\u72B6\u6001\u540E\u518D\u8BD5\u3002","This page exceeds the capture budget. Reduce the page state before retrying."]),a.state==="stopped"&&a.reason==="QUOTA"&&(m=["\u672C\u6B21\u6388\u6743\u6B21\u6570\u5DF2\u7528\u5B8C\u3002\u8BF7\u8FD4\u56DE\u63A7\u5236\u53F0\u91CD\u65B0\u6388\u6743\u3002","This grant is exhausted. Request another grant from the Console."]),a.state==="stopped"&&/EXPIRED|REVOKED/.test(a.reason??"")&&(m=["\u91C7\u96C6\u6388\u6743\u5DF2\u5931\u6548\u3002\u8BF7\u8FD4\u56DE\u63A7\u5236\u53F0\u91CD\u65B0\u6388\u6743\u3002","Capture authority has expired or changed. Return to the Console."]),a.state==="stopped"&&a.reason==="CAPTURE_UPGRADE_REQUIRED"&&(m=["\u91C7\u96C6\u7248\u672C\u4E0D\u5339\u914D\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u6216\u66F4\u65B0 SDK \u540E\u91CD\u65B0\u6388\u6743\u3002","Capture versions differ. Reload or update the SDK, then request another grant."]),g.textContent!==m[o?0:1]&&(g.textContent=m[o?0:1]),d.disabled=a.state!=="paused"||i===0,A.textContent=a.state==="stopped"?o?"\u5173\u95ED":"Close":o?"\u505C\u6B62\u91C7\u96C6":"Stop capture"}for(let c of["click","pointerdown","pointerup","keydown","keyup"])v.addEventListener(c,i=>i.stopPropagation());return d.onclick=()=>{d.disabled||r.retry()},A.onclick=()=>{a.state==="stopped"?r.close():r.stop()},y(),s(),{update(c){E||(a=c,p&&clearInterval(p),p=void 0,a.state!=="stopped"&&a.expiresAt&&Number.isFinite(a.expiresAt)&&(p=setInterval(s,1e3)),s())},destroy(){E||(E=!0,clearInterval(p),e.removeEventListener("focusin",C,!0),e.removeEventListener("close",_,!0),t.remove())},get active(){return!E&&t.isConnected}}}function U(r){let e=r.document??document,o=e.defaultView;if(!o)return{destroy(){},checkpoint(n){},retry(){}};let t="indiana:iam:authoring:v2:"+new URL(r.baseUrl).origin+":"+r.environmentId;function v(n){if(n.length>12e3||!/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(n))return!1;try{let s=JSON.parse(o.atob(n.split(".")[0].replaceAll("-","+").replaceAll("_","/")));return k(o.location.origin)&&typeof s=="object"&&s!==null&&"version"in s&&"environmentId"in s&&"origin"in s&&s.version===2&&s.environmentId===r.environmentId&&s.origin===o.location.origin}catch{return!1}}let h=!1,b=!1,l=0,u=!1,f="",I,g,R=0,d,A=()=>{try{o.sessionStorage.removeItem(t)}catch{}},a=n=>{if(b!==n){b=n;try{r.onAuthoringChange?.(n)}catch{}}},E=n=>{R=n.snapshots,g?.update(n);try{r.onStatus?.(n)}catch{}e.dispatchEvent(new o.CustomEvent("indiana:iam:status",{detail:n}))};function w(){h||(l++,I?.abort(),d?.destroy("USER_STOPPED"),d=void 0,u=!1,A(),f="",a(!1),e.removeEventListener("indiana:iam:checkpoint",p),E({state:"stopped",reason:"USER_STOPPED",snapshots:R}))}let p=n=>{let s=n instanceof o.CustomEvent?n.detail:void 0,c=s&&typeof s=="object"&&"label"in s?s.label:void 0;if(typeof c=="string"&&/^[\p{L}\p{N} _.-]{1,64}$/u.test(c))try{d?d.checkpoint(c):f&&!u&&C(f)}catch{}};function y(){let n=new URLSearchParams(o.location.hash.slice(1)),s=n.get("indiana-capture");if(!s)return null;v(s)&&a(!0),n.delete("indiana-capture");let c=new URL(o.location.href);return c.hash=n.toString(),o.history.replaceState(o.history.state,"",c),/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(s)&&s.length<=12e3?s:null}function C(n){if(h||!v(n))return;let s=++l;I?.abort(),I=new AbortController;let c=I.signal;d?.destroy("REPLACED"),d=void 0,f=n,u=!0,a(!0),e.addEventListener("indiana:iam:checkpoint",p);try{o.sessionStorage.setItem(t,n)}catch{}(async()=>{if(r.controls!==!1&&!g?.active&&(g?.destroy(),g=N({document:e,nonce:r.nonce,retry(){d?d.retry():f&&!u&&C(f)},stop:w,close(){g?.destroy(),g=void 0}})),g?.update({state:"connecting",snapshots:0}),!o.navigator.onLine)throw Object.assign(Error("Capture offline"),{code:"OFFLINE"});if(await r.prepare?.(),h||s!==l)return;let i=await fetch(new URL("/api/app-manifest-captures",r.baseUrl),{method:"POST",credentials:"omit",redirect:"error",cache:"no-store",headers:{Authorization:"Bearer "+n,[L]:O,"Content-Type":"application/json"},body:JSON.stringify({action:"authorize"}),signal:AbortSignal.any([c,AbortSignal.timeout(3e4)])});if(i.status!==204||i.headers.get(L)!==O)throw i.body?.cancel().catch(()=>{}),Object.assign(new Error("Capture authorization refused"),{code:i.ok?i.status===204?"CAPTURE_VERSION_MISMATCH":"SERVICE_RESPONSE_INVALID":"AUTH_OR_SERVICE_"+i.status});if(h||s!==l)return;E({state:"authorized",snapshots:0});let{startCapture:m}=await import("./client-OYRHOMUQ.js");if(h||s!==l)return;let x=await m({environmentId:r.environmentId,grant:n,baseUrl:r.baseUrl,document:e,signal:c,onStatus(S){h||s!==l||(S.state==="stopped"&&(A(),f="",a(!1),e.removeEventListener("indiana:iam:checkpoint",p)),E(S))}});if(h||s!==l){x.destroy("REPLACED");return}d=x,e.addEventListener("indiana:iam:checkpoint",p)})().catch(i=>{if(!h&&s===l){let m=i instanceof Error&&["TypeError","TimeoutError"].includes(i.name)||i&&typeof i=="object"&&"code"in i&&/^(?:AUTH_OR_SERVICE_(?:408|429|5\d\d)|SERVICE_RESPONSE_INVALID|OFFLINE)$/.test(String(i.code));m||(A(),f="",a(!1),e.removeEventListener("indiana:iam:checkpoint",p));let x=i&&typeof i=="object"&&"code"in i?String(i.code):"",S={state:m?"paused":"stopped",reason:["CAPTURE_VERSION_MISMATCH","AUTH_OR_SERVICE_426"].includes(x)?"CAPTURE_UPGRADE_REQUIRED":x==="OFFLINE"?"OFFLINE":i&&typeof i=="object"&&"code"in i&&i.code==="AUTHORING_CONTROLS_BLOCKED"?"AUTHORING_CONTROLS_BLOCKED":m?"SERVICE_UNAVAILABLE":"AUTH_OR_SERVICE_UNAVAILABLE",snapshots:0};E(S)}}).finally(()=>{s===l&&(u=!1)})}let _=()=>{let n=y();n&&C(n)};o.addEventListener("hashchange",_);try{let n=y()??o.sessionStorage.getItem(t);n&&C(n)}catch{}return{destroy(){h=!0,l++,I?.abort(),d?.destroy(),g?.destroy(),g=void 0,o.removeEventListener("hashchange",_),e.removeEventListener("indiana:iam:checkpoint",p),A(),f="",a(!1)},checkpoint(n){d?d.checkpoint(n):f&&!u&&C(f)},retry(){d?d.retry():f&&!u&&C(f)}}}async function D(r,e,o){let t=new URL(r,e.baseURI),v=e.defaultView?.location.origin,h=/^\/\.well-known\/indiana\/releases\/([a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12})\.json$/.exec(t.pathname)?.[1];if(!h||t.origin!==v||t.search||t.hash||t.username||t.password)throw Error("Invalid IAM release URL");let b=AbortSignal.any([o,AbortSignal.timeout(2e3)]),l=await fetch(t,{credentials:"omit",redirect:"error",cache:"force-cache",signal:b}),u=l.headers.get("content-length");if(!l.ok||!/^application\/json(?:;|$)/i.test(l.headers.get("content-type")??"")||u!==null&&(!/^\d+$/.test(u)||Number(u)>512))throw l.body?.cancel().catch(()=>{}),Error("IAM release is unavailable");let f=l.body?.getReader();if(!f)throw Error("IAM release is unavailable");let I=[],g=0,R=()=>{},d=new Promise((y,C)=>{R=()=>C(Error("IAM release timeout")),b.addEventListener("abort",R,{once:!0}),b.aborted&&R()}),A=!1;try{for(;;){let y=await Promise.race([f.read(),d]);if(y.done){A=!0;break}if(g+=y.value.length,g>512)throw Error("IAM release budget");I.push(y.value)}}finally{b.removeEventListener("abort",R),A||f.cancel().catch(()=>{}),f.releaseLock()}let a=new Uint8Array(g),E=0;for(let y of I)a.set(y,E),E+=y.length;let w=new TextDecoder("utf-8",{fatal:!0}).decode(a),p=JSON.parse(w);if(w.trim()!==JSON.stringify(p))throw Error("Noncanonical IAM release descriptor");if(!p||typeof p!="object"||Array.isArray(p)||Object.keys(p).sort().join(",")!=="format,manifestDigest,releaseId,schemaVersion"||Reflect.get(p,"format")!=="indiana-app-manifest-release"||Reflect.get(p,"schemaVersion")!==2||Reflect.get(p,"releaseId")!==h||!/^[a-f0-9]{64}$/.test(String(Reflect.get(p,"manifestDigest"))))throw Error("Invalid IAM release descriptor");return Reflect.get(p,"manifestDigest")}var T=new WeakMap;function F(r,e=document){if(!/^[a-f0-9]{64}$/.test(r))throw new Error("Invalid IAM manifest digest");let o=T.get(e);o||(o=new Map,T.set(e,o));let t="data-indiana-release",v=e.documentElement,h=()=>new Set((v.getAttribute(t)??"").split(/\s+/).filter(Boolean)),b=o.get(r);if(!b){let u=h();b={count:0,owned:!u.has(r)},o.set(r,b),u.add(r),v.setAttribute(t,[...u].join(" "))}b.count++;let l=!1;return{attributes:{indianaAppManifestRelease:r},destroy(){if(!l&&(l=!0,b.count--,!b.count&&(o.delete(r),b.owned))){let u=h();u.delete(r),u.size?v.setAttribute(t,[...u].join(" ")):v.removeAttribute(t)}}}}async function $(r){return(await import("./client-OYRHOMUQ.js")).startCapture(r)}export{U as a,D as b,F as c,$ as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Fe}from"./chunk-CB63JLGT.js";import{a as Ue,b as ve,c as Pe,d as ce,e as Le,f as pe,g as De,h as Me,i as xe,j as he,k as S,l as ke,m as Be,n as He,o as Ve,p as Ge,q as Ye}from"./chunk-U6S6AZM6.js";import{a as Ce,b as se,c as ie}from"./chunk-4K25DELJ.js";function me(c){return c.nodeType===1&&c.hasAttribute("data-indiana-capture-controls")&&c.hasAttribute("data-indiana-private")}async function Se(c,l){let o=[];async function e(a){if(a===null||typeof a!="object"){o.push(Ge(a));return}let _=Array.isArray(a),U=_?Object.keys(a):Object.keys(a).sort();o.push(_?"[":"{");for(let y=0;y<U.length;y++)y&&o.push(","),_||o.push(JSON.stringify(U[y]),":"),await e(a[U[y]]),await l();o.push(_?"]":"}")}return await e(c),o.join("")}async function We(c,l,o){if(!Number.isSafeInteger(l)||l<0)throw new RangeError("Invalid byte limit");if(c.length>l)return null;let e=new TextEncoder,a=[],_=0;for(let f=0;f<c.length;){let r=Math.min(c.length,f+4096),T=c.charCodeAt(r-1),h=c.charCodeAt(r);r<c.length&&T>=55296&&T<=56319&&h>=56320&&h<=57343&&r--;let D=e.encode(c.slice(f,r));if(_+=D.byteLength,_>l)return null;a.push(D),f=r,await o()}let U=new Uint8Array(_),y=0;for(let f of a)U.set(f,y),y+=f.byteLength,await o();return U}import{default as qe}from"css-tree/parser";import{default as J}from"css-tree/walker";import{default as Ee}from"css-tree/generator";function we(c,l=[],o=!1,e="https://iam.invalid/",a="masked-default-v2",_=new URL(e).origin){if(a!=="masked-default-v2")throw Error("Unsupported capture privacy");if(c.length>524288||/<\/(?:style|script)/i.test(c))throw Error("CSS budget or boundary");let U=new Set,y=new Set(l),f=qe(c,{context:o?"declarationList":"stylesheet",parseCustomProperty:!0,onParseError:()=>{U.add("CSS_SYNTAX_RECOVERED")}});return J(f,function(r,T,h){if((r.type==="Rule"||r.type==="Atrule")&&r.prelude){let D=Ee(r.prelude);if(ce(D)||Pe(D)!==D)return T&&h&&h.remove(T),U.add("CSS_PRIVATE_SELECTOR_OMITTED"),J.skip}}),J(f,{visit:"Atrule",enter(r,T,h){if(["import","namespace","charset"].includes(r.name.toLowerCase()))return T&&h&&h.remove(T),U.add("CSS_EXTERNAL_RULE_OMITTED"),J.skip}}),J(f,{visit:"Declaration",enter(r,T,h){if(/^(?:content|-moz-binding|behavior)$/i.test(r.property))return T&&h&&h.remove(T),U.add("CSS_CONTENT_OMITTED"),J.skip;let D=Ee(r.value),k=!1;if(k=/(?:password|secret|token|email|phone|(?:user|customer|session|account|tenant)[_-]?id)/i.test(r.property),J(r.value,u=>{(u.type==="Identifier"&&ce(u.name)||(u.type==="String"||u.type==="Hash")&&ce(u.value)||u.type==="Dimension"&&ce(u.unit))&&(k=!0)}),/(?:[\w.%+-]+@[\w.-]+\.[a-z]{2,}|sk_(?:live|test)_\w{12,}|\bBearer\s+|eyJ[\w-]+\.[\w-]+\.)/i.test(D)||k)return T&&h&&h.remove(T),U.add("CSS_PRIVATE_VALUE_OMITTED"),J.skip}}),J(f,r=>{if(r.type==="Raw")throw Error("Unparsed CSS cannot be captured");if(r.type==="Url"){let T="";try{let h=new URL(r.value,e);h.origin===_&&!h.search&&!h.hash&&!h.username&&!h.password&&(T=h.pathname)}catch{}y.has(T)?r.value=T:(r.value="",U.add("CSS_RESOURCE_OMITTED"))}}),{css:Ee(f),gaps:[...U]}}async function Ke(c,l,o,e,a,_,U,y){let f=new Set,r=(u,v=!1)=>{if(u.length>8192)throw Error("Atomic CSS budget");let g=we(u,l.assetPaths,v,o,l.privacy,l.origin);return g.gaps.forEach(p=>a.add(p)),g.css};function T(u){let v;try{v=r(u+(u.startsWith("@keyframes ")?"{from{opacity:1}}":u.startsWith("@")?"{.iam-capture-probe{opacity:1}}":"{opacity:1}"))}catch(p){if(p instanceof Error&&p.message==="Unparsed CSS cannot be captured")return a.add("CSS_SELECTOR_UNSUPPORTED"),"";throw p}let g=v.indexOf("{");return g<0?"":v.slice(0,g+1)}async function h(u){if(u.length>512)throw Error("Atomic CSS budget");let v=0,g=!1,p=[];for(let n=0;n<u.length;n++){await _();let d=u[n],R=u.getPropertyValue(d),C=u.getPropertyPriority(d);if(v+=d.length+R.length+C.length+3,v>8192)throw Error("Atomic CSS budget");p.push({property:d,value:R,priority:C})}if(p.some(n=>n.value==="")){let n=r(u.cssText,!0);return n&&e(n),await _(),!!n}for(let{property:n,value:d,priority:R}of p){await _(),y.cssText="",y.setProperty(n,d,R);let C=r(y.cssText,!0);C&&(g&&e(";"),e(C),g=!0),await _()}return g}async function D(u,v){if(v>20)throw Error("CSS nesting budget");for(let g of u){if(await _(),++U.count>S.maxCssRules)throw Error("CSS rule budget");let p=g.constructor.name;if(p==="CSSImportRule"){let n=g;if(!n.styleSheet){a.add("CSS_EXTERNAL_RULE_OMITTED");continue}let d=n,R=[d.layerName!==null&&d.layerName!==void 0?"@layer "+d.layerName:null,d.supportsText?"@supports "+d.supportsText:null,n.media?.mediaText?"@media "+n.media.mediaText:null].filter(G=>G!==null),C=R.map(T);if(C.some(G=>!G)){a.add("CSS_GROUP_UNSUPPORTED");continue}C.forEach(e),await k(n.styleSheet,v+1),C.forEach(()=>e("}"))}else if(p==="CSSKeyframesRule"){let n=g,d=T("@keyframes "+n.name);if(!d){a.add("CSS_GROUP_UNSUPPORTED");continue}e(d);for(let R of n.cssRules){if(++U.count>S.maxCssRules)throw Error("CSS rule budget");let C=R,G=C.keyText.replace(/\s/g,"");if(!/^(?:(?:from|to|\d+(?:\.\d+)?%)(?:,|$))+$/.test(G)){a.add("CSS_GROUP_UNSUPPORTED");continue}e(G+"{"),await h(C.style),e("}"),await _()}e("}")}else{let n=g,d="cssRules"in g?n.cssRules:null,R=null;if(p==="CSSLayerBlockRule"?R="@layer "+(n.name??""):p==="CSSMediaRule"?R="@media "+n.conditionText:p==="CSSSupportsRule"?R="@supports "+n.conditionText:p==="CSSContainerRule"?R="@container "+n.conditionText:p==="CSSStartingStyleRule"?R="@starting-style":p==="CSSStyleRule"&&(R=n.selectorText??null),R!==null&&(d||p==="CSSStyleRule")){let C=T(R);if(!C){a.add("CSS_GROUP_UNSUPPORTED");continue}e(C),p==="CSSStyleRule"&&n.style&&await h(n.style)&&d?.length&&e(";"),d&&await D(d,v+1),e("}")}else if(d?.length)a.add("CSS_GROUP_UNSUPPORTED");else{let C=g.cssText;if(C.length>32768)throw Error("Atomic CSS budget");e(r(C))}}await _()}}async function k(u,v){if(u.disabled){a.add("DISABLED_STYLESHEET_OMITTED");return}if(f.has(u)){a.add("CSS_IMPORT_CYCLE");return}let g;try{g=u.cssRules}catch{a.add("CROSS_ORIGIN_STYLESHEET");return}f.add(u);let p=o;o=u.href||o;try{let n=u.media?.mediaText,d=n&&n!=="all"?T("@media "+n):"";if(n&&n!=="all"&&!d){a.add("CSS_GROUP_UNSUPPORTED");return}d&&e(d),await D(g,v),d&&e("}")}finally{o=p,f.delete(u)}}await k(c,0)}var i=class extends Error{constructor(o,e){super(o);this.code=o;this.metrics=e}code;metrics},z=()=>performance.now(),je=new URL(import.meta.url).pathname.match(/^\/web-view\/visual-sdk\/([a-f0-9]{64})\//)?.[1],nt=async c=>[...new Uint8Array(await crypto.subtle.digest("SHA-256",c))].map(l=>l.toString(16).padStart(2,"0")).join("");async function Je(c){let{document:l,policy:o,signal:e}=c,a=l.defaultView;if(!he.safeParse(c.label).success)throw new i("PRIVATE_OR_INVALID_LABEL");if(!a||l.hidden||a.location.origin!==o.origin||!l.documentElement.getAttribute("data-indiana-release")?.split(/\s+/).includes(o.manifestDigest))throw new i("SCOPE_OR_VISIBILITY");let _=Ye(o.routes,a.location.pathname);if(!_)throw new i("ROUTE_NOT_ALLOWED");for(let P of[...o.publicSelectors,...o.blockedSelectors])l.querySelector(P);let U=a.location.href,y=z(),f=new Set,r=[],T=[],h=z(),D=0,k=0,u=0,v=0,g="dom",p=()=>{if(e.throwIfAborted(),l.hidden||c.changed()||a.location.origin!==o.origin||a.location.href!==U||!l.documentElement.getAttribute("data-indiana-release")?.split(/\s+/).includes(o.manifestDigest))throw new i("UNSTABLE");if(z()-y>S.deadlineMs)throw new i("DEADLINE")};async function n(P=!1){let M=z()-h;if(!(!P&&M<S.sliceMs)){if(D=Math.max(D,M),k+=M,M>S.maxSliceMs)throw new i("SLICE_BUDGET",{maxSliceMs:D,totalWorkMs:k,elapsedMs:z()-y,phase:g});p(),await new Promise((V,ne)=>{let X=()=>{clearTimeout(re),ne(new i("ABORTED"))},re=setTimeout(()=>{e.removeEventListener("abort",X),V()},0);e.addEventListener("abort",X,{once:!0})}),h=z(),p()}}let d=[{node:l.documentElement,parent:null,depth:0,shadow:!1}],R=[],C=new Map,G=new WeakMap,$=new Map,B=new Map,Q=[],ee=l.adoptedStyleSheets??[];if(l.styleSheets.length+ee.length>S.maxStyleSheets)throw new i("STYLESHEET_BUDGET");function Y(P,M){let V=B.get(M);if(!V?.has(P)){if(R.length>=S.maxStyleSheets)throw new i("STYLESHEET_BUDGET");V||(V=new Set,B.set(M,V)),V.add(P),R.push({sheet:P,hostId:M})}}try{for(;d.length;){await n(),p();let b=d.pop(),E=b.node;if(r.length>=S.maxNodes||b.depth>S.maxDepth)throw new i("NODE_BUDGET");if(E.nodeType!==1&&E.nodeType!==3)continue;let t=E.nodeType===1?E:null;if(me(E))continue;if(t&&(t.tagName==="STYLE"||t.tagName==="LINK")){if(pe(t,o)){f.add("PRIVATE_STYLESHEET_OMITTED");continue}let m=t.sheet;if(m){let N=t.getRootNode(),W=N instanceof a.ShadowRoot?G.get(N):null;W===void 0?f.add("STYLESHEET_SCOPE_UNKNOWN"):($.set(m,W),Y(m,W))}continue}if(t&&ve.has(t.tagName.toLowerCase())){["IFRAME","CANVAS","IMG","PICTURE","VIDEO","AUDIO","OBJECT","EMBED"].includes(t.tagName)&&f.add("NON_DOM_OR_EXTERNAL_OMITTED");continue}if(t){let m=t.getAttributeNames();if(m.length>S.maxAttributes)throw new i("ATTRIBUTE_BUDGET");let N=0;for(let W of m){let oe=t.getAttribute(W)??"";if(N+=oe.length,oe.length>S.maxText||N>8192)throw new i("ATTRIBUTE_BUDGET")}}else if((E.nodeValue?.length??0)>S.maxText)throw new i("TEXT_BUDGET");let H=t&&pe(t,o);if(H&&!["INPUT","TEXTAREA","SELECT"].includes(t.tagName)){f.add("PRIVATE_SUBTREE_OMITTED");continue}let A=t?Me(t,o):{};if(t&&["fill","stroke"].some(m=>/url\s*\(/i.test(t.getAttribute(m)??"")&&!A[m])&&f.add("SVG_RESOURCE_OMITTED"),t?.hasAttribute("data-indiana-id")&&!A["data-indiana-id"]&&f.add("UNKNOWN_ANCHOR_OMITTED"),t?.tagName==="IMG"){let m=Ue(t.getAttribute("src")||"",l.baseURI,o.assetPaths);m?A["data-indiana-asset"]=m:f.add("UNKNOWN_IMAGE_OMITTED")}if(t?.tagName==="DIALOG"&&t.open)try{A.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch{A.rr_open_mode="non-modal"}if(A.style){let m=we(A.style,o.assetPaths,!0,l.baseURI,o.privacy,o.origin);A.style=m.css,m.gaps.forEach(N=>f.add(N))}let I=r.length,F={id:I,parentId:b.parent,kind:t?"element":"text",tag:t?.tagName.toLowerCase()??null,text:t?null:De(E.nodeValue??"",E.parentElement,o),attributes:A,shadow:b.shadow};if(u+=new TextEncoder().encode(JSON.stringify(F)).length,u>S.maxBytes-S.maxCssBytes-4096)throw new i("BYTE_BUDGET");if(r.push(F),t&&Q.push({element:t,id:I}),t&&!H){if(r.length+d.length+t.childNodes.length+(t.shadowRoot?.childNodes.length??0)>S.maxNodes)throw new i("NODE_BUDGET");if(t.shadowRoot){if(C.size>=128)throw new i("SHADOW_BUDGET");c.onShadowRoot?.(t.shadowRoot),C.set(I,[]),G.set(t.shadowRoot,I);let m=t.shadowRoot.adoptedStyleSheets??[];if(m.length>S.maxStyleSheets)throw new i("STYLESHEET_BUDGET");for(let N of m)Y(N,I);for(let N=t.shadowRoot.childNodes.length-1;N>=0;N--)d.push({node:t.shadowRoot.childNodes[N],parent:I,depth:b.depth+1,shadow:!0})}for(let m=E.childNodes.length-1;m>=0;m--)d.push({node:E.childNodes[m],parent:I,depth:b.depth+1,shadow:!1})}}await n(!0),g="css";for(let b of l.styleSheets){await n();let E=b.ownerNode;if(E instanceof a.Element&&pe(E,o)){f.add("PRIVATE_STYLESHEET_OMITTED");continue}$.has(b)?Y(b,$.get(b)):E&&E.getRootNode()===l?Y(b,null):f.add("STYLESHEET_OWNER_UNKNOWN")}for(let b of ee)Y(b,null);let P={count:0},M=l.createElement("span").style;for(let{sheet:b,hostId:E}of R)p(),await Ke(b,o,l.baseURI,t=>{if(v+=new TextEncoder().encode(t).length,v>S.maxCssBytes)throw new i("CSS_BUDGET");(E===null?T:C.get(E)).push(t)},f,()=>n(),P,M);await n(!0),g="scroll",await new Promise((b,E)=>{let t=0,H,A=!1,I=N=>{A||(A=!0,a.cancelAnimationFrame(t),clearTimeout(H),clearTimeout(m),e.removeEventListener("abort",F),N?E(N):b())},F=()=>I(new i("ABORTED"));e.addEventListener("abort",F,{once:!0}),t=a.requestAnimationFrame(()=>{H=setTimeout(()=>I(),0)});let m=setTimeout(()=>I(new i("FRAME_UNAVAILABLE")),250);e.aborted&&F()}),h=z(),p();for(let{element:b,id:E}of Q){for(let[t,H]of[["scrollLeft","rr_scrollLeft"],["scrollTop","rr_scrollTop"]]){let A=b[t];if(!Number.isFinite(A)||Math.abs(A)>1e7)throw new i("SCROLL_BUDGET");A&&(r[E].attributes[H]=String(A))}if(Object.keys(r[E].attributes).length>S.maxAttributes)throw new i("ATTRIBUTE_BUDGET");await n()}await n(!0),g="hash",xe(r),await n(!0),p();let V={nodes:r,css:T.join(""),shadowCss:[...C].map(([b,E])=>({hostId:b,css:E.join("")})),scroll:{x:Math.max(0,a.scrollX),y:Math.max(0,a.scrollY)}},ne={width:Math.max(100,a.innerWidth),height:Math.max(100,a.innerHeight),dpr:a.devicePixelRatio},X={sourceVersionId:o.sourceVersionId,manifestDigest:o.manifestDigest,pageKey:_.pageKey,viewport:ne,document:V,privacy:o.privacy},re=await Se(Ve(X),n),le=new TextEncoder().encode(re);await n(!0);let ue=await nt(le);return h=z(),p(),{format:"indiana-runtime-snapshot",schemaVersion:1,collector:{name:"indiana-bounded-dom",version:2,...je?{buildSha256:je}:{}},...X,routeTemplate:_.path,sequence:c.sequence,label:c.label,contentHash:ue,previousContentHash:c.previousContentHash,gaps:[...f].slice(0,32),metrics:{maxSliceMs:D,totalWorkMs:k,elapsedMs:z()-y}}}catch(P){throw P instanceof i||e.aborted?P:new i(g==="css"?"CSS_UNSUPPORTED":"SERIALIZATION_UNSUPPORTED",{maxSliceMs:D,totalWorkMs:k,elapsedMs:z()-y,phase:g})}finally{Q.length=0,d.length=0,R.length=0}}var ze=1081344,Re=16*1024;function be(c,l,o){return Fe(c,l,o,{message:"CAPTURE_SERVICE_RESPONSE"})}async function Ut(c){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(c.environmentId))throw Error("Invalid capture environment");let l=c.document??document,o=l.defaultView;if(!o)throw Error("Capture requires a window");let e=o;if(!e.navigator.onLine)throw new i("OFFLINE");let a=c.grant,_=c.onStatus,U=c.transport,y=new URL(c.baseUrl);if(y.pathname!=="/"||y.search||y.hash||y.username||y.password||!Ce(y.origin))throw Error("Invalid capture service origin");let f=new AbortController,r=c.signal?AbortSignal.any([f.signal,c.signal]):f.signal;r.throwIfAborted();let T=y.origin+"/api/app-manifest-captures",h=async s=>{let O=AbortSignal.any([r,AbortSignal.timeout(45e3)]),L=await fetch(T,{method:"POST",credentials:"omit",redirect:"error",cache:"no-store",headers:{Authorization:"Bearer "+a,[se]:ie,"Content-Type":"application/json"},body:JSON.stringify(s),signal:O});if(!L.ok)throw L.body?.cancel().catch(()=>{}),new i("AUTH_OR_SERVICE_"+L.status);if(L.headers.get(se)!==ie)throw L.body?.cancel().catch(()=>{}),new i("CAPTURE_VERSION_MISMATCH");try{return await be(L,s.action==="policy"?ze:Re,O)}catch{throw new i("SERVICE_RESPONSE_INVALID")}},D=performance.now(),k;try{k=ke.parse(await h({action:"policy"}))}catch(s){throw s instanceof i?s:new i("SERVICE_RESPONSE_INVALID")}let{policy:u,progress:v}=k,g=Math.min(k.expiresAt-k.serverTime,9e5)-(performance.now()-D),p=Date.now()+g;if(u.environmentId!==c.environmentId)throw Error("Foreign capture environment");if(g<=0||u.origin!==e.location.origin||!Ce(u.origin))throw Error("Capture authorization expired or foreign origin");let n=0,d=v.sequence,R=v.readyCount,C=v.lastContentHash,G=-1/0,$=!0,B=!1,Q=!1,ee=!1,Y=!1,P=!1,M=!1,V=0,ne=-1/0,X=!1,re=performance.now(),le=performance.now(),ue=e.location.href,de="initial",b=!1,E=!1,t=null,H=null,A=null,I=(s,O,L)=>{try{_?.({state:s,reason:O,snapshots:R,expiresAt:p,pending:+!!t+ +!!H,...L?{metrics:L}:{}})}catch{}},F=()=>{B||M||(M=!0,Y=!0,P=!0,A?.abort(),I("paused","OFFLINE"))};e.addEventListener("offline",F);let m=(s=!1)=>{$=!0,n++,re=performance.now(),s===!0&&(b=!0)},N=new e.MutationObserver(s=>{let O=["[data-indiana-private]","[data-private]",...u.blockedSelectors].join(","),L=!1,Z=!1;for(let w of s.slice(0,16)){if(w.type==="childList"){let K=w.addedNodes.length+w.removedNodes.length;if(K>0&&K<=8&&[...w.addedNodes,...w.removedNodes].every(me))continue}let x=w.target.nodeType===1?w.target:w.target.parentElement;x&&Le(x,O)||(L=!0,(x?.tagName==="DIALOG"||["dialog","menu","listbox","tooltip"].includes(x?.getAttribute("role")??""))&&(Z=!0))}(s.length>16||L)&&m(Z)}),W=new Set,oe=s=>{W.has(s)||(N.observe(s,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),W.add(s))};oe(l);let _e=s=>{let O=s.target instanceof e.Element&&s.target.closest('input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]),textarea,[contenteditable="true"],[contenteditable=""]');O&&["input","beforeinput","compositionend"].includes(s.type)&&(ne=performance.now()),O&&s.type==="compositionstart"&&(X=!0),(s.type==="compositionend"||s.type==="focusout")&&(X=!1),m(s.type==="click"||s.type==="change")},Ae=["input","beforeinput","compositionstart","compositionend","change","click","focusout","popstate","hashchange","resize","scroll","visibilitychange"],Ie=new Set(["input","beforeinput","compositionstart","compositionend","change","click","focusout","scroll","visibilitychange"]);for(let s of Ae)(Ie.has(s)?l:e).addEventListener(s,_e,{capture:!0,passive:!0});let Xe=U??(async(s,O,L,Z)=>{let w=[...new Uint8Array(await crypto.subtle.digest("SHA-256",O))].map(Te=>Te.toString(16).padStart(2,"0")).join(""),x=Be.parse(await h({action:"register",requestId:Z,sha256:w,bytes:O.byteLength,pageKey:s.pageKey,sequence:s.sequence,contentHash:s.contentHash}));if(x.ready)return;let K=new URL(T+"/"+x.versionId+"/content"),q=AbortSignal.any([L,AbortSignal.timeout(9e4)]),j=await fetch(K,{method:"PUT",body:O,headers:{Authorization:"Bearer "+a,[se]:ie,"Content-Type":"application/json"},credentials:"omit",redirect:"error",signal:q});if(!j.ok)throw j.body?.cancel().catch(()=>{}),new i("UPLOAD_"+j.status);if(j.headers.get(se)!==ie)throw j.body?.cancel().catch(()=>{}),new i("CAPTURE_VERSION_MISMATCH");if(He.parse(await be(j,Re,q)).versionId!==x.versionId)throw new i("SERVICE_RESPONSE_INVALID")}),$e=e.setInterval(()=>{Ze()},250),Qe=e.setTimeout(()=>te("EXPIRED"),Math.min(p-Date.now(),9e5));async function ae(){if(B||ee||P)return;if(H||(H=t,t=null),!H){d>=S.maxSnapshots&&!Q&&te("QUOTA");return}ee=!0;let s=H;I("uploading",void 0,s.metrics);try{if(await Xe(s.snapshot,s.bytes,r,s.requestId),B)return;R++,H=null,E=!1,I(M?"paused":"idle",M?"OFFLINE":void 0)}catch(O){if(B)return;let L=O instanceof i?O.code:"UPLOAD_FAILED";if(L==="CAPTURE_VERSION_MISMATCH"||/^(?:AUTH_OR_SERVICE|UPLOAD)_426$/.test(L)){te("CAPTURE_UPGRADE_REQUIRED");return}if(/^(?:AUTH_OR_SERVICE|UPLOAD)_(?:401|403|409)$/.test(L)){te("REVOKED_OR_CHANGED");return}P=!0,I("paused",M?"OFFLINE":L)}finally{ee=!1,!B&&!P&&ae()}}async function Ze(){if(B||Q||r.aborted)return;if(!e.navigator.onLine){F();return}if(e.location.href!==ue&&(ue=e.location.href,de="navigation",Y=!1,V=0,m(!0)),Y||P)return;let s=!1;for(let w of W)w instanceof e.ShadowRoot&&!w.host.isConnected&&(W.delete(w),s=!0);if(s){N.takeRecords().length&&m(),N.disconnect();for(let w of W)N.observe(w,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}if(d>=S.maxSnapshots){ae();return}if(performance.now()-le>15e3&&(le=performance.now(),m()),!$||l.hidden||!e.navigator.onLine||performance.now()-re<S.quietMs||performance.now()-G<(b?S.urgentIntervalMs:S.minIntervalMs)||X||performance.now()-ne<1e3)return;if(t&&H){E||(E=!0,I("waiting","UPLOAD_BACKPRESSURE"));return}Q=!0;let O=n,L=de;b=!1,A=new AbortController;let Z=AbortSignal.any([r,A.signal]);I("capturing");try{let w=await Je({document:l,policy:u,sequence:d+1,label:L,previousContentHash:C,signal:Z,changed:()=>n!==O,onShadowRoot:oe});if(B)return;if(w.contentHash===C){$=n!==O,I(ee?"uploading":"idle");return}let x=performance.now(),K=0,q=0,j=x,ge=async()=>{let fe=performance.now()-x;if(fe>=S.sliceMs){if(K+=fe,q=Math.max(q,fe),fe>S.maxSliceMs)throw new i("ENCODING_BUDGET",{maxSliceMs:q,totalWorkMs:K,elapsedMs:performance.now()-j,phase:"encoding"});await new Promise(et=>setTimeout(et,0)),Z.throwIfAborted(),x=performance.now()}},Te=await Se(w,ge),ye=await We(Te,S.maxBytes,ge);if(!ye)throw new i("BYTE_BUDGET");let Ne=performance.now()-x;if(K+=Ne,q=Math.max(q,Ne),q>S.maxSliceMs)throw new i("ENCODING_BUDGET",{maxSliceMs:q,totalWorkMs:K,elapsedMs:performance.now()-j,phase:"encoding"});if(ye.length>S.maxBytes)throw new i("BYTE_BUDGET");Z.throwIfAborted(),t={snapshot:w,bytes:ye,requestId:crypto.randomUUID(),metrics:{maxSliceMs:Math.max(w.metrics.maxSliceMs,q),totalWorkMs:w.metrics.totalWorkMs+K,elapsedMs:w.metrics.elapsedMs+performance.now()-j,phase:"capture-and-encoding"}},d=w.sequence,C=w.contentHash,G=performance.now(),$=n!==O,V=0,E=!1,ae()}catch(w){if(B)return;let x=w instanceof i?w.code:"CAPTURE_FAILED";G=performance.now(),["UNSTABLE","ROUTE_NOT_ALLOWED","SCOPE_OR_VISIBILITY"].includes(x)&&++V<3?I("idle",x):(Y=!0,I("paused",M?"OFFLINE":x,w instanceof i?w.metrics:void 0))}finally{Q=!1,A=null}}function te(s="DESTROYED"){if(!B){B=!0,r.removeEventListener("abort",Oe),f.abort(),A?.abort(),N.disconnect(),W.clear(),t=null,H=null,a="",e.clearInterval($e),e.clearTimeout(Qe),e.removeEventListener("offline",F);for(let O of Ae)(Ie.has(O)?l:e).removeEventListener(O,_e,!0);I("stopped",s)}}let Oe=()=>te("ABORTED");return r.addEventListener("abort",Oe,{once:!0}),r.aborted&&te("ABORTED"),B||(e.navigator.onLine?I("idle"):F()),{checkpoint(s="checkpoint"){if(!B){if(!he.safeParse(s).success)throw Error("Invalid checkpoint label");if(de=s,!e.navigator.onLine){F();return}M=!1,Y=!1,P=!1,V=0,m(!0),ae()}},retry(){if(!B){if(!e.navigator.onLine){F();return}M=!1,Y=!1,P=!1,V=0,ae()}},destroy:te,get paused(){return Y||P},get snapshots(){return R}}}export{Ut as startCapture};
|
|
@@ -621,6 +621,24 @@ declare function createConfigurationSync(options: ConfigurationSyncOptions): {
|
|
|
621
621
|
failed: string;
|
|
622
622
|
id: string;
|
|
623
623
|
name: string;
|
|
624
|
+
appManifest?: {
|
|
625
|
+
versionId: string;
|
|
626
|
+
manifestDigest: string;
|
|
627
|
+
sourceGraphDigest: string;
|
|
628
|
+
pageKey: string;
|
|
629
|
+
stateKey: string;
|
|
630
|
+
documentKey: string;
|
|
631
|
+
documentHash: string;
|
|
632
|
+
elementKey?: string | undefined;
|
|
633
|
+
nodeId?: string | undefined;
|
|
634
|
+
contentHash?: string | undefined;
|
|
635
|
+
renderKey?: string | undefined;
|
|
636
|
+
observed?: {
|
|
637
|
+
versionId: string;
|
|
638
|
+
sha256: string;
|
|
639
|
+
contentHash: string;
|
|
640
|
+
} | undefined;
|
|
641
|
+
} | undefined;
|
|
624
642
|
position?: {
|
|
625
643
|
x: number;
|
|
626
644
|
y: number;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const scopeSchema: z.ZodObject<{
|
|
4
|
+
projectId: z.ZodString;
|
|
5
|
+
environment: z.ZodEnum<{
|
|
6
|
+
sandbox: "sandbox";
|
|
7
|
+
live: "live";
|
|
8
|
+
}>;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
type Scope = z.infer<typeof scopeSchema>;
|
|
11
|
+
|
|
12
|
+
declare const errorRecoverySchema: z.ZodEnum<{
|
|
13
|
+
fix_request: "fix_request";
|
|
14
|
+
authenticate: "authenticate";
|
|
15
|
+
check_permissions: "check_permissions";
|
|
16
|
+
check_scope: "check_scope";
|
|
17
|
+
resolve_conflict: "resolve_conflict";
|
|
18
|
+
reload_state: "reload_state";
|
|
19
|
+
retry_same_request: "retry_same_request";
|
|
20
|
+
configure_integration: "configure_integration";
|
|
21
|
+
check_availability: "check_availability";
|
|
22
|
+
upgrade_sdk: "upgrade_sdk";
|
|
23
|
+
recover_operation: "recover_operation";
|
|
24
|
+
contact_support: "contact_support";
|
|
25
|
+
}>;
|
|
26
|
+
type ErrorRecovery = z.infer<typeof errorRecoverySchema>;
|
|
27
|
+
/** Safe business reasons; never SQL text, resource IDs or provider responses. */
|
|
28
|
+
declare const errorReasonSchema: z.ZodEnum<{
|
|
29
|
+
CAPABILITY_NOT_ENABLED: "CAPABILITY_NOT_ENABLED";
|
|
30
|
+
INTEGRATION_MISSING: "INTEGRATION_MISSING";
|
|
31
|
+
PROVIDER_CREDENTIAL_REJECTED: "PROVIDER_CREDENTIAL_REJECTED";
|
|
32
|
+
PRICE_BINDING_REQUIRED: "PRICE_BINDING_REQUIRED";
|
|
33
|
+
IDEMPOTENCY_CONFLICT: "IDEMPOTENCY_CONFLICT";
|
|
34
|
+
RESULT_UNKNOWN: "RESULT_UNKNOWN";
|
|
35
|
+
STATE_CHANGED: "STATE_CHANGED";
|
|
36
|
+
OPERATION_IN_PROGRESS: "OPERATION_IN_PROGRESS";
|
|
37
|
+
FUNNEL_VERSION_RETIRED: "FUNNEL_VERSION_RETIRED";
|
|
38
|
+
}>;
|
|
39
|
+
type ErrorReason = z.infer<typeof errorReasonSchema>;
|
|
40
|
+
|
|
41
|
+
declare class IndianaError extends Error {
|
|
42
|
+
readonly code: string;
|
|
43
|
+
readonly status?: number | undefined;
|
|
44
|
+
readonly requestId?: string | undefined;
|
|
45
|
+
readonly retryable: boolean;
|
|
46
|
+
readonly recovery: ErrorRecovery;
|
|
47
|
+
readonly retryAfterSeconds?: number;
|
|
48
|
+
readonly reason?: ErrorReason;
|
|
49
|
+
constructor(code: string, message: string, status?: number | undefined, requestId?: string | undefined, metadata?: {
|
|
50
|
+
retryable?: boolean;
|
|
51
|
+
recovery?: ErrorRecovery;
|
|
52
|
+
retryAfterSeconds?: number;
|
|
53
|
+
reason?: ErrorReason;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { IndianaError as I, type Scope as S };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ne}from"./chunk-6X42DWOM.js";import"./chunk-QG3WUJG5.js";import{Gd as ve,ui as me}from"./chunk-HTRQPMJO.js";import"./chunk-S5TVMQRC.js";import"./chunk-ISUXYPYL.js";import"./chunk-U6S6AZM6.js";import"./chunk-4K25DELJ.js";import{a as w}from"./chunk-5TEZEOHX.js";import{Gb as Ce}from"./chunk-RMJJOSVZ.js";import"./chunk-S2MSIA57.js";function be(E){let F=E.view;if(!F?.paywall)throw new w("INVALID_REQUEST","The current node is not a Paywall");let n=F.paywall.receiptId,Z=F.nodeId,te=F.visit,m=F.paywall.resolution,R=F.paywall.quote,g=F.paywall.operation,S=!1,V=new AbortController,v=F.paywall.purchaseRequestId,k=0,U=F.paywall.selectionGeneration??0,L=F.paywall.canReselect===!0,T=null,j=new Map,$=new Map;function D(t){if(t.purchase&&t.purchase.receiptId!==n)throw new w("INVALID_RESPONSE","Purchase receipt changed");let i=t.run.paywall;return t.purchase??(i?.receiptId===n?i:null)}function b(){if(S)throw new w("IDENTITY_CHANGED","Paywall presentation has closed")}function O(t,i,s){if(b(),i!==k||s!==void 0&&R?.operationId!==s)return!1;let h=U,a=t.run.paywall;if(a?.receiptId===n){if((a.selectionGeneration??0)<U)return!1;if(U=a.selectionGeneration??0,L=a.canReselect===!0,a.resolution.id!==m.id||a.resolution.offering.id!==m.offering.id)throw new w("INVALID_RESPONSE","The pinned Paywall binding changed")}let c=D(t),l=U>h,P=l?c?.quote??null:c?.quote??R,N=c?.operation??(P?.operationId===R?.operationId?g:null);if(P&&N&&P.operationId!==N.operationId)throw new w("INVALID_RESPONSE","Purchase operation changed");return a?.receiptId===n&&(m=a.resolution),(l||P?.operationId!==R?.operationId)&&(k++,a?.receiptId===n&&(v=a.purchaseRequestId)),R=P,(g?.operationId!==N?.operationId||g?.status==="pending"||N?.status==="complete")&&(g=N),!0}function z(t,i,s){return new Promise((h,a)=>{let c=!1,l=()=>{clearTimeout(ie),V.signal.removeEventListener("abort",M)},P=ee=>{c||(c=!0,l(),h(ee))},N=ee=>{c||(c=!0,l(),a(ee))},M=()=>N(new w("IDENTITY_CHANGED","Paywall presentation has closed")),ie=setTimeout(()=>N(new w("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,s)),Math.max(0,i-Date.now()));V.signal.addEventListener("abort",M,{once:!0}),V.signal.aborted&&M(),t.then(P,N)})}function x(t){return new Promise(i=>{let s=()=>{clearTimeout(h),V.signal.removeEventListener("abort",s),i()},h=setTimeout(s,t);V.signal.addEventListener("abort",s,{once:!0}),V.signal.aborted&&s()})}async function W(t,i,s){b();let h=j.get(t);if(!h){let l=E.pendingCommands?.find(P=>P.requestId===t)??E.pendingCommand;if(l?.operation==="submit"&&l.requestId===t&&l.nodeId===Z&&l.visit===te){i.type==="paywall_quote"&&l.input.type==="paywall_quote"&&l.input.predecessor&&!i.predecessor&&(i={...i,predecessor:l.input.predecessor});let P=me.parse(l),N=me.parse({...l,input:i});if(N.operation!=="submit"||P.operation!=="submit"||JSON.stringify(N.input)!==JSON.stringify(P.input))throw new w("CONFLICT","A restored purchase request cannot change its input");i=N.input,h=P,j.set(t,h)}}if(h){if(JSON.stringify(h.input)!==JSON.stringify(i))throw new w("CONFLICT","A purchase request cannot change its input")}else{let l=E.view;if(!l||l.nodeId!==Z||l.visit!==te||l.paywall?.receiptId!==n)throw new w("PRECONDITION_FAILED","The Paywall visit has changed");h={operation:"submit",requestId:t,nodeId:Z,visit:te,revision:l.revision,input:i},j.set(t,h)}let a=Date.now()+3e4,c=await z(E.submit(h),a,t);for(;c.run.pendingRequest?.requestId===t&&Date.now()<a&&!S&&(await x(Math.min(1e3,a-Date.now())),!(S||Date.now()>=a));)c=await z(E.resume(t),a,t);if(S)throw new w("IDENTITY_CHANGED","Paywall presentation has closed");if(c.run.pendingRequest?.requestId===t)throw new w("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,t);if(!O(c,s,i.type==="paywall_confirm"||i.type==="paywall_cancel"?i.operationId:void 0))throw new w("PRECONDITION_FAILED","The purchase selection has changed")}async function K(t){if(!R)throw new w("INVALID_REQUEST","A quoted purchase is required");let i=`${t}:${R.operationId}`,s=$.get(i);if(!s){let h=t==="confirm"?"paywall_confirm":"paywall_cancel",a=E.pendingCommands?.find(c=>c.operation==="submit"&&c.input.type===h&&"operationId"in c.input&&c.input.operationId===R.operationId)??E.pendingCommand;s=a?.operation==="submit"&&a.input.type===h&&"operationId"in a.input&&a.input.operationId===R.operationId?a.requestId:crypto.randomUUID(),$.set(i,s)}if(await W(s,{type:t==="confirm"?"paywall_confirm":"paywall_cancel",operationId:R.operationId},k),!g)throw new w("INVALID_RESPONSE","The accepted purchase result is missing");return structuredClone(g)}return{get view(){return structuredClone(m)},get quote(){return R?structuredClone(R):null},get operation(){return g?structuredClone(g):null},get webViewUrl(){return E.webViewUrl},get canReselect(){return L},async refresh(){b();let t=k;return O(await E.get(),t),structuredClone(m)},preview(t){if(v&&v!==t.requestId&&(T||!L))return Promise.reject(new w("COMMAND_PENDING","Retry the original purchase before starting another"));if(v===t.requestId&&T)return T;let i=m.document.buttons[t.actionId],s=i?.type==="checkout"?ve(i.product,t.selection,m.capabilities):null;if(!s)return Promise.reject(new w("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));let h=v!==t.requestId&&U>0?{operationId:R?.operationId??null,generation:U}:void 0;if(h&&(!L||U<=0))return Promise.reject(new w("COMMAND_PENDING","Original purchase requires authoritative termination"));v!==t.requestId&&k++;let a=k;v=t.requestId;let c=(async()=>{if(await W(t.requestId,{type:"paywall_quote",actionId:t.actionId,productVersionId:s,...h?{predecessor:h}:{},...t.offerId?{offerId:t.offerId}:{},...t.nativeOffer?{nativeOffer:t.nativeOffer}:{}},a),!R)throw new w("INVALID_RESPONSE","The accepted quote is missing");return structuredClone(R)})();return T=c,c.then(()=>{T===c&&(T=null)},l=>{T===c&&(T=null),v===t.requestId&&E.pendingCommand?.requestId!==t.requestId&&l instanceof w&&l.status!==void 0&&l.status<500&&![401,425].includes(l.status)&&(v=null)}),c},confirm:()=>K("confirm"),cancel:()=>K("cancel"),async read(){if(b(),!R)throw new w("INVALID_REQUEST","A quoted purchase is required");let t=R.operationId,i=k,s=E.pendingCommands?.find(l=>l.operation==="submit"&&(l.input.type==="paywall_confirm"||l.input.type==="paywall_cancel")&&l.input.operationId===t)??E.pendingCommand;s?.operation==="submit"&&(s.input.type==="paywall_confirm"||s.input.type==="paywall_cancel")&&s.input.operationId===t&&await E.settle?.(s.requestId);let h=await E.get(void 0,{receiptId:n,operationId:t});b();let a=D(h);if(a?.quote&&a.quote.operationId!==t||a?.operation&&a.operation.operationId!==t)throw new w("INVALID_RESPONSE","Purchase operation changed");let c=O(h,i,t)?g:a?.operation;if(!c)throw new w("INVALID_RESPONSE","The current purchase result is missing");return structuredClone(c)},destroy(){S=!0,V.abort(),j.clear(),$.clear()}}}async function Fe(E,F){let n=F,{mountScreenPreview:Z}=await import("./popup.js"),{showPaywall:te}=await import("./paywall-4XZ6NDMY.js"),m=E.ownerDocument,R=m.activeElement,g=m.createElement("section"),S=m.createElement("div"),V=m.createElement("div"),v=m.createElement("div"),k=m.createElement("button");v.hidden=!0,k.type="button";let U=m.createElement("p"),L=m.createElement("p"),T=m.createElement("button"),j=m.createElement("button"),$=m.createElement("button"),D=m.createElement("dialog");g.dataset.indianaFunnel="",g.setAttribute("aria-busy","false"),g.style.cssText="box-sizing:border-box;width:100%;min-width:0;font:14px/1.5 system-ui,sans-serif;color:#172033;background:#fff",V.style.cssText="display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:12px 20px",U.setAttribute("role","status"),L.setAttribute("role","alert"),L.hidden=!0,T.type=j.type=$.type="button",V.append(T,U,L,$,k,j),g.append(S,v,V),E.append(g);let b=null,O=null,z=null,x="",W="",K="",t="",i=!1,s=0,h=!1,a="",c=null,l=Promise.resolve(),P=null,N=null,M={},ie=new Map,ee=new Set,se=new Set,ae=new Set,oe=null,H={},C=!1,he,G=0,q=null,re="",le=new Map,ye=e=>e?`${e.id}:${e.nodeId}:${e.visit}:${e.revision}:${e.paywall?.quote?.operationId??""}`:"",J=(e,o=null)=>{i||(N=o,L.textContent=e instanceof Error?e.message:"Request failed",L.hidden=!1,$.hidden=n.client.pendingCommand===null,ne(n.onError,e))};function B(){let e=n.client.view;if(!e)throw new w("INVALID_REQUEST","No current Run is available");return{requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:e.revision}}async function Y(e,o=!1){if(!(s&&!o||i||(C||n.client.view?.recoveryRestricted)&&!o)){s++,g.setAttribute("aria-busy","true"),L.hidden=!0,N=null;try{if(!o&&oe){let r=n.client.view;await oe;let y=n.client.view;if(!r||!y||y.id!==r.id||y.nodeId!==r.nodeId||y.visit!==r.visit||y.stopped||!["running","waiting"].includes(y.status))throw new w("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}if(i)return;let d=await e();i||await X(n.client.view??d.run)}catch(d){J(d,n.client.pendingCommand?.requestId??null)}finally{s=Math.max(0,s-1),g.setAttribute("aria-busy",String(s>0)),i||($.hidden=n.client.pendingCommand===null,T.disabled=s>0||!!n.client.pendingCommand||!n.client.view?.canBack)}}}function ge(e){if(C||ee.has(e)||se.has(e)||i)return;se.add(e);let o=async()=>{if(C||i||x!==e){se.delete(e);return}if(s||n.client.pendingCommand){setTimeout(()=>{o()},250);return}let d=(async()=>{let y=n.client.view,p=B(),A=p.requestId,u=!1;try{await n.client.submit({operation:"shown",...p})}catch(I){if(!(I instanceof w)||I.code!=="CONFLICT"||I.status!==409||n.client.pendingCommand)throw I;await n.client.get();let f=n.client.view;if(i||C||x!==e||!f||!y||f.id!==y.id||f.source.versionId!==y.source.versionId||f.nodeId!==p.nodeId||f.visit!==p.visit||f.revision<=p.revision||f.stopped||!f.screen||!["running","waiting"].includes(f.status)||n.client.pendingCommand)throw I;let _=B();A=_.requestId,await n.client.submit({operation:"shown",..._})}for(;!i&&x===e&&n.client.pendingCommand?.requestId===A;){if(!n.client.settle)throw new w("COMMAND_PENDING","The original display acknowledgement is still pending");await n.client.settle(A),u=!0,n.client.pendingCommand?.requestId===A&&await new Promise(I=>setTimeout(I,1500))}i||x!==e||(u&&await n.client.get(),!(i||x!==e)&&ee.add(e))})();oe=d;let r=()=>{oe===d&&(oe=null),se.delete(e)};d.then(r,y=>{r(),s||J(y)})};o()}function ue(){c&&clearTimeout(c),!(i||!z||!["running","waiting"].includes(z.status)&&!n.client.pendingCommand)&&(c=setTimeout(()=>{c=null,Ie().finally(ue)},z.pendingRequest||n.client.pendingCommand?1500:5e3))}async function Ie(){if(!(i||h||s)){if(C){await ce(he);return}h=!0;try{let e=n.client.pendingCommand;e&&n.client.settle&&await n.client.settle(e.requestId);let o=n.client.view,d=M,r=await n.client.get(o?.screen&&Object.keys(d).length?{nodeId:o.nodeId,visit:o.visit,revision:o.revision,components:d}:void 0);!i&&d===M&&await X(n.client.view??r.run)}catch(e){J(e)}finally{h=!1}}}async function Ee(e){let o=n.client.view,d=o?.screen,r=d?.customerData.nodes[e.nodeId];if(i||s||!o||!d||!r)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(e.action)){let _=b?.document,Q=_?Ce(_,e.nodeId):null,we=Q?.type==="customer_data"?Q.data.outputs?.[e.action]:void 0;we&&d.outputs.includes(we)?await Y(()=>n.client.submit({operation:"submit",...B(),input:{type:"screen",output:we,answers:H,selection:e.value?{[e.nodeId]:e.value}:{}}})):await n.onCustomerDataIntent?.(e,o);return}let p=e.action.startsWith("sources_")?r.resources.find(_=>_.key===e.value):null;if(e.action.startsWith("sources_")&&!p)throw new w("INVALID_REQUEST","Choose a current resource");let A=`${o.visit}:${e.nodeId}:${p?.key??""}`,u=ie.get(A)??[null],f=M[e.nodeId]??{page:1,after:null,filter:"all",...p?{resourceKey:p.key}:{}};if(e.action==="filter"){let _=e.value;if(!_||!(r.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(_))throw new w("INVALID_REQUEST","Unknown data filter");f={page:1,after:null,filter:_},u.splice(0,u.length,null)}else if(e.action==="next"||e.action==="sources_next"){let _=p?.sources.at(-1),Q=p?_?{kind:"ledger",cursor:{at:_.detail[0],id:_.id,type:"source"}}:null:d.dataCursors[e.nodeId];if(!Q||!p&&!r.hasNext)return;u[f.page]=Q,f={...f,page:f.page+1,after:Q}}else if(e.action==="previous"||e.action==="sources_previous"){if(f.page<=1)return;f={...f,page:f.page-1,after:u[f.page-2]??null}}ie.set(A,u),M={...M,[e.nodeId]:f},await Y(()=>n.client.get({nodeId:o.nodeId,visit:o.visit,revision:o.revision,components:M}))}function Re(e){let o=e.screen?.presentation;if(!o||o.type==="inline"){D.open&&D.close(),g.parentElement!==E&&E.append(g);return}g.parentElement!==D&&(D.append(g),E.append(D));let d={sm:420,md:640,lg:900};D.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${"size"in o?d[o.size]+"px":"100vw"}`,D.setAttribute("aria-label",b?.document?.name??e.screen?.content.document.name??"Funnel"),D.open||D.showModal()}async function De(e){if(i)return;z=e,N&&n.client.pendingCommand?.requestId!==N&&(L.hidden=!0,N=null);let o=e.locale.startsWith("zh");if(k.textContent=o?"\u56DE\u770B":"History",k.hidden=!n.client.review,T.textContent=C?o?"\u8FD4\u56DE\u5F53\u524D":"Return to current":o?"\u8FD4\u56DE":"Back",j.textContent=o?"\u5173\u95ED":"Close",$.textContent=o?"\u91CD\u8BD5":"Retry",T.disabled=!C&&(s>0||!!n.client.pendingCommand||!e.canBack),$.hidden=n.client.pendingCommand===null,U.textContent=e.pendingRequest?o?"\u6B63\u5728\u5904\u7406":"Processing":e.instruction?.type==="wait"?o?"\u7B49\u5F85\u4E2D":"Waiting":"",a!==`${e.revision}:${e.visit}:${e.status}:${e.stopped}`&&(a=`${e.revision}:${e.visit}:${e.status}:${e.stopped}`,ne(n.onState,structuredClone(e))),e.stopped||n.client.configurationReady===!1){C=!1,G++,q?.destroy(),q=null,v.replaceChildren(),v.hidden=!0,S.hidden=!1,b?.destroy(),b=null,O?.destroy(),O=null,S.replaceChildren(),x="",W="",t="",D.open&&D.close(),g.hidden=!0,ue();return}if(g.hidden=!1,C){ue();return}if(e.recoveryRestricted){b?.destroy(),b=null,O?.destroy(),O=null,S.replaceChildren(),x="",U.textContent=o?"\u539F\u8BB0\u5F55\u9700\u8981\u6838\u5BF9\uFF0C\u53EF\u53EA\u8BFB\u56DE\u770B":"Original records require reconciliation; read-only history is available";return}let d=e.screen||e.paywall?`${e.id}:${e.nodeId}:${e.visit}`:"";if(d!==x&&(b?.destroy(),b=null,O?.destroy(),O=null,S.replaceChildren(),x=d,W="",t="",H={...e.answers},M={},ie.clear()),Re(e),e.screen){let y=e.screen.content;b||(b=Z(S,{mode:"live",rendererUrl:n.client.webViewUrl,title:y.document.name,onAction(u,I={},f={}){if(C)return;H={...H,...f};let _=Object.fromEntries((e.screen?.inputs??[]).filter(({variable:Q})=>Object.hasOwn(H,Q)).map(({variable:Q})=>[Q,H[Q]]));Y(()=>n.client.submit({operation:"submit",...B(),input:{type:"screen",output:u,answers:_,selection:I}}))},onAnswers:u=>{C||(H={...H,...u})},onCustomerDataIntent:u=>{C||Ee(u).catch(J)},onEscape:()=>{C||de()},onError:u=>J(new Error(u)),onRendered:()=>ge(d)}));let p={capabilities:e.screen.capabilities,customerData:e.screen.customerData,parameters:e.parameters,serverInput:{bindings:e.screen.inputs,answers:H,values:e.screen.values}},A=JSON.stringify([y,e.locale,p.parameters,e.screen.inputs,e.screen.values]);if(A!==W)b.update(y.document,e.locale,p),W=A,K=JSON.stringify(p.capabilities),t=JSON.stringify(p.customerData);else{let u=JSON.stringify(p.capabilities);u!==K&&(b.updateCapabilities(p.capabilities),K=u),JSON.stringify(p.customerData)!==t&&(b.updateCustomerData(p.customerData),t=JSON.stringify(p.customerData))}await b.ready}else if(e.paywall&&!O){let y=await te(S,{canInteract:()=>!C&&!i&&!n.client.view?.recoveryRestricted,start:async()=>be(n.client),onPurchase:n.onPurchase,onCheckoutUrl:n.onCheckoutUrl,resolveOfferId:n.resolveOfferId,onEvent:n.onEvent,onOpenUrl:p=>n.onOpenUrl?n.onOpenUrl({receiptId:e.paywall.receiptId,url:p,openIn:"same_window"}):m.defaultView?.location.assign(p),onAction:async p=>{if(C)return;let A=await n.client.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:e.nodeId,visit:e.visit,revision:e.revision,input:{type:"screen",output:p,answers:{}}});await X(n.client.view??A.run)},onError:J,onDismiss:()=>{!C&&!i&&n.client.view?.visit===e.visit&&de()}});i?y.host?.destroy():(O=y.host,O?.setSuspended(C)),ge(d)}let r=e.instruction;if(r&&(r.type==="open_url"||r.type==="event")&&!ae.has(r.receiptId)){let y=m.createElement("button");y.type="button",y.textContent=r.type==="open_url"?`${o?"\u524D\u5F80":"Continue to"} ${new URL(r.url).host}`:o?"\u7EE7\u7EED":"Continue",y.onclick=()=>{let p=B(),A=r.type==="open_url"&&!n.onOpenUrl&&r.openIn==="new_window"?Pe(r.url):null;Y(async()=>{let u="success";if(r.type==="open_url")if(n.onOpenUrl)try{u=await n.onOpenUrl({receiptId:r.receiptId,url:r.url,openIn:r.openIn})===!1?"failed":"opened"}catch(f){ne(n.onError,f),u="failed"}else u=r.openIn==="new_window"&&!A?"failed":"opened";if(r.type==="event"){if(!n.onEvent)throw new w("EVENT_HANDLER_REQUIRED","Provide the event handler");await n.onEvent(r.event)}if(i||n.client.view?.nodeId!==p.nodeId||n.client.view.visit!==p.visit)throw new w("PRECONDITION_FAILED","The client action visit changed");let I=await n.client.submit({operation:"submit",...p,input:{type:"client_action",receiptId:r.receiptId,outcome:u}});return ae.add(r.receiptId),r.type==="open_url"&&!n.onOpenUrl&&r.openIn==="same_window"&&m.defaultView?.location.assign(r.url),I})},S.replaceChildren(y)}!e.pendingRequest&&e.status==="completed"&&!ae.has(`complete:${e.id}`)&&(ae.add(`complete:${e.id}`),ne(n.onComplete,structuredClone(e))),ue()}function Pe(e){let o=m.defaultView?.open(e,"_blank")??null;return o&&(o.opener=null),o}function X(e){return l=l.catch(()=>{}).then(()=>De(e)),l}async function ce(e){if(i||!n.client.review)return;C||(re=ye(n.client.view),le.set(re,structuredClone(H))),C=!0,he=e,S.hidden=!0,O?.setSuspended(!0),v.hidden=!1;let o=++G;try{let d=await n.client.review(e);if(i||o!==G||!C)return;if(!d.review)throw new w("INVALID_RESPONSE","Historical projection is missing");q?.destroy(),q=null,v.replaceChildren();let r=d.run.locale.startsWith("zh"),y=m.createElement("p");y.textContent=r?"\u53EA\u8BFB\u56DE\u770B":"Read-only history",v.append(y);for(let[u,I]of d.review.pages.entries()){let f=m.createElement("button");f.type="button",f.textContent=r?`\u7B2C ${u+1} \u9875`:`Page ${u+1}`,f.onclick=()=>{ce(I.receiptId)},v.append(f)}if(d.review.page){let u=d.review.page,I=m.createElement("div");if(I.inert=!0,v.append(I),q=Z(I,{mode:"live",rendererUrl:n.client.webViewUrl,title:u.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{},onEscape:()=>{fe()}}),q.update(u.document,d.run.locale,{serverInput:{bindings:u.inputs,answers:u.answers,values:u.values}}),await q.ready,i||o!==G||!C)return}let p=r?{issued:"\u5DF2\u9886\u53D6",reserved:"\u5DF2\u9884\u7559",redeemed:"\u5DF2\u4F7F\u7528",expired:"\u5DF2\u8FC7\u671F",revoked:"\u5DF2\u64A4\u9500",unknown:"\u72B6\u6001\u5F85\u786E\u8BA4"}:{issued:"Issued",reserved:"Reserved",redeemed:"Used",expired:"Expired",revoked:"Revoked",unknown:"Status unconfirmed"},A=r?{pending:"\u5904\u7406\u4E2D",complete:"\u5DF2\u5B8C\u6210",cancelled:"\u5DF2\u53D6\u6D88",failed:"\u5931\u8D25",unknown:"\u72B6\u6001\u5F85\u786E\u8BA4"}:{pending:"Processing",complete:"Completed",cancelled:"Cancelled",failed:"Failed",unknown:"Status unconfirmed"};for(let u of[...d.review.coupons.map((I,f)=>`${r?"\u4F18\u60E0\u5238":"Coupon"} ${f+1}: ${p[I.status]}`),...d.review.purchases.map((I,f)=>`${r?"\u8D2D\u4E70":"Purchase"} ${f+1}: ${A[I.status]}`)]){let I=m.createElement("p");I.textContent=u,v.append(I)}n.client.view&&await X(n.client.view)}catch(d){if(o!==G||i)return;q?.destroy(),q=null,v.replaceChildren(),J(d)}}async function fe(){if(!C||i||!n.client.review)return;let e=++G;try{if(await n.client.review(),i||e!==G)return;C=!1,G++,q?.destroy(),q=null,v.replaceChildren(),v.hidden=!0,S.hidden=!1;let o=n.client.view;ye(o)!==re?(le.set(re,structuredClone(H)),x="",W=""):(le.delete(re),O?.setSuspended(!1)),o&&await X(o)}catch(o){if(e!==G||i)return;q?.destroy(),q=null,v.replaceChildren(),J(o)}}let Ne=n.client.subscribe(e=>{n.client.configurationReady===!1&&(g.hidden=!0,b?.destroy(),b=null,O?.destroy(),O=null,S.replaceChildren(),x="",W="",t="",D.open&&D.close()),X(e).catch(J)}),Oe=n.client.subscribeError?.(J);function de(){return P||(i?Promise.resolve():n.client.view&&!["running","waiting"].includes(n.client.view.status)?(pe(),Promise.resolve()):(P=Y(()=>n.client.submit({operation:"close",...B()}),!0).then(()=>{n.client.view?.status==="closed"&&pe()}).finally(()=>{P=null}),P))}function pe(){i||(i=!0,c&&clearTimeout(c),Ne(),Oe?.(),b?.destroy(),G++,q?.destroy(),O?.destroy(),D.close(),D.remove(),g.remove(),R instanceof HTMLElement&&R.isConnected&&R.focus(),ne(n.onDismiss,z?structuredClone(z):null))}T.onclick=()=>{if(C){fe();return}Y(()=>n.client.submit({operation:"back",...B()}))},k.onclick=()=>{ce()},j.onclick=()=>{de()},$.onclick=()=>{Y(()=>n.client.retry())},D.addEventListener("cancel",e=>{e.preventDefault(),de()});try{let e=await n.client.get();await X(n.client.view??e.run)}catch(e){throw pe(),e}return{destroy:pe,refresh:Ie,review:ce,exitReview:fe,get unappliedDrafts(){return new Map([...le].map(([e,o])=>[e,structuredClone(o)]))}}}export{Fe as showFunnelRun};
|
|
@@ -2,46 +2,9 @@ import * as zod from 'zod';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { O as OfferingItem, I as InvoiceModeParams, e as InvoiceModeParamsInput, A as ApiInput, F as FoundationApi } from './ai-usage-B4W5m4Ie.js';
|
|
4
4
|
import { S as StackNode, d as ScreenSelection } from './screen-16d-xADb.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
declare const scopeSchema: z.ZodObject<{
|
|
9
|
-
projectId: z.ZodString;
|
|
10
|
-
environment: z.ZodEnum<{
|
|
11
|
-
sandbox: "sandbox";
|
|
12
|
-
live: "live";
|
|
13
|
-
}>;
|
|
14
|
-
}, z.core.$strict>;
|
|
15
|
-
type Scope = z.infer<typeof scopeSchema>;
|
|
16
|
-
|
|
17
|
-
declare const errorRecoverySchema: z.ZodEnum<{
|
|
18
|
-
fix_request: "fix_request";
|
|
19
|
-
authenticate: "authenticate";
|
|
20
|
-
check_permissions: "check_permissions";
|
|
21
|
-
check_scope: "check_scope";
|
|
22
|
-
resolve_conflict: "resolve_conflict";
|
|
23
|
-
reload_state: "reload_state";
|
|
24
|
-
retry_same_request: "retry_same_request";
|
|
25
|
-
configure_integration: "configure_integration";
|
|
26
|
-
check_availability: "check_availability";
|
|
27
|
-
upgrade_sdk: "upgrade_sdk";
|
|
28
|
-
recover_operation: "recover_operation";
|
|
29
|
-
contact_support: "contact_support";
|
|
30
|
-
}>;
|
|
31
|
-
type ErrorRecovery = z.infer<typeof errorRecoverySchema>;
|
|
32
|
-
/** Safe business reasons; never SQL text, resource IDs or provider responses. */
|
|
33
|
-
declare const errorReasonSchema: z.ZodEnum<{
|
|
34
|
-
CAPABILITY_NOT_ENABLED: "CAPABILITY_NOT_ENABLED";
|
|
35
|
-
INTEGRATION_MISSING: "INTEGRATION_MISSING";
|
|
36
|
-
PROVIDER_CREDENTIAL_REJECTED: "PROVIDER_CREDENTIAL_REJECTED";
|
|
37
|
-
PRICE_BINDING_REQUIRED: "PRICE_BINDING_REQUIRED";
|
|
38
|
-
IDEMPOTENCY_CONFLICT: "IDEMPOTENCY_CONFLICT";
|
|
39
|
-
RESULT_UNKNOWN: "RESULT_UNKNOWN";
|
|
40
|
-
STATE_CHANGED: "STATE_CHANGED";
|
|
41
|
-
OPERATION_IN_PROGRESS: "OPERATION_IN_PROGRESS";
|
|
42
|
-
FUNNEL_VERSION_RETIRED: "FUNNEL_VERSION_RETIRED";
|
|
43
|
-
}>;
|
|
44
|
-
type ErrorReason = z.infer<typeof errorReasonSchema>;
|
|
5
|
+
import { S as Scope, I as IndianaError } from './errors-DrdTlPwf.js';
|
|
6
|
+
import { E as EvaluationContext, J as JsonValue, F as FeatureResult, s as stickyAssignmentDocumentSchema } from './growth-rules-B4YYy64R.js';
|
|
7
|
+
import { C as ConfigurationSync } from './configuration-sync-C2mytNwU.js';
|
|
45
8
|
|
|
46
9
|
declare const currencySchema: z.ZodEnum<{
|
|
47
10
|
USD: "USD";
|
|
@@ -6682,6 +6645,8 @@ declare const evaluateFeaturesResultSchema: z.ZodObject<{
|
|
|
6682
6645
|
}, z.core.$strict>>;
|
|
6683
6646
|
}, z.core.$strict>;
|
|
6684
6647
|
|
|
6648
|
+
type FunnelNodeEvaluationContext = Pick<EvaluationContext, "attributes" | "stickyBucketAssignmentDocs" | "saveStickyBucketAssignmentDoc" | "onFeatureUsage" | "onExperimentViewed">;
|
|
6649
|
+
|
|
6685
6650
|
declare const funnelPendingEntrySchema: z.ZodObject<{
|
|
6686
6651
|
schemaVersion: z.ZodLiteral<1>;
|
|
6687
6652
|
scope: z.ZodObject<{
|
|
@@ -8112,22 +8077,6 @@ interface FunnelCommandStorage {
|
|
|
8112
8077
|
write(expectedRevision: number, entry: FunnelPendingEntry | null): Promise<number | null>;
|
|
8113
8078
|
}
|
|
8114
8079
|
|
|
8115
|
-
declare class IndianaError extends Error {
|
|
8116
|
-
readonly code: string;
|
|
8117
|
-
readonly status?: number | undefined;
|
|
8118
|
-
readonly requestId?: string | undefined;
|
|
8119
|
-
readonly retryable: boolean;
|
|
8120
|
-
readonly recovery: ErrorRecovery;
|
|
8121
|
-
readonly retryAfterSeconds?: number;
|
|
8122
|
-
readonly reason?: ErrorReason;
|
|
8123
|
-
constructor(code: string, message: string, status?: number | undefined, requestId?: string | undefined, metadata?: {
|
|
8124
|
-
retryable?: boolean;
|
|
8125
|
-
recovery?: ErrorRecovery;
|
|
8126
|
-
retryAfterSeconds?: number;
|
|
8127
|
-
reason?: ErrorReason;
|
|
8128
|
-
});
|
|
8129
|
-
}
|
|
8130
|
-
|
|
8131
8080
|
interface IndianaOptions {
|
|
8132
8081
|
/** Override the per-Run CAS adapter. Secure browser hosts use Web Locks/localStorage by default; non-browser hosts supply their own adapter. */
|
|
8133
8082
|
funnelCommandStorage?: FunnelCommandStorage;
|
|
@@ -8527,7 +8476,6 @@ declare function createFeatureClient(options: FeatureClientOptions): {
|
|
|
8527
8476
|
};
|
|
8528
8477
|
type FeatureClient = ReturnType<typeof createFeatureClient>;
|
|
8529
8478
|
|
|
8530
|
-
type FunnelNodeEvaluationContext = Pick<EvaluationContext, "attributes" | "stickyBucketAssignmentDocs" | "saveStickyBucketAssignmentDoc" | "onFeatureUsage" | "onExperimentViewed">;
|
|
8531
8479
|
/** Pure rule evaluation, never a command or permission to perform a commercial action. No network I/O. */
|
|
8532
8480
|
declare function evaluateFunnelNode(configuration: FunnelConfiguration, nodeId: string, input: FunnelNodeEvaluationContext): {
|
|
8533
8481
|
nodeId: string;
|
|
@@ -9702,6 +9650,24 @@ declare function createLocalFunnelClient(options: LocalFunnelClientOptions): Pro
|
|
|
9702
9650
|
failed: string;
|
|
9703
9651
|
id: string;
|
|
9704
9652
|
name: string;
|
|
9653
|
+
appManifest?: {
|
|
9654
|
+
versionId: string;
|
|
9655
|
+
manifestDigest: string;
|
|
9656
|
+
sourceGraphDigest: string;
|
|
9657
|
+
pageKey: string;
|
|
9658
|
+
stateKey: string;
|
|
9659
|
+
documentKey: string;
|
|
9660
|
+
documentHash: string;
|
|
9661
|
+
elementKey?: string | undefined;
|
|
9662
|
+
nodeId?: string | undefined;
|
|
9663
|
+
contentHash?: string | undefined;
|
|
9664
|
+
renderKey?: string | undefined;
|
|
9665
|
+
observed?: {
|
|
9666
|
+
versionId: string;
|
|
9667
|
+
sha256: string;
|
|
9668
|
+
contentHash: string;
|
|
9669
|
+
} | undefined;
|
|
9670
|
+
} | undefined;
|
|
9705
9671
|
position?: {
|
|
9706
9672
|
x: number;
|
|
9707
9673
|
y: number;
|
|
@@ -18776,6 +18742,24 @@ declare function createLocalFunnelClient(options: LocalFunnelClientOptions): Pro
|
|
|
18776
18742
|
failed: string;
|
|
18777
18743
|
id: string;
|
|
18778
18744
|
name: string;
|
|
18745
|
+
appManifest?: {
|
|
18746
|
+
versionId: string;
|
|
18747
|
+
manifestDigest: string;
|
|
18748
|
+
sourceGraphDigest: string;
|
|
18749
|
+
pageKey: string;
|
|
18750
|
+
stateKey: string;
|
|
18751
|
+
documentKey: string;
|
|
18752
|
+
documentHash: string;
|
|
18753
|
+
elementKey?: string | undefined;
|
|
18754
|
+
nodeId?: string | undefined;
|
|
18755
|
+
contentHash?: string | undefined;
|
|
18756
|
+
renderKey?: string | undefined;
|
|
18757
|
+
observed?: {
|
|
18758
|
+
versionId: string;
|
|
18759
|
+
sha256: string;
|
|
18760
|
+
contentHash: string;
|
|
18761
|
+
} | undefined;
|
|
18762
|
+
} | undefined;
|
|
18779
18763
|
position?: {
|
|
18780
18764
|
x: number;
|
|
18781
18765
|
y: number;
|
|
@@ -30917,4 +30901,4 @@ declare function createFunnelStartClient(options: IndianaServerOptions): {
|
|
|
30917
30901
|
}>;
|
|
30918
30902
|
};
|
|
30919
30903
|
|
|
30920
|
-
export { type
|
|
30904
|
+
export { type IndianaServerOptions as A, createFunnelCampaignClient as B, createFunnelDecisionClient as C, createFunnelLocalEvaluator as D, createFunnelOrchestrationClient as E, type FunnelRuntimeResponse as F, createFunnelStartClient as G, createGuestToken as H, type IndianaOptions as I, createIndianaServer as J, createNativeReceiptClient as K, type LocalFunnelClient as L, createPaywallStartClient as M, createSynchronizedFunnelLocalEvaluator as N, renewFunnelRun as O, type PaywallSession as P, type RemoteFeatureResult as R, type SubscriptionOperation as S, type FunnelRunView as a, type FunnelCommand as b, type FunnelPurchaseRecovery as c, type FunnelDataQueries as d, type FeatureClientOptions as e, type FunnelCommandStorage as f, type FunnelStartInput as g, type FeatureClient as h, type FunnelNodeEvaluationContext as i, type FunnelPendingEntry as j, type LocalFunnelClientOptions as k, type PaywallPurchaseInput as l, type PaywallStartInput as m, createFeatureClient as n, createLocalFunnelClient as o, createPaywallSession as p, evaluateFunnelNode as q, type FunnelDecisionInput as r, FunnelDecisionTimeoutError as s, type FunnelDecisionUsedInput as t, type FunnelLocalEvaluation as u, type FunnelLocalEvaluator as v, type FunnelLocalEvaluatorOptions as w, type FunnelLocalSession as x, type FunnelLocalSessionOptions as y, type FunnelSignalInput as z };
|
package/dist/iam.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import * as zod_mini from 'zod/mini';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const captureSnapshotSchema: zod_mini.ZodMiniObject<{
|
|
5
|
+
format: z.ZodLiteral<"indiana-runtime-snapshot">;
|
|
6
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
7
|
+
collector: zod_mini.ZodMiniObject<{
|
|
8
|
+
name: z.ZodLiteral<"indiana-bounded-dom">;
|
|
9
|
+
version: z.ZodLiteral<2>;
|
|
10
|
+
buildSha256: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
sourceVersionId: z.ZodUUID;
|
|
13
|
+
manifestDigest: z.ZodString;
|
|
14
|
+
pageKey: z.ZodString;
|
|
15
|
+
routeTemplate: z.ZodString;
|
|
16
|
+
sequence: z.ZodNumber;
|
|
17
|
+
label: z.ZodString;
|
|
18
|
+
viewport: zod_mini.ZodMiniObject<{
|
|
19
|
+
width: z.ZodNumber;
|
|
20
|
+
height: z.ZodNumber;
|
|
21
|
+
dpr: z.ZodNumber;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
privacy: z.ZodLiteral<"masked-default-v2">;
|
|
24
|
+
contentHash: z.ZodString;
|
|
25
|
+
previousContentHash: z.ZodNullable<z.ZodString>;
|
|
26
|
+
document: zod_mini.ZodMiniObject<{
|
|
27
|
+
nodes: z.ZodArray<zod_mini.ZodMiniObject<{
|
|
28
|
+
id: z.ZodNumber;
|
|
29
|
+
parentId: z.ZodNullable<z.ZodNumber>;
|
|
30
|
+
kind: z.ZodEnum<{
|
|
31
|
+
text: "text";
|
|
32
|
+
element: "element";
|
|
33
|
+
}>;
|
|
34
|
+
tag: z.ZodNullable<z.ZodString>;
|
|
35
|
+
text: z.ZodNullable<z.ZodString>;
|
|
36
|
+
attributes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
37
|
+
shadow: z.ZodBoolean;
|
|
38
|
+
}, z.core.$strict>>;
|
|
39
|
+
css: z.ZodString;
|
|
40
|
+
shadowCss: z.ZodArray<zod_mini.ZodMiniObject<{
|
|
41
|
+
hostId: z.ZodNumber;
|
|
42
|
+
css: z.ZodString;
|
|
43
|
+
}, z.core.$strict>>;
|
|
44
|
+
scroll: zod_mini.ZodMiniObject<{
|
|
45
|
+
x: z.ZodNumber;
|
|
46
|
+
y: z.ZodNumber;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
gaps: z.ZodArray<z.ZodString>;
|
|
50
|
+
metrics: zod_mini.ZodMiniObject<{
|
|
51
|
+
maxSliceMs: z.ZodNumber;
|
|
52
|
+
totalWorkMs: z.ZodNumber;
|
|
53
|
+
elapsedMs: z.ZodNumber;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
type CaptureSnapshot = z.infer<typeof captureSnapshotSchema>;
|
|
57
|
+
|
|
58
|
+
declare class CaptureRefusal extends Error {
|
|
59
|
+
code: string;
|
|
60
|
+
metrics?: {
|
|
61
|
+
maxSliceMs: number;
|
|
62
|
+
totalWorkMs: number;
|
|
63
|
+
elapsedMs: number;
|
|
64
|
+
phase: string;
|
|
65
|
+
} | undefined;
|
|
66
|
+
constructor(code: string, metrics?: {
|
|
67
|
+
maxSliceMs: number;
|
|
68
|
+
totalWorkMs: number;
|
|
69
|
+
elapsedMs: number;
|
|
70
|
+
phase: string;
|
|
71
|
+
} | undefined);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type Metrics = NonNullable<CaptureRefusal["metrics"]>;
|
|
75
|
+
type CaptureOptions = {
|
|
76
|
+
/** Trusted merchant configuration, never copied from the incoming capability. */
|
|
77
|
+
environmentId: string;
|
|
78
|
+
grant: string;
|
|
79
|
+
baseUrl: string;
|
|
80
|
+
document?: Document;
|
|
81
|
+
signal?: AbortSignal;
|
|
82
|
+
onStatus?: (status: {
|
|
83
|
+
state: "idle" | "capturing" | "uploading" | "waiting" | "paused" | "stopped";
|
|
84
|
+
reason?: string;
|
|
85
|
+
snapshots: number;
|
|
86
|
+
pending: number;
|
|
87
|
+
metrics?: Metrics;
|
|
88
|
+
expiresAt?: number;
|
|
89
|
+
}) => void;
|
|
90
|
+
/** A reviewed local transport must honor cancellation. The default uses capability-only HTTP. */
|
|
91
|
+
transport?: (snapshot: CaptureSnapshot, bytes: Uint8Array, signal: AbortSignal, requestId: string) => Promise<void>;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
declare function installCaptureActivation(options: {
|
|
95
|
+
baseUrl: string;
|
|
96
|
+
environmentId: string;
|
|
97
|
+
controls?: boolean;
|
|
98
|
+
nonce?: string;
|
|
99
|
+
document?: Document;
|
|
100
|
+
prepare?: () => Promise<void>;
|
|
101
|
+
onStatus?: (status: {
|
|
102
|
+
state: string;
|
|
103
|
+
reason?: string;
|
|
104
|
+
snapshots: number;
|
|
105
|
+
}) => void;
|
|
106
|
+
onAuthoringChange?: (active: boolean) => void;
|
|
107
|
+
}): {
|
|
108
|
+
destroy(): void;
|
|
109
|
+
checkpoint(_label?: string): void;
|
|
110
|
+
retry(): void;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** Optional post-build release descriptor. Keeps bundler CSS output out of a digest/rebuild cycle. */
|
|
114
|
+
declare function loadAppManifestRelease(path: string, document: Document, signal: AbortSignal): Promise<string>;
|
|
115
|
+
|
|
116
|
+
declare function installAppManifestRelease(release: string, target?: Document): {
|
|
117
|
+
attributes: {
|
|
118
|
+
indianaAppManifestRelease: string;
|
|
119
|
+
};
|
|
120
|
+
destroy(): void;
|
|
121
|
+
};
|
|
122
|
+
/** Lazy, explicitly authorized runtime collection; ordinary visitors do not load the recorder. */
|
|
123
|
+
declare function startAppManifestCapture(options: CaptureOptions): Promise<{
|
|
124
|
+
checkpoint(nextLabel?: string): void;
|
|
125
|
+
retry(): void;
|
|
126
|
+
destroy: (reason?: string) => void;
|
|
127
|
+
readonly paused: boolean;
|
|
128
|
+
readonly snapshots: number;
|
|
129
|
+
}>;
|
|
130
|
+
|
|
131
|
+
export { type CaptureOptions, installAppManifestRelease, installCaptureActivation, loadAppManifestRelease, startAppManifestCapture };
|
package/dist/iam.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"./chunk-VVSQKVE7.js";import"./chunk-4K25DELJ.js";export{c as installAppManifestRelease,a as installCaptureActivation,b as loadAppManifestRelease,d as startAppManifestCapture};
|