@imagineio/configurator-sdk 0.1.6 → 0.1.7
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/README.md +0 -4
- package/dist/066fc9aa40.js +1 -1
- package/dist/17876f4322.css +18 -0
- package/dist/2d1e844d0e.css +564 -0
- package/dist/371ed78aa2.js +1 -1
- package/dist/431a2d8618.js +1 -1
- package/dist/4b8958aa4c.js +1 -1
- package/dist/5183c26339.js +1 -0
- package/dist/61e0c0c9b5.js +1 -1
- package/dist/79a397bb92.js +1 -1
- package/dist/81eb433604.js +1 -1
- package/dist/85af90fade.js +1 -1
- package/dist/872c4302e0.js +1 -1
- package/dist/87bb469216.js +1 -1
- package/dist/8f60e5059a.js +1 -1
- package/dist/983cbed22c.js +1 -1
- package/dist/98f3644031.js +1 -1
- package/dist/9c6c598569.js +1 -1
- package/dist/a0f71d0bf5.js +1 -1
- package/dist/a77b15c0d6.js +1 -1
- package/dist/be0cfe2236.js +1 -1
- package/dist/be337ddda5.js +1 -1
- package/dist/c12c112c6f.js +1 -1
- package/dist/c1791d3a4a.js +1 -0
- package/dist/c245393c92.js +1 -0
- package/dist/c44d37da7a.js +1 -1
- package/dist/c9a1656c62.js +1 -1
- package/dist/d4378d9afa.js +1 -1
- package/dist/f41df3e4a9.js +1 -0
- package/dist/f7b4a178e3.js +1 -1
- package/dist/fbd844f2d1.js +1 -1
- package/dist/styles/themes.css +3 -0
- package/package.json +1 -1
package/dist/d4378d9afa.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as y,jsx as e,jsxs as f}from"react/jsx-runtime";import{memo as O,useEffect as w,useMemo as g,useRef as A,lazy as m,Suspense as k}from"react";import*as _ from"three";import{Environment as I}from"@react-three/drei";import{useThree as N}from"@react-three/fiber";import{RectAreaLightUniformsLib as P}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import M from"./983cbed22c.js";import{applyEnvironmentToRenderer as z}from"./4e7d0a0d4a.js";import{getApiBaseUrl as U}from"./8ade32d067.js";const F=(()=>{let t=null;const o=()=>t||(t=import("@react-three/postprocessing"));return{EffectComposer:m(()=>o().then(n=>({default:n.EffectComposer}))),Bloom:m(()=>o().then(n=>({default:n.Bloom}))),SSAO:m(()=>o().then(n=>({default:n.SSAO}))),FXAA:m(()=>o().then(n=>({default:n.FXAA}))),N8AO:m(()=>o().then(n=>({default:n.N8AO})))}})(),{EffectComposer:W,Bloom:D,SSAO:X,FXAA:j,N8AO:x}=F,G=m(()=>Promise.all([import("@react-three/postprocessing"),import("postprocessing")]).then(([t,o])=>{const n={ACESFilmic:o.ToneMappingMode.ACES_FILMIC,Reinhard:o.ToneMappingMode.REINHARD,Linear:o.ToneMappingMode.LINEAR,Cineon:o.ToneMappingMode.OPTIMIZED_CINEON,AgX:o.ToneMappingMode.AGX,Neutral:o.ToneMappingMode.NEUTRAL};return{default:({name:h})=>{const i=h?n[h]:void 0;return i===void 0?null:e(t.ToneMapping,{mode:i})}}}));let S=!1;function H(){if(!S){try{P.init()}catch{}S=!0}}function $(t){if(!t||/^([a-z]+:)?\/\//i.test(t)||t.startsWith("data:")||t.startsWith("blob:"))return t;const o=U()||"";return t.startsWith("/")?`${o}${t}`:`${o}/${t}`}function E(t,o){return o?512:typeof t.shadow_map_size=="number"?t.shadow_map_size:2048}function Y({env:t,isMobile:o,is3D:n,reducedQuality:c,captureMode:h}){const{gl:i,invalidate:s}=N();w(()=>{t&&Object.keys(t).length>0&&(z(t,i),s())},[t,i,s]);const d=g(()=>{if(!t)return[];if(Array.isArray(t.lights))return t.lights;const a=[];if(t.ambient_light&&a.push({type:"ambient",...t.ambient_light}),Array.isArray(t.directional_lights))for(const u of t.directional_lights)a.push({type:"directional",...u});return a},[t]);g(()=>d.some(a=>a?.type==="rect_area"),[d])&&H();const r=g(()=>{if(!t?.hdr)return null;const a=t.hdr,u=o?a.url_1k??a.url1k??a.url??null:a.url_2k??a.url2k??a.url??null;return u?{url:$(u),intensity:typeof a.intensity=="number"?a.intensity:1,rotation_deg:typeof a.rotation_deg=="number"?a.rotation_deg:0,as_background:!!a.as_background}:null},[t?.hdr,o]),p=g(()=>[0,_.MathUtils.degToRad(r?.rotation_deg??0),0],[r?.rotation_deg]);if(!t||Object.keys(t).length===0)return null;let b=null;r?.as_background||(b=t.background?.color??"#ffffff");const R=t.background?.color??"#ffffff",B=typeof t.shadows?.bias=="number"?t.shadows.bias:15e-5,C=typeof t.shadows?.radius=="number"?t.shadows.radius:typeof t.ground?.shadow_blur=="number"?t.ground.shadow_blur:null,T=typeof t.shadows?.normal_bias=="number"?t.shadows.normal_bias:null;return f(y,{children:[r&&e(M,{children:e(k,{fallback:r?.as_background?e("color",{attach:"background",args:[R]}):null,children:e(I,{files:r.url,background:r.as_background,environmentIntensity:r.intensity,environmentRotation:p,backgroundRotation:p})})}),b&&e("color",{attach:"background",args:[b]}),d.map((a,u)=>!a||a.enabled===!1?null:e(J,{light:a,is3D:n,reducedQuality:c,globalShadowBias:B,globalShadowRadius:C,globalShadowNormalBias:T},u)),e(q,{ground:t.ground,is3D:n,reducedQuality:c,captureMode:h}),e(Z,{postProcessing:t.post_processing,toneMapping:t.tone_mapping??t.toneMapping,is3D:n,reducedQuality:c,captureMode:h})]})}function q({ground:t,is3D:o,reducedQuality:n,captureMode:c}){if(c||!t||t.enabled!==!0)return null;const h=t.floor_color??t.color??"#ffffff",i=typeof t.size=="number"?t.size:21,s=n?-.05:o?-.005:-.02,d=typeof t.shadow_opacity=="number"?t.shadow_opacity:.5,l=t.shadow_color??"#000000";return f(y,{children:[f("mesh",{rotation:[-Math.PI/2,0,0],position:[0,s,0],renderOrder:n?-1:0,children:[e("circleGeometry",{args:[i,64]}),e("meshBasicMaterial",{color:h,toneMapped:!1,depthWrite:!n,polygonOffset:!0,polygonOffsetFactor:2,polygonOffsetUnits:2})]}),o&&d>0&&f("mesh",{rotation:[-Math.PI/2,0,0],position:[0,s+5e-4,0],receiveShadow:!0,children:[e("circleGeometry",{args:[i,64]}),e("shadowMaterial",{transparent:!0,opacity:d,color:l})]})]})}function Z({postProcessing:t,toneMapping:o,is3D:n,reducedQuality:c,captureMode:h}){if(h||!n||!t)return null;const i=t.bloom,s=t.ssao,d=t.fxaa,l=t.n8ao;return!i&&!s&&!d&&!l?null:e(M,{children:e(k,{fallback:null,children:f(W,{enableNormalPass:!!(s&&!l),children:[i&&e(D,{intensity:typeof i?.intensity=="number"?i.intensity:.5,luminanceThreshold:typeof i?.threshold=="number"?i.threshold:.9,luminanceSmoothing:typeof i?.smoothing=="number"?i.smoothing:.025,mipmapBlur:!0}),l&&e(x,{aoRadius:typeof l?.radius=="number"?l.radius:c?.3:.5,intensity:typeof l?.intensity=="number"?l.intensity:c?1:1.5,distanceFalloff:typeof l?.falloff=="number"?l.falloff:.5,quality:c?"low":"medium"}),s&&!l&&e(X,{intensity:typeof s?.intensity=="number"?s.intensity:1,radius:typeof s?.radius=="number"?s.radius:.1,samples:c?9:16}),d&&e(j,{}),e(G,{name:o})]})})})}function J({light:t,is3D:o,reducedQuality:n,globalShadowBias:c,globalShadowRadius:h,globalShadowNormalBias:i}){const s=A(),d=A();w(()=>{const r=d.current;r&&(t.target&&s.current?(s.current.position.set(t.target[0],t.target[1],t.target[2]),s.current.updateMatrixWorld(!0),r.target=s.current):r.target=new _.Object3D)},[t.target]);const l=r=>r?{"shadow-bias":typeof t.bias=="number"?t.bias:c,"shadow-normalBias":typeof t.normal_bias=="number"?t.normal_bias:i??.1,"shadow-radius":typeof t.radius=="number"?t.radius:h??4,"shadow-mapSize-width":E(t,n),"shadow-mapSize-height":E(t,n),"shadow-camera-far":t.shadow_camera_far??500,"shadow-camera-near":t.shadow_camera_near??.5,"shadow-camera-left":t.shadow_camera_left??-5,"shadow-camera-right":t.shadow_camera_right??5,"shadow-camera-top":t.shadow_camera_top??5,"shadow-camera-bottom":t.shadow_camera_bottom??-5}:{};switch(t.type){case"ambient":return e("ambientLight",{color:t.color,intensity:t.intensity??1});case"directional":{const r=o&&!!t.cast_shadow,p=t.position??[0,5,5];return f(y,{children:[e("directionalLight",{ref:d,color:t.color,intensity:t.intensity??1,position:p,castShadow:r,...l(r)}),t.target&&e("object3D",{ref:s})]})}case"point":{const r=o&&!!t.cast_shadow;return e("pointLight",{color:t.color,intensity:t.intensity??1,position:t.position??[0,5,0],distance:t.distance??0,decay:t.decay??2,castShadow:r,...l(r)})}case"spot":{const r=o&&!!t.cast_shadow;return f(y,{children:[e("spotLight",{ref:d,color:t.color,intensity:t.intensity??1,position:t.position??[0,5,0],distance:t.distance??0,angle:_.MathUtils.degToRad(t.angle_deg??30),penumbra:t.penumbra??0,decay:t.decay??2,castShadow:r,...l(r)}),t.target&&e("object3D",{ref:s})]})}case"hemisphere":return e("hemisphereLight",{color:t.sky_color??t.color,groundColor:t.ground_color,intensity:t.intensity??1,position:t.position??[0,5,0]});case"rect_area":return e("rectAreaLight",{color:t.color,intensity:t.intensity??1,width:t.width??1,height:t.height??1,position:t.position??[0,5,0],rotation:t.rotation??[0,0,0]});default:return null}}var nt=O(Y);export{nt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function i(t,r="var(--border-dark, #cccccc)"){if(t==null)return r;if(typeof t=="number")return`#${t.toString(16).padStart(6,"0")}`;if(typeof t=="string"){const s=t.trim();return s?/^[0-9a-fA-F]{3}$/.test(s)||/^[0-9a-fA-F]{6}$/.test(s)?`#${s}`:s:r}return r}function c(t){return`data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><rect width='100' height='100' fill='${t}'/></svg>`)}`}function u(t){return typeof t=="string"&&(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("/")||t.startsWith("data:")||t.startsWith("blob:"))}function l(t={},r=null){const s=t.thumbnail??t.thumbnailUrl??t.thumbnail_url??r?.thumbnail??r?.thumbnailUrl??r?.thumbnail_url??null,e=r?.textures?.diffuse??r?.diffuseMap??r?.diffuse_map??r?.materialJson?.map??null,n=r?.color??r?.materialJson?.color??t.color??t.color_hex??t.metadata?.color_hex,o=i(n);return{thumbnail:s,texture:e,color:o,hasColor:n!=null,swatchSrc:c(o),src:u(s)&&s||u(e)&&e||null}}const h=l;var f=l;export{c as colorSwatchSrc,f as default,u as isImageSrc,h as resolveFinishPreview,l as resolveOptionPreview,i as toCssColor};
|
package/dist/f7b4a178e3.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GLTFExporter as
|
|
1
|
+
import{Box3 as x,Vector3 as T}from"three";import{GLTFExporter as C}from"three/examples/jsm/exporters/GLTFExporter.js";import{WebIO as L,Logger as E}from"@gltf-transform/core";import{KHRDracoMeshCompression as v}from"@gltf-transform/extensions";import{getMediaBaseUrl as O,getArViewerBase as b}from"./9544661159.js";import{presignArModel as I}from"./79a397bb92.js";const X=O(),_="model/gltf-binary";async function U(r,{onUploadProgress:n}={}){const t=await I({contentType:_,fileSize:r.size});if(!t?.upload_url||!t?.fields)throw new Error("AR upload could not be signed");if(t.max_size&&r.size>t.max_size)throw new Error(`This model is ${(r.size/1048576).toFixed(1)} MB, over the ${Math.round(t.max_size/1048576)} MB limit for AR.`);const a=new FormData;for(const[o,l]of Object.entries(t.fields))a.append(o,l);return a.append("file",r,"model.glb"),await new Promise((o,l)=>{const s=new XMLHttpRequest;s.open(t.method||"POST",t.upload_url,!0),s.withCredentials=!1,n&&s.upload.addEventListener("progress",c=>{c.lengthComputable&&n({progress:c.loaded/c.total})}),s.onload=()=>{if(s.status>=200&&s.status<300){o(!0);return}l(new Error(s.status===400?"The model was rejected by storage \u2014 it is larger than declared, or not a GLB.":`AR upload failed (${s.status})`))},s.onerror=()=>l(new Error("AR upload network error")),s.send(a)}),t.public_url}async function D(r,n=1024){if(!r||!r.image)return r;const t=r.image;if(t.width<=n&&t.height<=n&&r.repeat.x<=1&&r.repeat.y<=1)return r;const a=document.createElement("canvas"),o=a.getContext("2d",{alpha:!1,willReadFrequently:!1}),l=r.repeat.x||1,s=r.repeat.y||1;let c=t.width,m=t.height;const d=c/m;c>m?c>n&&(c=n,m=c/d):m>n&&(m=n,c=m*d);let h=c*l,g=m*s;const y=n;if(h>y||g>y){const u=Math.min(y/h,y/g);h=Math.floor(h*u),g=Math.floor(g*u),c=Math.floor(c*u),m=Math.floor(m*u)}a.width=h,a.height=g;const R=o.createPattern(t,"repeat");return o.fillStyle=R,o.save(),o.scale(c/t.width,m/t.height),o.fillRect(0,0,a.width*(t.width/c),a.height*(t.height/m)),o.restore(),new Promise(u=>{let f=!1;a.toBlob(e=>{if(!e){f=!0,u(r);return}const i=URL.createObjectURL(e),p=new Image;p.onload=()=>{if(f)return;f=!0;const w=r.clone();w.image=p,w.needsUpdate=!0,URL.revokeObjectURL(i),u(w)},p.onerror=()=>{f||(f=!0,URL.revokeObjectURL(i),u(r))},setTimeout(()=>{f||(f=!0,URL.revokeObjectURL(i),u(r))},5e3),p.src=i},"image/jpeg")})}function P(r){return r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof ImageBitmap||r instanceof HTMLVideoElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas||typeof SVGImageElement<"u"&&r instanceof SVGImageElement}function F(r){const n=r.image;if(!n||P(n))return!1;const t=n.width,a=n.height;if(!t||!a)return!0;const o=document.createElement("canvas");o.width=t,o.height=a;const l=o.getContext("2d");if(n instanceof ImageData)l.putImageData(n,0,0);else if(n.data&&ArrayBuffer.isView(n.data)){const s=t*a*4,c=new Uint8ClampedArray(s);for(let m=0;m<s;m++)c[m]=Math.min(255,Math.max(0,n.data[m]*(n.data instanceof Float32Array?255:1)));l.putImageData(new ImageData(c,t,a),0,0)}else return!0;return r.image=o,r.needsUpdate=!0,!1}function H(r){for(const n of Object.keys(r)){const t=r[n];t&&t.isTexture&&t.image&&F(t)&&(r[n]=null)}}function S(r){r.updateMatrixWorld(!0);const n=[];r.traverse(t=>{t.isMesh&&t.geometry&&t.matrixWorld.determinant()<0&&n.push(t)});for(const t of n){if(t.geometry=t.geometry.clone(),t.geometry.applyMatrix4(t.matrixWorld),t.geometry.index){const a=t.geometry.index.array;for(let o=0;o<a.length;o+=3){const l=a[o];a[o]=a[o+2],a[o+2]=l}t.geometry.index.needsUpdate=!0}t.removeFromParent(),t.position.set(0,0,0),t.rotation.set(0,0,0),t.scale.set(1,1,1),t.updateMatrix(),r.add(t)}}function G(r){r.updateMatrixWorld(!0);const n=new x,t=new x;if(r.traverseVisible(s=>{!s.isMesh||!s.geometry||(s.geometry.boundingBox||s.geometry.computeBoundingBox(),t.copy(s.geometry.boundingBox).applyMatrix4(s.matrixWorld),n.union(t))}),n.isEmpty())return;const a=n.getCenter(new T),o=new T(a.x,n.min.y,a.z);if(o.lengthSq()<1e-10)return;(r.isScene?r.children:[r]).forEach(s=>s.position.sub(o)),r.updateMatrixWorld(!0)}async function V({model:r,callBack:n}){const t=r.clone(),a=[];t.traverse(e=>{(e.isTransformControls||e.isHelper||e.isGridHelper||e.isAxesHelper||e.isPolarGridHelper)&&a.push(e)}),a.forEach(e=>e.removeFromParent()),S(t);const o=[];t.traverse(e=>{if(e.name==="scene-room"){o.push(e);return}if(e.name==="scene-dimensions"){o.push(e);return}if(e.isMesh&&e.geometry?.type==="PlaneGeometry"){o.push(e);return}if(e.isMesh&&e.geometry?.type==="CircleGeometry"){o.push(e);return}if(e.isMesh&&e.name==="wall"){o.push(e);return}if(e.isMesh&&e.material?.type==="MeshBasicMaterial"){o.push(e);return}if(e.isLineSegments||e.isLine){o.push(e);return}if(e.isLight||e.isCamera){o.push(e);return}}),o.forEach(e=>e.removeFromParent()),G(t);const l={};t.traverse(e=>{if(e.isMesh&&e.material){let i=l[e.material.uuid];i||(i=e.material.clone(),l[e.material.uuid]=i),i.emissive&&(i.emissive.setHex(0),i.emissiveIntensity=0),e.material=i}});const s=[],c=[];t.traverse(e=>{if(e.isMesh){if(e.geometry?.type==="PlaneGeometry"||e.name==="wall"){o.push(e);return}if(e.material){let i=l[e.material.uuid];i||(i=e.material.clone(),l[e.material.uuid]=i,s.push(i)),e.material=i}}}),o.forEach(e=>e.removeFromParent()),s.forEach(e=>H(e));const m=["map","normalMap","roughnessMap","metalnessMap","aoMap","emissiveMap"],d=new Map,h=e=>{if(d.has(e))return d.get(e);const i=D(e,512);return d.set(e,i),i};s.forEach(e=>{m.forEach(i=>{e[i]&&c.push(h(e[i]).then(p=>{e[i]=p}))})});const g=4;for(let e=0;e<c.length;e+=g)await Promise.all(c.slice(e,e+g));const y=new C,R={binary:!0,embedImages:!0},u=console.warn;console.warn=(...e)=>{(typeof e[0]=="string"?e[0]:"").startsWith("THREE.GLTFExporter:")||u.apply(console,e)};const f=()=>{console.warn!==u&&(console.warn=u)};return new Promise((e,i)=>{y.parse(t,async function(p){f();try{const w=new L().setLogger(new E(E.Verbosity.ERROR)).registerExtensions([v]).registerDependencies({"draco3d.encoder":await window.DracoEncoderModule(),"draco3d.decoder":await window.DracoDecoderModule()}),M=await w.readBinary(new Uint8Array(p));M.setLogger(new E(E.Verbosity.ERROR)),M.createExtension(v).setRequired(!0).setEncoderOptions({method:v.EncoderMethod.EDGEBREAKER,encodeSpeed:5,decodeSpeed:5,quantizationBits:{POSITION:14,NORMAL:10,COLOR:8,TEX_COORD:12,GENERIC:12}});const B=await w.writeBinary(M),A=new Blob([B],{type:"application/octet-stream"});n?.(A),e()}catch{const M=new Blob([p],{type:"application/octet-stream"});n?.(M),e()}},function(p){f(),i(p)},R)}).finally(f)}async function K({scene:r,onProgress:n,onComplete:t,onError:a}){try{n?.(5),await V({model:r,callBack:async o=>{try{n?.(30);const l=await U(o,{onUploadProgress:m=>{const d=40+Math.min(m.progress*50,50);n?.(Math.round(d))}});n?.(92);const c=`${(b()||`${window.location.origin}/ar-viewer`).replace(/\/+$/,"")}?data=${encodeURIComponent(l)}`;n?.(100),t?.(c,{publicUrl:l})}catch(l){a?.(W(l))}}})}catch(o){a?.(o.message||"Failed to export 3D model")}}function W(r){const n=r?.status;return r?.code==="EMBED_NOT_LICENSED"?r.detail||"This configurator is not licensed to run on this website.":n===403?"This configurator is in read-only mode, so AR models cannot be uploaded.":n===401?"AR upload was not authorised \u2014 the session credential is missing or expired.":n===429?"Too many AR models were prepared just now. Please wait a minute and try again.":n===400?r.detail||"The AR model was rejected \u2014 check the file size and format.":r?.message||"Failed to upload AR model"}export{_ as AR_CONTENT_TYPE,X as S3_BUCKET_PREFIX_URL,V as exportModel,K as generateARModel,U as uploadArModel};
|
package/dist/fbd844f2d1.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shouldBlockRequest as
|
|
1
|
+
import{shouldBlockRequest as O,requestBlockedError as T}from"./631a9f7fac.js";import{authHeaders as $,isAuthFailure as E,reportAuthFailure as P,reportForbidden as A,getChannelId as b}from"./431a2d8618.js";import{ensureSessionToken as y,getSessionToken as x,hasTokenProvider as U}from"./33fa2c8ca2.js";import{applyRequestInterceptors as _,applyResponseInterceptors as I,performRequest as D}from"./a3f18e76fe.js";import{getApiBaseUrl as S}from"./8ade32d067.js";import{assertLicensed as F}from"./fe235d7160.js";function p(e={}){const t=b();return t!=null?{...e,channelId:t}:e}async function f(e,t,{signal:o}={},r=!1){if(await F(e),O(e))throw T(e);await y();const i=_({path:e,url:`${S()}${e}`,method:"POST",headers:{"Content-Type":"application/json",...$(e)},body:t,init:void 0}),s=Date.now(),a=await D(i,c=>fetch(c.url,{method:"POST",headers:c.headers,body:JSON.stringify(c.body),signal:o}));if(E(a)){if(!r&&U())return await y({force:!0}),f(e,t,{signal:o},!0);await P(a,{url:e,method:"POST"})}a.status===403&&await A(a,{url:e,method:"POST"});let n=null;try{n=await a.json()}catch{n=null}const l=I({status:a.status,ok:a.ok,data:n||{},duration:Date.now()-s},i);return{status:l.status,ok:l.ok,data:l.data||{}}}async function z({systemId:e,presetId:t}={}){const{status:o,ok:r,data:i}=await f("/api/v1/configurations/initial/",p({systemId:e,...t!=null?{presetId:t}:{}}));if(!r)throw new Error(`initial configuration failed: ${o}`);return i}async function B({systemId:e,catalogVersion:t,state:o,mutation:r,idempotencyKey:i},{signal:s}={}){const{status:a,data:n}=await f("/api/v1/configurations/evaluate/",p({systemId:e,catalogVersion:t,state:o,mutation:r,...i?{idempotencyKey:i}:{}}),{signal:s}),l=new Set(["CONSTRAINT_NOT_IMPLEMENTED","STALE_SELECTION"]),c=u=>u&&typeof u=="object"?u.code??u.type:u,m=(n.warnings??[]).filter(u=>!l.has(String(c(u)??"").toUpperCase())),d=n.errorResponse&&typeof n.errorResponse=="object"?n.errorResponse:n;return{status:a,applied:a===200,rejected:a===422,staleCatalog:a===409||n.refetchCatalog===!0,blockingMutation:(d.blockingMutation??n.blockingMutation)===!0,code:d.code??n.code??null,system:n.system??null,pricing:n.pricing??null,resolvedState:n.resolvedState??null,optionVisibility:n.optionVisibility??null,optionSetVisibility:n.optionSetVisibility??null,optionAvailability:n.optionAvailability??null,defaultOptionOverrides:n.defaultOptionOverrides??null,fired:n.fired??[],selectionOverrides:n.selectionOverrides??[],removedPlacements:n.removedPlacements??null,addedPlacements:n.addedPlacements??null,messages:n.messages??d.messages??[],events:n.events??[],customEffects:n.customEffects??n.custom_effects??[],customDiagnostics:n.customDiagnostics??n.custom_diagnostics??d.customDiagnostics??[],errors:d.errors??n.errors??[],warnings:m,catalogVersion:n.catalogVersion??t??null,refetchCatalog:n.refetchCatalog===!0||a===409,previousState:d.previousState??n.previousState??null,schemaVersion:n.schemaVersion??null}}async function J(e){if(!Array.isArray(e)||e.length===0)return null;const t=b(),o={...t!=null?{channel:t}:{},items:e};try{const{ok:r,data:i}=await f("/api/v1/pricing/calculate/",o);return r?i:null}catch{return null}}async function H({systemId:e,viewId:t,tier:o="full",presetId:r=null}={}){const{status:i,ok:s,data:a}=await f("/api/v1/renders/layers/",p({systemId:e,viewId:t,tier:o,...r!=null?{presetId:r}:{}}));if(!s){const n=new Error(`render layers failed: ${i}`);throw n.status=i,n.code=a?.errors?.[0]?.code??a?.code??null,n.errors=a?.errors??null,n}return a}async function G({systemId:e,presetId:t=null,selections:o=null,viewId:r=null,tier:i=null,frame:s=null,format:a=null}={}){const{status:n,ok:l,data:c}=await f("/api/v1/renders/final/",p({systemId:e,...t!=null?{presetId:t}:{},...o?{selections:o}:{},...r!=null?{viewId:r}:{},...i?{tier:i}:{},...s!=null?{frame:s}:{},...a?{format:a}:{}}));if(!l)throw new Error(`final renders failed: ${n}`);return c}async function W({systemId:e,viewId:t=null,frame:o=0,frames:r,tier:i="full",format:s,selections:a={},shadow:n,background:l,batchId:c=null}={}){const{status:m,ok:d,data:u}=await f("/api/v1/renders/merge/",p({systemId:e,viewId:t,frame:o,...n!==void 0?{shadow:n}:null,...l===!1?{background:!1}:null,...r?{frames:r}:null,tier:i,...s?{format:s}:null,...c!=null?{batchId:c}:null,selections:a}));if(!d){const h=new Error(`render merge failed: ${m}`);throw h.status=m,h.code=u?.errors?.[0]?.code??u?.code??null,h.errors=u?.errors??null,h}return u}let g=null;function X(e){g=e??null}async function v(e,t={}){await y();const o={...t.headers||{}},r=x();return r&&(o.Authorization=`Bearer ${r}`),g!=null&&(o["X-Organization-Id"]=String(g)),fetch(`${S()}${e}`,{...t,headers:o})}class R extends Error{constructor(t,o){const r=o?.errors?.[0]||null;super(r?.message||`request failed (${t})`),this.status=t,this.code=r?.code||null,this.details=Array.isArray(r?.details)?r.details:[]}}async function w(e,t){const o=await v(e,t),r=await o.json().catch(()=>null);if(!o.ok)throw new R(o.status,r);return r}async function k(e,t){const o=await v(e);if(!o.ok)throw new R(o.status,await o.json().catch(()=>null));const i=(o.headers.get("Content-Disposition")||"").match(/filename\*?=(?:UTF-8'')?"?([^";]+)"?/i),s=i?decodeURIComponent(i[1]):t,a=await o.blob(),n=URL.createObjectURL(a),l=document.createElement("a");return l.href=n,l.download=s,document.body.appendChild(l),l.click(),l.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4),s}async function Q(e,{shadowEnabled:t,shadowOpacity:o}={}){const r={};return t!==void 0&&(r.shadow_enabled=!!t),o!==void 0&&(r.shadow_opacity=Math.max(0,Math.min(1,Number(o)))),w(`/api/admin/render-scenes/${encodeURIComponent(e)}/`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}const C=(e,t,o)=>`/api/admin/render-batches/${encodeURIComponent(e)}/layer-files/?view=${encodeURIComponent(t)}&layer=${encodeURIComponent(o)}`;function Y({batchId:e,viewId:t,layer:o}){return k(C(e,t,o),`${o}_${t}.zip`)}function Z({batchId:e,viewId:t,layer:o,files:r}){const i=new FormData;for(const s of r)i.append("files",s,s.name),i.append("paths",s.webkitRelativePath||s.name);return w(C(e,t,o),{method:"POST",body:i})}function K(e){return k(`/api/admin/options/${encodeURIComponent(e)}/thumbnail/`,`option_${e}_thumbnail.png`)}function ee(e,t){const o=new FormData;return o.append("file",t,t.name),w(`/api/admin/options/${encodeURIComponent(e)}/thumbnail/`,{method:"POST",body:o})}export{R as AdminCallError,J as calculatePricing,Y as downloadLayerFiles,K as downloadOptionThumbnail,B as evaluateConfiguration,G as fetchFinalRenders,z as fetchInitialConfiguration,H as fetchRenderLayers,W as fetchRenderMerge,X as setAdminOrganizationId,Q as updateRenderSceneDisplay,Z as uploadLayerFiles,ee as uploadOptionThumbnail};
|
package/dist/styles/themes.css
CHANGED
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
opts in via data-theme-mode="dark" (set by applyTheme for these ids).
|
|
51
51
|
======================================================================== */
|
|
52
52
|
:root[data-theme-preset][data-theme-mode="dark"] {
|
|
53
|
+
/* the final viewer's field stays light on a dark theme (2026-11-05): the renders were lit for
|
|
54
|
+
a light setup, and a black surround made them look like a fault */
|
|
55
|
+
--bg-final-stage: #ececef;
|
|
53
56
|
--bg-primary: #1e1e22;
|
|
54
57
|
--bg-secondary: #141417;
|
|
55
58
|
--bg-tertiary: #26262b;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imagineio/configurator-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Configurator SDK — backend Configuration Engine client, state stores, shared 3D scene primitives, and pluggable placement (strategy + type). Drives every configurator (kitchen, sectional, …) from one self-contained surface.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|