@tinkerlandai/indiana-sdk 0.9.5 → 0.10.2

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +30 -41
  3. package/README.zh-CN.md +24 -22
  4. package/dist/{ai-usage-CUTIHAU0.d.ts → ai-usage-Cn7dhvFw.d.ts} +3 -3
  5. package/dist/{api-BXu6TAoB.d.ts → api-DC44FaTV.d.ts} +6354 -904
  6. package/dist/chunk-ACF2FBUB.js +1 -0
  7. package/dist/{chunk-XSOEA4A5.js → chunk-CWHJKWOD.js} +1 -1
  8. package/dist/chunk-EARSGITJ.js +1 -0
  9. package/dist/chunk-FYGXGMRB.js +1 -0
  10. package/dist/chunk-GHJ65ILJ.js +1 -0
  11. package/dist/chunk-JPV7F5XI.js +1 -0
  12. package/dist/{chunk-AOGPGUWE.js → chunk-LCLCG2I2.js} +1 -1
  13. package/dist/chunk-Q64VNSPV.js +6 -0
  14. package/dist/chunk-SBPTOOYB.js +1 -0
  15. package/dist/{chunk-MKV726FV.js → chunk-V3RAOCVQ.js} +1 -1
  16. package/dist/chunk-VZVUZWP2.js +1 -0
  17. package/dist/{chunk-M7JWCLYX.js → chunk-X6BCUINI.js} +1 -1
  18. package/dist/{chunk-4C3HUZ3B.js → chunk-XO42OH3M.js} +1 -1
  19. package/dist/{configuration-sync-DuJl4SbM.d.ts → configuration-sync-CywDxRkX.d.ts} +12 -12
  20. package/dist/{content-PQJYLAGQ.js → content-QM75T7JO.js} +1 -1
  21. package/dist/{funnel-local-client-BhHdi5_V.d.ts → funnel-local-client-DXamAj1-.d.ts} +18475 -2597
  22. package/dist/funnel-node-evaluation-P5B4fPfJ.d.ts +2054 -0
  23. package/dist/{funnel-resource-client-BoIhL_my.d.ts → funnel-resource-client-md62M8Rv.d.ts} +5977 -1126
  24. package/dist/funnel-runtime-host-BJZUVJAI.js +1 -0
  25. package/dist/index.d.ts +9924 -1958
  26. package/dist/index.js +1 -1
  27. package/dist/native-shell.js +1 -1
  28. package/dist/openrouter.d.ts +3 -3
  29. package/dist/openrouter.js +1 -1
  30. package/dist/page.d.ts +4 -4
  31. package/dist/page.js +1 -1
  32. package/dist/paywall-527RPFAX.js +1 -0
  33. package/dist/popup.d.ts +1 -1
  34. package/dist/popup.js +1 -1
  35. package/dist/react-native.d.ts +19930 -7179
  36. package/dist/react-native.js +1 -1
  37. package/dist/{screen-renderer-VAMWY7ID.js → screen-renderer-ZSAR7LPS.js} +1 -1
  38. package/dist/server.d.ts +2737 -573
  39. package/dist/server.js +1 -1
  40. package/dist/visual.d.ts +1 -1
  41. package/dist/visual.js +1 -1
  42. package/package.json +2 -2
  43. package/dist/chunk-5ZWSFE2C.js +0 -1
  44. package/dist/chunk-6ZZUNGNE.js +0 -1
  45. package/dist/chunk-HEGNIATD.js +0 -1
  46. package/dist/chunk-LMO3FXRT.js +0 -1
  47. package/dist/chunk-QYECMZJJ.js +0 -1
  48. package/dist/chunk-UBMPFTGE.js +0 -1
  49. package/dist/chunk-UWFYBRM2.js +0 -6
  50. package/dist/chunk-XRXI3DMZ.js +0 -1
  51. package/dist/funnel-node-evaluation-DuPmqIo1.d.ts +0 -998
  52. package/dist/funnel-runtime-host-3YUGXD3Y.js +0 -1
  53. package/dist/paywall-CSAGKPCP.js +0 -1
  54. package/dist/{screen-CvfI_L41.d.ts → screen-D81zCpfi.d.ts} +2 -2
@@ -1 +1 @@
1
- import{b as P,c as R}from"./chunk-QYECMZJJ.js";import{b as x,l as E,m as A,n as O,p as T}from"./chunk-UBMPFTGE.js";import"./chunk-5ZWSFE2C.js";import{ja as S}from"./chunk-UWFYBRM2.js";import{oa as a}from"./chunk-HEGNIATD.js";import{a as C}from"./chunk-G56XGVMS.js";import"./chunk-LMO3FXRT.js";import"./chunk-7DXL3LHT.js";import"./chunk-3PZ4Y6UD.js";function k(t,l){let n,r=0,d=-1,u,i=!1,v=()=>{if(i)throw new a("CLOSED","Native host was destroyed");if(!t.nativeModule)throw new a("CAPABILITY_UNAVAILABLE","Link IndianaBridge and supply nativeModule");return t.nativeModule},p=()=>new a("IDENTITY_CHANGED","Customer identity changed during the native operation"),I=l.subscribeIdentity(()=>{r++,d=-1;let e=r;n&&t.nativeModule&&n.then(o=>t.nativeModule.reset(o,e)).catch(()=>{})}),y=t.nativeEvents?.(e=>{!n||!t.nativeModule||typeof e?.requestId!="string"||(async()=>{let o=await n;if(e.instanceId!==o)return;if(e.kind==="credential"){let w=r,f=null;try{if(!i&&e.revision===w){let N=await l.access();!i&&r===w&&(f=N)}}finally{await t.nativeModule.provideCredential(o,e.requestId,f)}return}let s=!1,c=r;try{if(i||e.revision!==c||!t.onNativeAction)throw p();await t.onNativeAction(e.action),s=!i&&r===c}finally{await t.nativeModule.acknowledge(o,e.requestId,s)}})().catch(()=>{})});async function m(e,o={}){let s=v();if(l.snapshot()&&!t.nativeEvents)throw new a("CAPABILITY_UNAVAILABLE","Supply nativeEvents to share credential refresh with the native host");let c=r,w=await l.access();if(i||r!==c)throw p();if(!n){let g=s.create(JSON.stringify({baseUrl:t.baseUrl??"https://api.tinker.cash",scope:t.scope,timeout:(t.timeoutMs??15e3)/1e3,credentialEvents:!!t.nativeEvents}));n=g,g.catch(()=>{n===g&&(n=void 0)})}let f=await n;if(i||r!==c)throw p();if(d!==c){if(!u||u.epoch!==c){let b=(async()=>{if(await s.identify(f,JSON.stringify({revision:c,credentials:w})),i||r!==c)throw await s.reset(f,c),p();d=c})();u={epoch:c,task:b}}let g=u;try{await g.task}finally{u===g&&(u=void 0)}}let N=await s.invoke(f,e,JSON.stringify(o));if(i||r!==c)throw p();try{return JSON.parse(N)}catch{throw new a("INVALID_RESPONSE","Native host returned invalid JSON")}}async function h(e,o){let s=await m(e,o);if(!s||typeof s!="object"||Array.isArray(s)||s.status!=="complete"&&s.status!=="dismissed")throw new a("INVALID_RESPONSE","Native presentation returned an invalid result");return s}return{showFunnel(e){return h("showFunnel",{runToken:e})},showPaywall(e){return h("showPaywall",e)},showContent(e){return h("showContent",e)},purchaseSubscription(e,o){return m("purchaseSubscription",{operationId:e,accepted:o})},switchSubscription(e,o){return m("switchSubscription",{operationId:e,accepted:o})},restorePurchases(){return m("restorePurchases")},manageSubscriptions(e){return m("manageSubscriptions",e?{productId:e}:{})},async dismiss(){r++,d=-1,n&&await v().reset(await n,r)},async destroy(){i||(i=!0,r++,I(),y?.(),n&&t.nativeModule&&await t.nativeModule.destroy(await n))}}}var U=S.trackUsage.request.shape.command,V=S.trackUsage.response;function z(t){let l=C.parse(t.scope),n=P({...t,scope:l}),r={...t,scope:l,session:n.session},d=0;n.subscribeIdentity(()=>{d++});let u=()=>{let i=n.session.peek();if(!i)throw new a("UNAUTHENTICATED","Identify the Customer first");return i};return{...n,native:k(t,n.session),funnel(){return R({...r,customerToken:u()})},resumeFunnel(i){return u(),E({...r,runToken:i})},paywall(i){return A(r,{...i,customerToken:u()})},async trackUsage(i){if(!n.session.peek())throw new a("UNAUTHENTICATED","Identify the Customer first");if(!t.usageReporter)throw new a("INVALID_REQUEST","Configure your authenticated backend usageReporter");let v=U.parse(i),p=d,I;try{I=await t.usageReporter(v)}catch(m){throw p!==d?new a("IDENTITY_CHANGED","Customer identity changed during usage reporting"):m}if(p!==d)throw new a("IDENTITY_CHANGED","Customer identity changed during usage reporting");let y=V.parse(I);if(y.scope.projectId!==l.projectId||y.scope.environment!==l.environment)throw new a("INVALID_RESPONSE","Usage response scope differs");return y}}}export{a as IndianaError,O as createConfigurationSync,x as createFeatureClient,z as createIndianaReactNative,T as createLocalFunnelClient};
1
+ import{b as P,c as R}from"./chunk-VZVUZWP2.js";import{b as x,l as E,m as A,n as O,p as T}from"./chunk-FYGXGMRB.js";import"./chunk-SBPTOOYB.js";import{na as S}from"./chunk-Q64VNSPV.js";import{qa as a}from"./chunk-ACF2FBUB.js";import{a as C}from"./chunk-G56XGVMS.js";import"./chunk-GHJ65ILJ.js";import"./chunk-7DXL3LHT.js";import"./chunk-3PZ4Y6UD.js";function k(t,l){let n,r=0,d=-1,u,i=!1,v=()=>{if(i)throw new a("CLOSED","Native host was destroyed");if(!t.nativeModule)throw new a("CAPABILITY_UNAVAILABLE","Link IndianaBridge and supply nativeModule");return t.nativeModule},p=()=>new a("IDENTITY_CHANGED","Customer identity changed during the native operation"),I=l.subscribeIdentity(()=>{r++,d=-1;let e=r;n&&t.nativeModule&&n.then(s=>t.nativeModule.reset(s,e)).catch(()=>{})}),y=t.nativeEvents?.(e=>{!n||!t.nativeModule||typeof e?.requestId!="string"||(async()=>{let s=await n;if(e.instanceId!==s)return;if(e.kind==="credential"){let w=r,g=null;try{if(!i&&e.revision===w){let N=await l.access();!i&&r===w&&(g=N)}}finally{await t.nativeModule.provideCredential(s,e.requestId,g)}return}let o=!1,c=r;try{if(i||e.revision!==c||!t.onNativeAction)throw p();await t.onNativeAction(e.action),o=!i&&r===c}finally{await t.nativeModule.acknowledge(s,e.requestId,o)}})().catch(()=>{})});async function m(e,s={}){let o=v();if(l.snapshot()&&!t.nativeEvents)throw new a("CAPABILITY_UNAVAILABLE","Supply nativeEvents to share credential refresh with the native host");let c=r,w=await l.access();if(i||r!==c)throw p();if(!n){let f=o.create(JSON.stringify({baseUrl:t.baseUrl??"https://api.longplayai.com",scope:t.scope,timeout:(t.timeoutMs??15e3)/1e3,credentialEvents:!!t.nativeEvents}));n=f,f.catch(()=>{n===f&&(n=void 0)})}let g=await n;if(i||r!==c)throw p();if(d!==c){if(!u||u.epoch!==c){let b=(async()=>{if(await o.identify(g,JSON.stringify({revision:c,credentials:w})),i||r!==c)throw await o.reset(g,c),p();d=c})();u={epoch:c,task:b}}let f=u;try{await f.task}finally{u===f&&(u=void 0)}}let N=await o.invoke(g,e,JSON.stringify(s));if(i||r!==c)throw p();try{return JSON.parse(N)}catch{throw new a("INVALID_RESPONSE","Native host returned invalid JSON")}}async function h(e,s){let o=await m(e,s);if(!o||typeof o!="object"||Array.isArray(o)||o.status!=="complete"&&o.status!=="dismissed")throw new a("INVALID_RESPONSE","Native presentation returned an invalid result");return o}return{showFunnel(e){return h("showFunnel",{runToken:e})},showPaywall(e){return h("showPaywall",e)},showContent(e){return h("showContent",e)},purchaseSubscription(e,s){return m("purchaseSubscription",{operationId:e,accepted:s})},switchSubscription(e,s){return m("switchSubscription",{operationId:e,accepted:s})},restorePurchases(){return m("restorePurchases")},manageSubscriptions(e){return m("manageSubscriptions",e?{productId:e}:{})},async dismiss(){r++,d=-1,n&&await v().reset(await n,r)},async destroy(){i||(i=!0,r++,I(),y?.(),n&&t.nativeModule&&await t.nativeModule.destroy(await n))}}}var U=S.trackUsage.request.shape.command,V=S.trackUsage.response;function z(t){let l=C.parse(t.scope),n=P({...t,scope:l}),r={...t,scope:l,session:n.session},d=0;n.subscribeIdentity(()=>{d++});let u=()=>{let i=n.session.peek();if(!i)throw new a("UNAUTHENTICATED","Identify the Customer first");return i};return{...n,native:k(t,n.session),funnel(){return R({...r,customerToken:u()})},resumeFunnel(i){return u(),E({...r,runToken:i})},paywall(i){return A(r,{...i,customerToken:u()})},async trackUsage(i){if(!n.session.peek())throw new a("UNAUTHENTICATED","Identify the Customer first");if(!t.usageReporter)throw new a("INVALID_REQUEST","Configure your authenticated backend usageReporter");let v=U.parse(i),p=d,I;try{I=await t.usageReporter(v)}catch(m){throw p!==d?new a("IDENTITY_CHANGED","Customer identity changed during usage reporting"):m}if(p!==d)throw new a("IDENTITY_CHANGED","Customer identity changed during usage reporting");let y=V.parse(I);if(y.scope.projectId!==l.projectId||y.scope.environment!==l.environment)throw new a("INVALID_RESPONSE","Usage response scope differs");return y}}}export{a as IndianaError,O as createConfigurationSync,x as createFeatureClient,z as createIndianaReactNative,T as createLocalFunnelClient};
@@ -1 +1 @@
1
- import{a,b,c,d,e,g as f,h as g,i as h,j as i}from"./chunk-M7JWCLYX.js";import"./chunk-SSLZKIIU.js";import"./chunk-HEGNIATD.js";import"./chunk-DSPLGTQI.js";import"./chunk-7DXL3LHT.js";import"./chunk-3PZ4Y6UD.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
1
+ import{a,b,c,d,e,g as f,h as g,i as h,j as i}from"./chunk-X6BCUINI.js";import"./chunk-SSLZKIIU.js";import"./chunk-ACF2FBUB.js";import"./chunk-DSPLGTQI.js";import"./chunk-7DXL3LHT.js";import"./chunk-3PZ4Y6UD.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};