@imagineio/configurator-sdk 0.1.0-beta.1
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/LICENSE.md +294 -0
- package/README.md +103 -0
- package/dist/00a41227ff.js +1 -0
- package/dist/00ab3dcbb5.js +1 -0
- package/dist/01a664fa9f.css +51 -0
- package/dist/04746bff9a.js +1 -0
- package/dist/04931f795e.js +1 -0
- package/dist/05973a4da2.js +3 -0
- package/dist/061b81ad81.js +1 -0
- package/dist/066fc9aa40.js +1 -0
- package/dist/09c4973968.js +1 -0
- package/dist/0a35b2c5f4.js +1 -0
- package/dist/0af28430ab.js +1 -0
- package/dist/0e2dedae0d.js +1 -0
- package/dist/0f7c8345a8.js +1 -0
- package/dist/12b8165d6d.js +1 -0
- package/dist/1458417bdb.js +1 -0
- package/dist/14c83bc57a.js +1 -0
- package/dist/15d6bec3b5.css +150 -0
- package/dist/16a399703e.js +1 -0
- package/dist/17876f4322.css +114 -0
- package/dist/1870fc037b.js +1 -0
- package/dist/1a2629800a.css +196 -0
- package/dist/1e243363f6.js +1 -0
- package/dist/1fac915f8b.js +1 -0
- package/dist/1fff100656.js +1 -0
- package/dist/205827c5c8.js +1 -0
- package/dist/20b0104576.js +1 -0
- package/dist/2239b22616.js +1 -0
- package/dist/22bd38ddcf.js +1 -0
- package/dist/239b619005.css +1849 -0
- package/dist/23dc0ccf32.js +1 -0
- package/dist/26155bf68c.js +1 -0
- package/dist/2774152dd2.js +1 -0
- package/dist/27fee7007f.js +1 -0
- package/dist/281cf952fa.js +1 -0
- package/dist/28a9d58274.js +1 -0
- package/dist/28d887bf8a.js +1 -0
- package/dist/28df2aa12f.js +1 -0
- package/dist/297e653adf.js +1 -0
- package/dist/2990ba64d6.js +1 -0
- package/dist/2b6aa27f6d.js +1 -0
- package/dist/2c7c1bcef1.js +1 -0
- package/dist/2cab5c5c23.js +1 -0
- package/dist/2cafe3274b.js +1 -0
- package/dist/2e366d7386.js +1 -0
- package/dist/2f8cc8b292.js +1 -0
- package/dist/30be653f00.css +110 -0
- package/dist/31ea036f5c.js +1 -0
- package/dist/32861ea2b0.js +1 -0
- package/dist/33fa2c8ca2.js +1 -0
- package/dist/35d8449ed8.js +1 -0
- package/dist/3656ffa1b8.js +1 -0
- package/dist/367a479d3a.js +1 -0
- package/dist/371ed78aa2.js +1 -0
- package/dist/37596ace72.js +1 -0
- package/dist/37addc7fb3.js +1 -0
- package/dist/388cadacbd.js +1 -0
- package/dist/39a62ef7b8.js +1 -0
- package/dist/3bbcee0334.js +1 -0
- package/dist/3c916f744f.js +1 -0
- package/dist/3f37665dd1.js +1 -0
- package/dist/3fb3ab6757.js +1 -0
- package/dist/40d6aeb28c.js +1 -0
- package/dist/41ed5985ad.js +1 -0
- package/dist/431a2d8618.js +1 -0
- package/dist/44a229099f.js +1 -0
- package/dist/4741e5d07d.css +263 -0
- package/dist/4910c07ca8.css +411 -0
- package/dist/4a99ddb3fd.js +1 -0
- package/dist/4aa671f9f6.js +1 -0
- package/dist/4b8958aa4c.js +1 -0
- package/dist/4ba4f544b9.js +1 -0
- package/dist/4c24338793.js +1 -0
- package/dist/4d7a0d1897.js +1 -0
- package/dist/4e1db1e3b0.js +1 -0
- package/dist/4e7d0a0d4a.js +1 -0
- package/dist/51b23203e5.css +1447 -0
- package/dist/52436e0169.js +1 -0
- package/dist/54413c1eae.js +1 -0
- package/dist/54f0fcf38b.js +1 -0
- package/dist/55ab45ada4.css +370 -0
- package/dist/561dc3f1ab.js +1 -0
- package/dist/58e6419ba8.js +1 -0
- package/dist/5c9fd9201c.js +1 -0
- package/dist/5d05e8982e.js +1 -0
- package/dist/5d5e8a9c58.js +3 -0
- package/dist/5e4f2349ff.js +1 -0
- package/dist/609e5e5d28.js +1 -0
- package/dist/60d697292c.js +1 -0
- package/dist/61e0c0c9b5.js +1 -0
- package/dist/631a9f7fac.js +1 -0
- package/dist/64e9020b49.js +1 -0
- package/dist/66c461dc2c.js +1 -0
- package/dist/672404d987.js +1 -0
- package/dist/67f6338a4a.js +1 -0
- package/dist/6855e6a3b1.js +1 -0
- package/dist/6b0a81e4f8.js +1 -0
- package/dist/6ba86aa3b8.js +1 -0
- package/dist/6bff84d27e.js +1 -0
- package/dist/6c0a2572dd.js +1 -0
- package/dist/6d238282c1.js +1 -0
- package/dist/6e2595aa36.js +1 -0
- package/dist/6f9ae59d6c.js +1 -0
- package/dist/70dd811d74.js +1 -0
- package/dist/710c1ab641.js +1 -0
- package/dist/7206ce49c6.js +1 -0
- package/dist/7281d77ed9.js +1 -0
- package/dist/73f7d65985.js +1 -0
- package/dist/776277593f.js +1 -0
- package/dist/79a397bb92.js +1 -0
- package/dist/7a748aae59.js +1 -0
- package/dist/7bfb0ecfbb.css +572 -0
- package/dist/7bfcd0a517.js +1 -0
- package/dist/7d9ddaeb47.js +1 -0
- package/dist/7f833bc5af.js +1 -0
- package/dist/811b403d43.js +1 -0
- package/dist/817d930a49.js +1 -0
- package/dist/81802759ca.js +1 -0
- package/dist/81eb433604.js +1 -0
- package/dist/82a8a4bc35.js +1 -0
- package/dist/85af90fade.js +1 -0
- package/dist/872c4302e0.js +1 -0
- package/dist/87bb469216.js +1 -0
- package/dist/87dcc12b65.js +1 -0
- package/dist/87f511c4a8.js +1 -0
- package/dist/88251d6671.js +1 -0
- package/dist/882bc739c8.js +1 -0
- package/dist/89ab18ebc5.js +1 -0
- package/dist/8a22e8944f.css +563 -0
- package/dist/8a3a57c008.js +1 -0
- package/dist/8ade32d067.js +1 -0
- package/dist/8bf6d26ad6.css +233 -0
- package/dist/8c27edda0f.js +1 -0
- package/dist/8db8655f21.js +24 -0
- package/dist/8f60e5059a.js +1 -0
- package/dist/91707f5ca0.css +78 -0
- package/dist/921bf270dd.js +20 -0
- package/dist/9326c23506.js +1 -0
- package/dist/94a0a79c65.js +1 -0
- package/dist/9526094bb7.js +1 -0
- package/dist/9544661159.js +1 -0
- package/dist/95a44ebec2.js +1 -0
- package/dist/970313b92b.js +1 -0
- package/dist/9794652102.js +1 -0
- package/dist/983cbed22c.js +1 -0
- package/dist/9840b9ce12.js +1 -0
- package/dist/98f3644031.js +1 -0
- package/dist/992778075d.css +353 -0
- package/dist/9c6c598569.js +1 -0
- package/dist/9f474b5d1a.js +1 -0
- package/dist/a0f71d0bf5.js +1 -0
- package/dist/a3c983d431.js +1 -0
- package/dist/a3f18e76fe.js +1 -0
- package/dist/a493e9aa8f.js +1 -0
- package/dist/a77b15c0d6.js +1 -0
- package/dist/a811c90bd5.js +1 -0
- package/dist/a822c5e4f2.js +1 -0
- package/dist/aaa0e82d7f.css +69 -0
- package/dist/ab6c80484f.js +1 -0
- package/dist/ae96f219e3.js +1 -0
- package/dist/b11b38869d.css +427 -0
- package/dist/b1349d5a21.js +4 -0
- package/dist/b14379d31b.css +151 -0
- package/dist/b3efb26fd7.js +1 -0
- package/dist/b59b0dde17.js +1 -0
- package/dist/b5c372377f.js +1 -0
- package/dist/b976df09ec.js +1 -0
- package/dist/baeaed46c9.js +1 -0
- package/dist/bb719febc6.js +1 -0
- package/dist/bcd44b4040.js +1 -0
- package/dist/bdc4e4c5b9.css +209 -0
- package/dist/bdec200d00.js +1 -0
- package/dist/be0cfe2236.js +1 -0
- package/dist/be337ddda5.js +1 -0
- package/dist/c12c112c6f.js +1 -0
- package/dist/c2a14a77ae.js +1 -0
- package/dist/c3b8f1973b.js +1 -0
- package/dist/c44d37da7a.js +1 -0
- package/dist/c4790179f1.js +1 -0
- package/dist/c5e990946e.js +1 -0
- package/dist/c71892453b.js +1 -0
- package/dist/c9a1656c62.js +1 -0
- package/dist/ca497b066c.js +1 -0
- package/dist/cdb4a0f7b3.js +3 -0
- package/dist/ce663020e4.js +60 -0
- package/dist/cec035efb1.js +1 -0
- package/dist/d0f9681634.js +1 -0
- package/dist/d118c2e7ba.js +1 -0
- package/dist/d20718159b.js +3 -0
- package/dist/d30f1f506e.js +1 -0
- package/dist/d3cd7f1bc1.js +1 -0
- package/dist/d4378d9afa.js +1 -0
- package/dist/d464da28a5.js +1 -0
- package/dist/d566d3874b.js +1 -0
- package/dist/d617bbb9f5.js +26 -0
- package/dist/d65f32e004.js +1 -0
- package/dist/d6851ea979.js +1 -0
- package/dist/d7c9500ba9.js +1 -0
- package/dist/d803155241.js +1 -0
- package/dist/d903df4e0d.js +1 -0
- package/dist/d94df858ea.js +1 -0
- package/dist/da7b5f450d.js +1 -0
- package/dist/daa11edd01.js +1 -0
- package/dist/db4afd43c9.js +1 -0
- package/dist/dbd5ba1d07.js +1 -0
- package/dist/dc2a1a0e13.js +1 -0
- package/dist/dc812f3e14.js +1 -0
- package/dist/dcbf419090.css +122 -0
- package/dist/dcdba78ddf.js +1 -0
- package/dist/de408c4516.js +1 -0
- package/dist/e1cd279733.js +1 -0
- package/dist/e379e0039b.js +1 -0
- package/dist/e4fe0551fd.js +1 -0
- package/dist/e6eed481cc.css +28 -0
- package/dist/e75f1e5992.js +1 -0
- package/dist/ea8577d22b.js +1 -0
- package/dist/ec4a34fc80.css +313 -0
- package/dist/ed6a54cdf6.js +1 -0
- package/dist/ee242c0099.js +1 -0
- package/dist/ee9b9fd7d1.js +1 -0
- package/dist/f0c3d8a28a.js +1 -0
- package/dist/f11a45a150.js +1 -0
- package/dist/f1b3b2622a.js +1 -0
- package/dist/f7b4a178e3.js +1 -0
- package/dist/f89d7cd931.js +1 -0
- package/dist/f8cb80a93c.js +1 -0
- package/dist/f8fec86f10.js +1 -0
- package/dist/fbd844f2d1.js +1 -0
- package/dist/fe235d7160.js +1 -0
- package/dist/fe58a84b85.js +1 -0
- package/dist/fe68b361ba.js +1 -0
- package/dist/ff5b3d17e2.js +1 -0
- package/dist/styles/globals.css +442 -0
- package/dist/styles/themes.css +532 -0
- package/dist/styles/variables.css +299 -0
- package/package.json +68 -0
- package/static/assets/draco/README.md +32 -0
- package/static/assets/draco/draco_decoder.js +34 -0
- package/static/assets/draco/draco_decoder.wasm +0 -0
- package/static/assets/draco/draco_encoder.js +35 -0
- package/static/assets/draco/draco_encoder.wasm +0 -0
- package/static/assets/draco/draco_encoder_wrapper.js +98 -0
- package/static/assets/draco/draco_wasm_wrapper.js +117 -0
- package/static/favicon.svg +28 -0
- package/static/version.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as f}from"react/jsx-runtime";import{Component as S,useSyncExternalStore as g}from"react";const o=new Map;let d=0;const i=new Set;function l(){d+=1;for(const t of i)try{t()}catch{}}const u=t=>typeof t=="string"?t.trim().toLowerCase():"";function k(t,e){const r=u(t);if(!r||typeof e!="function")return()=>{};const n=o.get(r)||[],s={render:e};return n.push(s),o.set(r,n),l(),()=>{const c=o.get(r);if(!c)return;const a=c.indexOf(s);a!==-1&&(c.splice(a,1),c.length===0&&o.delete(r),l())}}function w(){return Array.from(o.keys())}function C(t){const e=u(t);return!!e&&(o.get(e)?.length??0)>0}function b(){o.clear(),l()}function h(t){return i.add(t),()=>{i.delete(t)}}const p=()=>d;class y extends S{constructor(e){super(e),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){}render(){return this.state.failed?null:this.props.children}}function x({record:t,ctx:e,slotName:r}){const n=t.render;return f(y,{slotName:r,children:f(n,{...e||{}})})}function m({name:t,ctx:e}){g(h,p,p);const r=o.get(u(t));return!r||r.length===0?null:r.map((n,s)=>f(x,{slotName:t,record:n,ctx:e},`${t}:${s}`))}var v=m;export{m as SlotHost,b as _resetSlots,v as default,C as hasSlot,w as listSlots,k as registerSlot};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{evaluateConfiguration as C}from"./fbd844f2d1.js";import{emitEvent as p,EVENTS as s}from"./2e366d7386.js";import{recordEvaluationStarted as j,recordEvaluationSettled as T,recordEvaluationResult as R}from"./9f474b5d1a.js";import{getConfigState as m,getCatalogVersion as h,applyEvaluateResult as w,patchConfigState as V}from"./817d930a49.js";import{isLocalOnlyMutation as x,MutationType as S}from"./3c916f744f.js";let l=null,y=null;function H(t){y=typeof t=="function"?t:null}let d=null;function I(t){d=typeof t=="function"?t:null}let E=null;function U(t){E=typeof t=="function"?t:null}function v(t){if(E)try{E(t)}catch{}}let g=null;function b(t){g=typeof t=="function"?t:null}function D(t){t.type===S.SET_TRANSFORM&&V(i=>({...i,placements:(i.placements||[]).map(n=>String(n.id)===String(t.placementId)?{...n,transform:{position:t.position??n.transform?.position,rotation:t.rotation??n.transform?.rotation}}:n)}))}async function _(t,i,n){const u=m();return C({systemId:u.systemId,catalogVersion:i,state:u,mutation:t},{signal:n})}async function F(t,{optimistic:i,rollback:n}={}){if(!m()||!t)return null;if(x(t))return D(t),null;if(typeof i=="function")try{i()}catch{}let r=t;if(d&&r.context==null)try{const o=d();o&&typeof o=="object"&&Object.keys(o).length&&(r={...r,context:{focus:o}})}catch{}l&&l.abort();const c=new AbortController;l=c;const a=r.type===S.NOOP;a||v(!0),p(s.EVALUATE_STARTED,{mutation:r,internal:a}),j();const A=Date.now();let e=null;try{if(e=await _(r,h(),c.signal),e.staleCatalog)if(y){const f=(await y(e))?.catalogVersion??e.catalogVersion??h();e=await _(r,f,c.signal)}else return e}catch(o){if(o?.name==="AbortError")return null;if(typeof n=="function")try{n()}catch{}throw o}finally{l===c&&(l=null),a||v(!1),T()}w(e);{const o=e?.rejected?"rejected":"completed",f={mutation:r,internal:a,applied:!!e?.applied,rejected:!!e?.rejected,resolvedState:e?.resolvedState??null,warnings:e?.warnings??[],pricing:e?.pricing??null,code:e?.code??null,errors:Array.isArray(e?.errors)?e.errors:[]};R(o,f,e,Date.now()-A),p(o==="rejected"?s.EVALUATE_REJECTED:s.EVALUATE_COMPLETED,f),!a&&e?.pricing&&p(s.PRICE_CHANGED,e.pricing)}if(e.rejected&&typeof n=="function")try{n()}catch{}if(e.rejected&&r.type!=="noop"&&typeof g=="function")try{g(e,r)}catch{}return e}export{F as dispatch,U as setEvaluationStateHandler,I as setFocusProvider,H as setRefetchCatalogHandler,b as setRejectionHandler};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{assertLicensed as v}from"./fe235d7160.js";import{shouldBlockRequest as w,requestBlockedError as x,blockForAuthFailure as C}from"./631a9f7fac.js";import{authHeaders as $,isAuthFailure as S,reportAuthFailure as T,reportForbidden as P,getChannelId as b}from"./431a2d8618.js";import{ensureSessionToken as y,hasTokenProvider as j}from"./33fa2c8ca2.js";import{getApiBaseUrl as g}from"./8ade32d067.js";const p=new Map;function h(e){const t=b();if(!t||/\/api\/v1\/o\/[^/]+\/c\/[^/]+/.test(e)||/\/api\/v1\/channels\/[^/]+/.test(e))return e;const s=e.includes("?")?"&":"?";return`${e}${s}channelId=${encodeURIComponent(t)}`}async function n(e,t={},s=1){if(w(e))throw x(e);const a=!t.method||t.method==="GET";if(a&&!t.noCache&&p.has(e))return p.get(e);const i=`${g()}${e}`;await v(e),await y();let m=!1;for(let c=0;c<=s;c++)try{const r={"Content-Type":"application/json",...$(e),...t.headers};typeof FormData<"u"&&t.body instanceof FormData&&delete r["Content-Type"];const o=await fetch(i,{headers:r,...import.meta.env?.DEV&&a?{cache:"no-store"}:{},...t});if(!o.ok){if(S(o)){if(!m&&j()){m=!0,await y({force:!0}),c-=1;continue}await T(o,{url:e,method:t.method||"GET"})}o.status===403&&await P(o,{url:e,method:t.method||"GET"});const f=await o.text().catch(()=>""),d=new Error(`API ${t.method||"GET"} ${e} failed: ${o.status} ${o.statusText}${f?` \u2014 ${f}`:""}`);if(d.status=o.status,f)try{const u=JSON.parse(f);u&&typeof u=="object"&&(d.body=u,u.code&&(d.code=String(u.code)),u.detail&&(d.detail=u.detail))}catch{}throw(o.status===401||o.status===403&&a)&&C(d),d}const l=await o.json();return a&&!t.noCache&&p.set(e,l),l}catch(r){const o=c===s,l=!t.method||t.method==="GET";if(r?.code==="EMBED_NOT_LICENSED"||r?.status===401||r?.status===403||r?.status===404||o||!l)throw r;await new Promise(f=>setTimeout(f,1e3))}}function E(e){if(e==null){p.clear();return}for(const t of p.keys())String(t).includes(e)&&p.delete(t)}async function I(){return n(h("/api/v1/catalog/"))}async function ne({domain:e,url:t,systemId:s}={}){const a=new URLSearchParams;e&&a.set("domain",e),t&&a.set("url",t),s!=null&&s!==""&&a.set("systemId",String(s));const i=a.toString();return n(`/api/v1/configurator/status/${i?`?${i}`:""}`,{method:"GET",noCache:!0})}async function oe({contentType:e,fileSize:t}={}){return n("/api/v1/ar/models/presign/",{method:"POST",body:JSON.stringify({content_type:e,file_size:t})})}async function O(){return n("/api/v1/ai/images/quota/",{method:"GET",noCache:!0})}async function R(e){return n("/api/v1/ai/images/",{method:"POST",body:e})}async function A(){return n("/api/v1/auth/introspect/",{method:"GET",noCache:!0})}async function re(e){return n("/api/v1/ai/images/references/",{method:"POST",body:e})}async function ae(e){return n("/api/v1/ai/images/generate/",{method:"POST",body:JSON.stringify(e)})}async function se(e){return n(`/api/v1/ai/images/jobs/${encodeURIComponent(e)}/`,{method:"GET",noCache:!0})}async function F(){return n(h("/api/v1/systems/"))}async function k(e){return n(h(`/api/v1/systems/${e}/`))}async function G(e,t,s){const a=typeof s=="boolean"?s:typeof window<"u"&&window.top!==window.self,i=new URLSearchParams({embedded:a?"1":"0"});t&&i.set("parentOrigin",t);const m=`${g()}/api/embed/${encodeURIComponent(e)}/?${i}`,c=await fetch(m,{headers:{"Content-Type":"application/json"}});let r=null;try{r=await c.json()}catch{}if(!c.ok){const o=new Error(`embed boot ${c.status}`);throw o.status=c.status,o.code=r?.code||null,o.detail=r?.detail||null,o.hostname=r?.hostname||null,o}return r}async function U(e){return n(h(`/api/v1/catalog/?systemId=${encodeURIComponent(e)}`))}async function q(e){return n(h(`/api/v1/products/?systemId=${encodeURIComponent(e)}`))}async function N(){return n(h("/api/v1/products/"))}async function J(e){return e==null?null:n(`/api/v1/themes/${encodeURIComponent(e)}/`)}async function B(){return n("/api/v1/layouts/")}async function D(e){return n("/api/v1/projects/",{method:"POST",body:JSON.stringify(e)})}async function L(e){return n(`/api/v1/projects/by-token/${encodeURIComponent(e)}/`)}async function _(e,t){return n(`/api/v1/projects/${e}/`,{method:"PATCH",body:JSON.stringify(t)})}async function M(e,t,s="design_pdf"){const a=new FormData;return a.append("file",t),a.append("kind",s),n(`/api/v1/projects/${e}/renders/`,{method:"POST",body:a})}async function H(e,t){return n(`/api/v1/projects/${e}/renders/`,{method:"POST",body:JSON.stringify(t)})}async function z(e){return n(`/api/v1/channels/${e}/config/`)}async function Q(e){return n(`/api/v1/channels/${e}/products/`)}async function V(e){return n(`/api/v1/channels/${e}/option-sets/`)}async function K(e){return n(`/api/v1/channels/${e}/projects/`)}const W={invalidateCache:E,fetchAiImageQuota:O,uploadAiImage:R,fetchCatalog:I,fetchSystems:F,fetchSystem:k,fetchEmbedBoot:G,fetchCatalogForSystem:U,fetchProductsForSystem:q,fetchProducts:N,fetchTheme:J,fetchLayouts:B,saveProject:D,loadProject:L,updateProject:_,uploadProjectRender:H,uploadProjectRenderFile:M,introspectCredential:A,fetchChannelConfig:z,fetchChannelProducts:Q,fetchChannelOptionSets:V,fetchChannelProjects:K};var ce=W;export{ce as default,se as fetchAiImageJob,O as fetchAiImageQuota,I as fetchCatalog,U as fetchCatalogForSystem,z as fetchChannelConfig,V as fetchChannelOptionSets,Q as fetchChannelProducts,K as fetchChannelProjects,ne as fetchConfiguratorStatus,G as fetchEmbedBoot,B as fetchLayouts,N as fetchProducts,q as fetchProductsForSystem,k as fetchSystem,F as fetchSystems,J as fetchTheme,ae as generateAiImage,A as introspectCredential,E as invalidateCache,L as loadProject,oe as presignArModel,D as saveProject,_ as updateProject,R as uploadAiImage,re as uploadAiReference,H as uploadProjectRender,M as uploadProjectRenderFile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as ne,jsx as o,jsxs as l}from"react/jsx-runtime";import{HOSTED_PLACEMENT_ID_PREFIX as Ee,isHostedPlacementId as Re}from"./23dc0ccf32.js";import{useState as G,useEffect as te,useRef as L,useMemo as de,useCallback as _e}from"react";import ve from"./d94df858ea.js";import ye from"./9c6c598569.js";import se from"./872c4302e0.js";import ke,{deriveSceneFeatures as Se}from"./be337ddda5.js";import v from"./8f60e5059a.js";import{DownloadIcon as De}from"./c5e990946e.js";import"./b11b38869d.css";import{downloadLayoutJson as He}from"./37addc7fb3.js";import{FEATURE_TYPES as pe,findFeatureByType as xe}from"./f8cb80a93c.js";import{getEffectiveSelections as Ae}from"./817d930a49.js";function Oe(s){const n=JSON.stringify(s);let c=0;for(let a=0;a<n.length;a++){const $=n.charCodeAt(a);c=(c<<5)-c+$,c=c&c}return Math.abs(c).toString(16).padStart(8,"0")}const qe=new Set(["id"]);function Pe(s,n,c=""){const a=new Set;if(s===n)return a;if(typeof s!=typeof n||s===null||n===null)return c&&a.add(c),a;if(typeof s!="object")return s!==n&&c&&a.add(c),a;const $=new Set([...Object.keys(s),...Object.keys(n)]);for(const d of $){if(!c&&qe.has(d))continue;const _=c?`${c}.${d}`:d;if(!(d in s)||!(d in n))a.add(_);else{const C=Pe(s[d],n[d],_);for(const E of C)a.add(E)}}return a}function Fe(s){let n=s?.parentElement;for(;n&&n!==document.documentElement;){const{overflow:c,overflowY:a}=window.getComputedStyle(n);if(/auto|scroll/.test(c+a)&&n.scrollHeight>n.clientHeight)return n;n=n.parentElement}return null}function Ne(s,n,c=12){if(!s||!n)return;const a=s.scrollHeight<=s.clientHeight&&Fe(s)||s,$=a.getBoundingClientRect(),_=n.getBoundingClientRect().top-$.top+a.scrollTop;a.scrollTo({top:Math.max(0,_-c),behavior:"smooth"})}function We({embedded:s=!1}){const[n,c]=G(!1),a=L(null),$=v(e=>e.setLiveStatusSummary),d=L(!0),_=L(!0),C=L(null),E=L(null),R=ye(e=>e.activeSceneConfigId),oe=ve(e=>e.totalPrice),ae=v(e=>e.isSceneLoading),D=ye(e=>e.productInstances),H=v(e=>e.sceneHostedProducts),q=v(e=>e.hostStyles),X=v(e=>e.hostHandleTypes),x=v(e=>e.hostMaterials),F=v(e=>e.occupiedPieceSlots),U=v(e=>e.hostHardwareFinishes),y=v(e=>e.selectedPieceIndex),P=v(e=>e.is3D),W=v(e=>e.showWalls),J=v(e=>e.pieceConfigSnapshot),A=v(e=>e.hostProductOverrides),z=se(e=>e.materials),O=se(e=>e.options),Q=se(e=>e.features),we=ke(e=>e.sceneConfigurations),k=ve(e=>e.sceneSelections),re=ae?"processing":"stable",Y=we[R],je=v(e=>e.isLayoutLoading),B=de(()=>{const e={};for(const u of Se(Y)){const r=k[u.id];if(!r)continue;const h=O[r];h&&(e[u.id]={featureId:u.feature_id,featureName:u.name,featureType:u.type,optionId:h.id,optionName:h.name,value:h.value,priceModifier:h.price_modifier||0},h.value&&z[h.value]&&(e[u.id].material={id:h.value,color:z[h.value]?.color}))}return e},[Y,k,O,z]),fe=L(null),me=L(null),V=L({}),M=L(null),ce=L(0),[ie,he]=G(new Set),[Z,ge]=G([]),[ee,Le]=G(0),m=de(()=>{const e=Oe(k),u={};for(const[,t]of Object.entries(B))u[t.featureId]={optionId:t.optionId,name:t.optionName,value:t.value,...t.material&&{material:t.material},...t.priceModifier&&{priceModifier:t.priceModifier}};const r=xe(Se(Y),pe.LAYOUT),h=r&&B[r.id]?.optionName||null,p={};for(const t of Object.values(B))r&&String(t.featureId)===String(r.feature_id)||(p[t.featureName]=t.optionName);const i=se.getState(),f=t=>{if(t==null)return null;const b=O[t]?.name??O[String(t)]?.name;return b||Object.values(O).find(I=>String(I.value)===String(t))?.name||String(t)},S=Object.values(D||{}).map(t=>{const b=t.id??t.instanceId,g=i.getProduct?.(t.variantId??t.productId)||i.getProduct?.(t.productId)||null,I=Ae(b)||{},K={};for(const[T,w]of Object.entries(I)){if(w==null)continue;const j=Q[T]?.name||Q[String(T)]?.name||`OptionSet ${T}`;K[j]=f(w)}return{Id:b,Type:g?.name||g?.category||t.placementGroup||t.placement_group||"Product",...K,Width:g?.width!=null?`${g.width}`:null,Transform:{Position:{x:t.position?.[0]??0,y:t.position?.[1]??0,z:t.position?.[2]??0},Rotation:{x:t.rotation?.[0]??0,y:t.rotation?.[1]??0,z:t.rotation?.[2]??0},Scale:{x:t.scale?.[0]??1,y:t.scale?.[1]??1,z:t.scale?.[2]??1}}}}),N=H.map(t=>{const b=i.getHostedProduct(t.hostedProductId),g=Object.entries(F).find(([,w])=>w.hostedProductId===t.id),I=g?g[1]:null,K=g?g[0]:t.replacedPiece||null,T={};if(I?.featureSelections)for(const[w,j]of Object.entries(I.featureSelections))j&&(T[Q[w]?.name||w]=O[j]?.name||j);return{Id:t.id,Name:t.name||b?.name||t.hostedProductId,Host:K,...T,Transform:{Position:{x:t.position?.[0]??0,y:t.position?.[1]??0,z:t.position?.[2]??0},Rotation:{x:t.rotation?.[0]??0,y:t.rotation?.[1]??0,z:t.rotation?.[2]??0},Scale:{x:t.scale?.[0]??1,y:t.scale?.[1]??1,z:t.scale?.[2]??1}}}});return{Id:e,Layout:h,View:P?"3D":"2D",Walls:W?"Yes":"No",...p,Pieces:S,HostedProducts:N}},[B,k,oe,D,H,q,X,x,F,U,O,z,Q,P,W]);te(()=>{const e=fe.current,u=me.current;if(e!==null&&u!==null){const r=[],h=new Set([...Object.keys(e),...Object.keys(k)]);for(const i of h)if(e[i]!==k[i]){const f=B[i];f&&(r.push(`${f.featureName} changed to ${f.optionName}`),(f.featureType===pe.LAYOUT||f.featureType===pe.FREE_PIECE)&&(ce.current=Date.now()))}const p=Pe(u,m);if(r.length===0&&p.size>0){const i=[...p].some(t=>t.startsWith("Pieces")),f=[...p].some(t=>t.startsWith("pricing")),S=p.has("Layout");if(S){const t=m.Layout||"Unknown";r.push(`Layout changed to ${t}`),ce.current=Date.now()}p.has("View")&&r.push(`View changed to ${m.View}`),p.has("Walls")&&r.push(`Walls ${m.Walls==="Yes"?"shown":"hidden"}`);const N=Date.now()-ce.current<3e3;if(!S&&!N&&i){const t=[...p].filter(g=>g.startsWith("Pieces.")),b=new Set(t.map(g=>g.split(".")[1]));if(b.size===1){const g=[...b][0],I=m.Pieces?.[g];if(I){const K=t.map(j=>j.split(".")[2]).filter(Boolean),T=[...new Set(K)],w=I.Id||`Product ${g}`;if(T.length===1){const j=T[0],ue=I[j],Ce=ue!==null&&typeof ue=="object"?"":` to "${ue}"`;r.push(`Changing ${j}${Ce} for ${w}`)}else r.push(`Updating ${w}`)}}else r.push("Scene updated")}f&&!S&&!i&&r.push("Pricing updated")}if(p.size>0){he(i=>{const f=new Set(i);for(const S of p)f.add(S);return f}),r.length>0&&ge(r.slice(0,3)),Le(i=>i+1);for(const i of p)V.current[i]&&clearTimeout(V.current[i]),V.current[i]=setTimeout(()=>{he(f=>{const S=new Set(f);return S.delete(i),S}),delete V.current[i]},3e3);if(r.length>0&&$(r[0]),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{ge([]),M.current=null},3e3),a.current){const i=[...p].find(N=>N==="View"||N==="Walls"),f=d.current?[...p].find(N=>N.startsWith("Pieces.")||N.startsWith("HostedProducts.")):null,S=i||(f?`${f.split(".")[0]}.${f.split(".")[1]}`:null);S&&setTimeout(()=>{requestAnimationFrame(()=>{const N=a.current?.querySelector(`[data-path="${S}"]`);Ne(a.current,N)})},50)}}}fe.current={...k},me.current=m},[k,B,m]),te(()=>{const e=a.current;if(!e)return;d.current=!0,_.current=!0;const u=()=>{d.current=!1,_.current=!1};return e.addEventListener("wheel",u),e.addEventListener("touchstart",u),()=>{e.removeEventListener("wheel",u),e.removeEventListener("touchstart",u)}},[n]),te(()=>()=>{Object.values(V.current).forEach(clearTimeout),M.current&&clearTimeout(M.current)},[]),te(()=>{if(!y||!a.current||((C.current!==y||E.current!==m.Pieces)&&(_.current=!0),C.current=y,E.current=m.Pieces,!_.current))return;let e=null;const u=m.Pieces?.findIndex(r=>r.Id===y);if(u!==-1&&u!==void 0)e=`Pieces.${u}`;else{const r=Re(y)?y.slice(Ee.length):y,h=m.HostedProducts?.findIndex(p=>p.Id===y||p.Id===r);h!==-1&&h!==void 0&&(e=`HostedProducts.${h}`)}e&&setTimeout(()=>{requestAnimationFrame(()=>{const r=a.current?.querySelector(`[data-path="${e}"]`);Ne(a.current,r)})},50)},[y,m.Pieces,m.HostedProducts]);const le=ie.size>0,$e=de(()=>new URLSearchParams(window.location.search).get("layout")==="1",[]),Te=_e(e=>{e.stopPropagation(),He({sceneConfig:Y,pieceConfigSnapshot:J,hostProductOverrides:A,activeSceneConfigId:R,layoutName:m.Layout||null})},[Y,J,A,R,m]);return s?l("div",{className:"live-status-bar live-status-bar--embedded",children:[le&&Z.length>0&&l("div",{className:"live-status-bar__change-banner",children:[o("span",{className:"live-status-bar__change-dot"}),o("span",{className:"live-status-bar__change-text",children:Z.join(" \xB7 ")})]},ee),o("div",{className:"live-status-bar__content live-status-bar__content--embedded",ref:a,children:o("div",{className:"live-status-bar__code",children:o(Ie,{data:m,changedPaths:ie,flashKey:ee})})})]}):l("div",{className:`live-status-bar ${n?"live-status-bar--expanded":""} ${le&&!n?"live-status-bar--flash":""}`,children:[l("div",{className:"live-status-bar__header",onClick:()=>c(!n),children:[o("div",{className:"live-status-bar__left",children:o("span",{className:"live-status-bar__title",children:"LIVE STATUS"})}),l("div",{className:"live-status-bar__right",children:[o("button",{style:$e?{}:{display:"none"},className:"live-status-bar__download-btn",onClick:Te,title:"Download Layout JSON",children:o(De,{width:14,height:14})}),l("span",{className:`live-status-bar__badge live-status-bar__badge--${re}`,children:[o("span",{className:`live-status-bar__badge-dot live-status-bar__badge-dot--${re}`}),re==="processing"?"UPDATING":"STABLE"]})]})]}),!je&&le&&Z.length>0&&l("div",{className:"live-status-bar__change-banner",children:[o("span",{className:"live-status-bar__change-dot"}),o("span",{className:"live-status-bar__change-text",children:Z.join(" \xB7 ")})]},ee),n&&o("div",{className:"live-status-bar__content",ref:a,children:o("div",{className:"live-status-bar__code",children:o(Ie,{data:m,changedPaths:ie,flashKey:ee})})})]},`bar-${n}`)}function ze(s){if(Array.isArray(s))return`[${s.length} item${s.length!==1?"s":""}]`;const n=Object.keys(s);return`{${n.length} key${n.length!==1?"s":""}}`}function Be({value:s}){return s===null?o("span",{className:"json-null",children:"null"}):typeof s=="string"?l("span",{className:"json-string",children:['"',s,'"']}):typeof s=="number"?o("span",{className:"json-number",children:s}):typeof s=="boolean"?o("span",{className:"json-boolean",children:String(s)}):o("span",{children:String(s)})}function be({keyName:s,value:n,isLast:c,depth:a=0,defaultOpen:$=!0,path:d="",changedPaths:_,flashKey:C}){const E=n!==null&&typeof n=="object",[R,oe]=G($),ae=_e(()=>{E&&oe(P=>!P)},[E]),D=c?"":",",H=a*14,q=_&&_.size>0&&_.has(d),X=`json-tree__row${q?" json-tree__row--changed":""}`;if(!E)return o("div",{className:X,"data-path":d,children:l("span",{className:"json-tree__content",style:{paddingLeft:H},children:[s!==void 0&&l(ne,{children:[l("span",{className:"json-key",children:['"',s,'"']}),o("span",{className:"json-tree__colon",children:": "})]}),o(Be,{value:n}),D]})},q?`flash-${C}`:void 0);const x=Array.isArray(n),F=x?n.map((P,W)=>[W,P]):Object.entries(n),U=x?"[":"{",y=x?"]":"}";return F.length===0?o("div",{className:X,children:l("span",{className:"json-tree__content",style:{paddingLeft:H},children:[s!==void 0&&l(ne,{children:[l("span",{className:"json-key",children:['"',s,'"']}),o("span",{className:"json-tree__colon",children:": "})]}),l("span",{children:[U,y]}),D]})}):l("div",{className:"json-tree__node","data-path":d,children:[o("div",{className:`json-tree__row json-tree__row--toggle ${R?"json-tree__row--open":""} ${q?"json-tree__row--changed":""}`,onClick:ae,children:l("span",{className:"json-tree__content",style:{paddingLeft:H},children:[o("span",{className:`json-tree__arrow ${R?"json-tree__arrow--open":""}`}),s!==void 0&&l(ne,{children:[l("span",{className:"json-key",children:['"',s,'"']}),o("span",{className:"json-tree__colon",children:": "})]}),R?o("span",{className:"json-tree__bracket",children:U}):l("span",{children:[o("span",{className:"json-tree__bracket",children:U}),o("span",{className:"json-tree__preview",children:ze(n)}),o("span",{className:"json-tree__bracket",children:y}),D]})]})},q?`flash-${C}`:void 0),R&&l(ne,{children:[F.map(([P,W],J)=>{const A=x?void 0:P,z=A==="Position"||A==="Rotation"||A==="Scale";return o(be,{keyName:A,value:W,isLast:J===F.length-1,depth:a+1,defaultOpen:!z,path:d?`${d}.${P}`:String(P),changedPaths:_,flashKey:C},x?J:P)}),o("div",{className:"json-tree__row",children:l("span",{className:"json-tree__content",style:{paddingLeft:H},children:[o("span",{className:"json-tree__bracket",children:y}),D]})})]})]})}function Ie({data:s,changedPaths:n,flashKey:c}){return o("div",{className:"json-tree",children:o(be,{value:s,isLast:!0,defaultOpen:!0,path:"",changedPaths:n,flashKey:c})})}var st=We;export{st as default};
|
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
@layer sdk-base, vendor, sdk;
|
|
2
|
+
@layer sdk {
|
|
3
|
+
.main-layout {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
height: 100%;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
background: var(--bg-secondary);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.main-layout__content {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex: 1;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.main-layout__scene {
|
|
19
|
+
flex: 1;
|
|
20
|
+
position: relative;
|
|
21
|
+
background: var(--bg-scene);
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.main-layout__scene--sidebar-open {
|
|
26
|
+
padding-left: calc(var(--sidebar-width) + 24px);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Sidebar toggle button when collapsed */
|
|
30
|
+
.sidebar-toggle-btn {
|
|
31
|
+
display: flex;
|
|
32
|
+
width: 46.5px;
|
|
33
|
+
height: 46.5px;
|
|
34
|
+
padding: 7.45px 13.038px;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
align-items: center;
|
|
37
|
+
position: absolute;
|
|
38
|
+
left: 12px;
|
|
39
|
+
top: 12px;
|
|
40
|
+
background: var(--bg-primary, #FEFEFE);
|
|
41
|
+
border: 1px solid var(--border-light, #E1E1E1);
|
|
42
|
+
border-radius: 8px;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
z-index: 15;
|
|
45
|
+
transition: background 0.15s ease;
|
|
46
|
+
box-shadow: 0 0 40px 0 rgba(0, 0, 0, 0.12);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.sidebar-toggle-btn:hover {
|
|
50
|
+
background: var(--bg-secondary, #f0f0f0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.sidebar-toggle-btn svg {
|
|
54
|
+
width: 24px;
|
|
55
|
+
height: 24px;
|
|
56
|
+
color: var(--text-primary, #363636);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Tablet (768-1023px) */
|
|
60
|
+
@media (max-width: 1023px) and (min-width: 768px) {
|
|
61
|
+
.sidebar-toggle-btn {
|
|
62
|
+
width: 40px;
|
|
63
|
+
height: 40px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* ============================================
|
|
68
|
+
BACKEND-SELECTABLE LAYOUT TEMPLATES
|
|
69
|
+
--------------------------------------------
|
|
70
|
+
Same shared components (Sidebar, scene, toolbar, options) — only the
|
|
71
|
+
ARRANGEMENT differs. Selected by /systems/<id>/.uiTemplate → the shell's
|
|
72
|
+
`main-layout--tpl-<key>` modifier class (see MainLayout.jsx / layouts/registry.js).
|
|
73
|
+
Add a new arrangement by adding a block here — no new component required.
|
|
74
|
+
============================================ */
|
|
75
|
+
|
|
76
|
+
/* --- tpl: sidebar-right — dock the sidebar to the right edge --- */
|
|
77
|
+
.main-layout--tpl-sidebar-right .sidebar-container {
|
|
78
|
+
left: auto;
|
|
79
|
+
right: 12px;
|
|
80
|
+
}
|
|
81
|
+
.main-layout--tpl-sidebar-right .main-layout__scene--sidebar-open {
|
|
82
|
+
padding-left: 0;
|
|
83
|
+
padding-right: calc(var(--sidebar-width) + 24px);
|
|
84
|
+
}
|
|
85
|
+
.main-layout--tpl-sidebar-right .sidebar-toggle-btn {
|
|
86
|
+
left: auto;
|
|
87
|
+
right: 12px;
|
|
88
|
+
}
|
|
89
|
+
/* Sidebar moved right → move the scene action toolbar (2D/fullscreen/refresh)
|
|
90
|
+
and generate/save buttons to the left so they clear the sidebar. */
|
|
91
|
+
.main-layout--tpl-sidebar-right .header {
|
|
92
|
+
right: auto;
|
|
93
|
+
left: 12px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* --- tpl: compact — narrower sidebar, less scene reservation --- */
|
|
97
|
+
.main-layout--tpl-compact {
|
|
98
|
+
--sidebar-width: 280px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* --- tpl: floating — scene runs full-bleed; the sidebar floats over it
|
|
102
|
+
instead of reserving a column (no scene padding when open) --- */
|
|
103
|
+
.main-layout--tpl-floating .main-layout__scene--sidebar-open {
|
|
104
|
+
padding-left: 0;
|
|
105
|
+
}
|
|
106
|
+
.main-layout--tpl-floating .sidebar-container {
|
|
107
|
+
box-shadow: 0 8px 48px 0 rgba(0, 0, 0, 0.22);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* ============================================
|
|
111
|
+
MOBILE LAYOUT
|
|
112
|
+
============================================ */
|
|
113
|
+
.main-layout--mobile {
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
height: 100svh;
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Wrapper for scene + accordion — fills remaining space after top bar & toolbar */
|
|
121
|
+
.mobile-main {
|
|
122
|
+
flex: 1;
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
min-height: 0;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
transition: flex-direction 0.35s cubic-bezier(0.4, 0, 0.2, 1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.main-layout--mobile .main-layout__scene {
|
|
131
|
+
flex: 1 1 0%;
|
|
132
|
+
min-height: 0;
|
|
133
|
+
position: relative;
|
|
134
|
+
background: var(--bg-scene);
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
transition: flex 0.35s cubic-bezier(0.4, 0, 0.2, 1);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
/* Mobile Top Bar — Row 1: Logo + Generate */
|
|
141
|
+
.mobile-top-bar {
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: space-between;
|
|
145
|
+
padding: 10px 14px;
|
|
146
|
+
background: var(--bg-primary, #fff);
|
|
147
|
+
flex-shrink: 0;
|
|
148
|
+
animation: topBarFadeIn 0.3s ease-out;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@keyframes topBarFadeIn {
|
|
152
|
+
from { opacity: 0; max-height: 0; padding: 0 14px; }
|
|
153
|
+
to { opacity: 1; max-height: 60px; padding: 10px 14px; }
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.mobile-top-bar__logo {
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
gap: 8px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.mobile-top-bar__logo-icon {
|
|
163
|
+
width: 22px;
|
|
164
|
+
height: 20px;
|
|
165
|
+
flex-shrink: 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.mobile-top-bar__title {
|
|
169
|
+
font-size: 14px;
|
|
170
|
+
font-weight: 600;
|
|
171
|
+
color: var(--text-primary, #141414);
|
|
172
|
+
letter-spacing: -0.2px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* Mobile Toolbar — floating overlay on canvas, collapsible */
|
|
176
|
+
.mobile-toolbar {
|
|
177
|
+
position: absolute;
|
|
178
|
+
top: 50%;
|
|
179
|
+
left: 0;
|
|
180
|
+
transform: translateY(-50%);
|
|
181
|
+
z-index: 20;
|
|
182
|
+
display: flex;
|
|
183
|
+
flex-direction: column;
|
|
184
|
+
align-items: center;
|
|
185
|
+
padding: 3px;
|
|
186
|
+
background: rgba(255, 255, 255, 0.8);
|
|
187
|
+
border-radius: 0 8px 8px 0;
|
|
188
|
+
box-shadow: 1px 0 8px rgba(0, 0, 0, 0.1);
|
|
189
|
+
backdrop-filter: blur(8px);
|
|
190
|
+
-webkit-backdrop-filter: blur(8px);
|
|
191
|
+
pointer-events: auto;
|
|
192
|
+
max-height: calc(100% - 16px);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* Buttons wrapper */
|
|
196
|
+
.mobile-toolbar__buttons {
|
|
197
|
+
display: flex;
|
|
198
|
+
flex-direction: column;
|
|
199
|
+
overflow-y: auto;
|
|
200
|
+
overflow-x: hidden;
|
|
201
|
+
scrollbar-width: none; /* Firefox */
|
|
202
|
+
-ms-overflow-style: none; /* IE/Edge */
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.mobile-toolbar__buttons::-webkit-scrollbar {
|
|
206
|
+
display: none; /* Chrome/Safari */
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.mobile-toolbar__left,
|
|
210
|
+
.mobile-toolbar__right {
|
|
211
|
+
display: flex;
|
|
212
|
+
flex-direction: column;
|
|
213
|
+
align-items: center;
|
|
214
|
+
gap: 1px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.mobile-toolbar__btn {
|
|
218
|
+
display: flex;
|
|
219
|
+
align-items: center;
|
|
220
|
+
justify-content: center;
|
|
221
|
+
width: 30px;
|
|
222
|
+
height: 30px;
|
|
223
|
+
border: none;
|
|
224
|
+
background: transparent;
|
|
225
|
+
border-radius: 5px;
|
|
226
|
+
cursor: pointer;
|
|
227
|
+
color: var(--text-secondary, #666);
|
|
228
|
+
transition: all 0.15s ease;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.mobile-toolbar__btn:hover {
|
|
232
|
+
background: rgba(0, 0, 0, 0.06);
|
|
233
|
+
color: var(--text-primary, #333);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.mobile-toolbar__btn--active {
|
|
237
|
+
background: var(--bg-secondary, #f0f0f0);
|
|
238
|
+
color: var(--color-brand-primary);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.mobile-toolbar__btn svg {
|
|
242
|
+
width: 16px;
|
|
243
|
+
height: 16px;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.mobile-toolbar__label {
|
|
247
|
+
font-size: 9px;
|
|
248
|
+
font-weight: 600;
|
|
249
|
+
letter-spacing: 0.2px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* ============================================
|
|
253
|
+
MOBILE TABS — Horizontal tab bar at bottom
|
|
254
|
+
============================================ */
|
|
255
|
+
.mobile-tabs {
|
|
256
|
+
flex: 0 0 60%;
|
|
257
|
+
overflow: hidden;
|
|
258
|
+
background: var(--bg-primary, #FEFEFE);
|
|
259
|
+
display: flex;
|
|
260
|
+
flex-direction: column;
|
|
261
|
+
transition: flex-basis 0.35s cubic-bezier(0.4, 0, 0.2, 1);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* Tab Bar — horizontal row of tabs */
|
|
265
|
+
.mobile-tabs__bar {
|
|
266
|
+
display: flex;
|
|
267
|
+
align-items: stretch;
|
|
268
|
+
gap: 0;
|
|
269
|
+
flex-shrink: 0;
|
|
270
|
+
background: var(--bg-primary, #fff);
|
|
271
|
+
border-bottom: 2px solid #ebebeb;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Individual Tab */
|
|
275
|
+
.mobile-tabs__tab {
|
|
276
|
+
display: flex;
|
|
277
|
+
align-items: center;
|
|
278
|
+
justify-content: center;
|
|
279
|
+
gap: 6px;
|
|
280
|
+
flex: 1;
|
|
281
|
+
padding: 10px 8px;
|
|
282
|
+
border: none;
|
|
283
|
+
border-bottom: 2px solid transparent;
|
|
284
|
+
margin-bottom: -2px;
|
|
285
|
+
background: transparent;
|
|
286
|
+
cursor: pointer;
|
|
287
|
+
user-select: none;
|
|
288
|
+
font-family: inherit;
|
|
289
|
+
color: var(--text-tertiary, #999);
|
|
290
|
+
-webkit-tap-highlight-color: transparent;
|
|
291
|
+
outline: none;
|
|
292
|
+
transition: all 0.2s ease;
|
|
293
|
+
white-space: nowrap;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.mobile-tabs__tab svg {
|
|
297
|
+
width: 16px;
|
|
298
|
+
height: 16px;
|
|
299
|
+
flex-shrink: 0;
|
|
300
|
+
opacity: 0.6;
|
|
301
|
+
transition: opacity 0.2s ease;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.mobile-tabs__tab--active {
|
|
305
|
+
color: var(--color-brand-primary, #EC4E0B);
|
|
306
|
+
border-bottom-color: var(--color-brand-primary, #EC4E0B);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.mobile-tabs__tab--active svg {
|
|
310
|
+
opacity: 1;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.mobile-tabs__tab-label {
|
|
314
|
+
font-size: 12px;
|
|
315
|
+
font-weight: 600;
|
|
316
|
+
letter-spacing: 0.2px;
|
|
317
|
+
line-height: 1;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/* Status badge dot (for Live Status tab) */
|
|
321
|
+
.mobile-tabs__badge-dot {
|
|
322
|
+
width: 6px;
|
|
323
|
+
height: 6px;
|
|
324
|
+
border-radius: 50%;
|
|
325
|
+
flex-shrink: 0;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.mobile-tabs__badge-dot--stable {
|
|
329
|
+
background: #4caf50;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.mobile-tabs__badge-dot--processing {
|
|
333
|
+
background: var(--color-brand-primary, #EC4E0B);
|
|
334
|
+
animation: mobileStatusPulse 1.5s ease-in-out infinite;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
@keyframes mobileStatusPulse {
|
|
338
|
+
0%, 100% { opacity: 1; }
|
|
339
|
+
50% { opacity: 0.4; }
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/* Tab Content Area */
|
|
343
|
+
.mobile-tabs__content {
|
|
344
|
+
flex: 1;
|
|
345
|
+
min-height: 0;
|
|
346
|
+
display: flex;
|
|
347
|
+
flex-direction: column;
|
|
348
|
+
overflow: hidden;
|
|
349
|
+
animation: tabContentIn 0.2s ease-out;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
@keyframes tabContentIn {
|
|
353
|
+
from {
|
|
354
|
+
opacity: 0;
|
|
355
|
+
}
|
|
356
|
+
to {
|
|
357
|
+
opacity: 1;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/* Tab Panel */
|
|
362
|
+
.mobile-tabs__panel {
|
|
363
|
+
flex: 1;
|
|
364
|
+
min-height: 0;
|
|
365
|
+
overflow-y: auto;
|
|
366
|
+
padding: 14px;
|
|
367
|
+
scrollbar-width: none;
|
|
368
|
+
-ms-overflow-style: none;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.mobile-tabs__panel::-webkit-scrollbar {
|
|
372
|
+
display: none;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.mobile-tabs__panel--chat {
|
|
376
|
+
padding: 0;
|
|
377
|
+
display: flex;
|
|
378
|
+
flex-direction: column;
|
|
379
|
+
overflow: hidden;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.mobile-tabs__panel--livestatus {
|
|
383
|
+
padding: 0;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/* Configurator panel: flex column so the sticky header sits outside the scroll area */
|
|
387
|
+
.mobile-tabs__panel--configurator {
|
|
388
|
+
padding: 0;
|
|
389
|
+
display: flex;
|
|
390
|
+
flex-direction: column;
|
|
391
|
+
overflow: hidden;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/* ============================================
|
|
395
|
+
LANDSCAPE MODE — Horizontal layout
|
|
396
|
+
============================================ */
|
|
397
|
+
|
|
398
|
+
/* Switch mobile-main from vertical to horizontal in landscape */
|
|
399
|
+
.main-layout--landscape .mobile-main,
|
|
400
|
+
.mobile-main--landscape {
|
|
401
|
+
flex-direction: row;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/* Scene takes 60% width in landscape — no flex transition so canvas sizes correctly */
|
|
405
|
+
.main-layout--landscape .main-layout__scene {
|
|
406
|
+
flex: 0 0 60%;
|
|
407
|
+
min-width: 0;
|
|
408
|
+
height: 100%;
|
|
409
|
+
transition: none;
|
|
410
|
+
position: relative;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/* Force scene-canvas to fill the flex item via absolute positioning
|
|
414
|
+
so R3F's ResizeObserver gets correct resolved pixel dimensions */
|
|
415
|
+
.main-layout--landscape .scene-canvas {
|
|
416
|
+
position: absolute;
|
|
417
|
+
top: 0;
|
|
418
|
+
left: 0;
|
|
419
|
+
right: 0;
|
|
420
|
+
bottom: 0;
|
|
421
|
+
width: auto;
|
|
422
|
+
height: auto;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/* Tabs take 40% width in landscape */
|
|
426
|
+
.main-layout--landscape .mobile-tabs {
|
|
427
|
+
flex: 0 0 40%;
|
|
428
|
+
height: 100%;
|
|
429
|
+
overflow: hidden;
|
|
430
|
+
border-left: 1px solid #ebebeb;
|
|
431
|
+
transition: none;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/* In landscape, collapsed tabs should still take 40% (just show tab bar) */
|
|
435
|
+
.main-layout--landscape .mobile-tabs--collapsed {
|
|
436
|
+
flex-basis: 40%;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* ---- Landscape Sidebar (right panel) ---- */
|
|
440
|
+
.landscape-sidebar {
|
|
441
|
+
display: flex;
|
|
442
|
+
flex-direction: row;
|
|
443
|
+
width: 280px;
|
|
444
|
+
height: 100%;
|
|
445
|
+
flex-shrink: 0;
|
|
446
|
+
background: var(--bg-primary, #FEFEFE);
|
|
447
|
+
border-left: 1px solid #ebebeb;
|
|
448
|
+
position: relative;
|
|
449
|
+
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
450
|
+
overflow: hidden;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.landscape-sidebar--collapsed {
|
|
454
|
+
width: 36px;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/* Toggle button for collapsing/expanding sidebar */
|
|
458
|
+
.landscape-sidebar__toggle {
|
|
459
|
+
position: absolute;
|
|
460
|
+
top: 50%;
|
|
461
|
+
left: 0;
|
|
462
|
+
transform: translateY(-50%);
|
|
463
|
+
width: 24px;
|
|
464
|
+
height: 48px;
|
|
465
|
+
border: none;
|
|
466
|
+
background: var(--bg-secondary, #f0f0f0);
|
|
467
|
+
border-radius: 0 6px 6px 0;
|
|
468
|
+
cursor: pointer;
|
|
469
|
+
z-index: 5;
|
|
470
|
+
display: flex;
|
|
471
|
+
align-items: center;
|
|
472
|
+
justify-content: center;
|
|
473
|
+
color: var(--text-secondary, #666);
|
|
474
|
+
transition: background 0.15s ease;
|
|
475
|
+
-webkit-tap-highlight-color: transparent;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.landscape-sidebar__toggle:hover {
|
|
479
|
+
background: var(--border-default, #e0e0e0);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.landscape-sidebar__toggle svg {
|
|
483
|
+
width: 16px;
|
|
484
|
+
height: 16px;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/* Vertical tab strip */
|
|
488
|
+
.landscape-sidebar__tabs {
|
|
489
|
+
display: flex;
|
|
490
|
+
flex-direction: column;
|
|
491
|
+
width: 52px;
|
|
492
|
+
flex-shrink: 0;
|
|
493
|
+
background: var(--bg-muted, #f7f7f7);
|
|
494
|
+
border-right: 1px solid #ebebeb;
|
|
495
|
+
padding: 8px 0;
|
|
496
|
+
gap: 2px;
|
|
497
|
+
align-items: center;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.landscape-sidebar__tab {
|
|
501
|
+
display: flex;
|
|
502
|
+
flex-direction: column;
|
|
503
|
+
align-items: center;
|
|
504
|
+
justify-content: center;
|
|
505
|
+
gap: 3px;
|
|
506
|
+
width: 44px;
|
|
507
|
+
height: 52px;
|
|
508
|
+
border: none;
|
|
509
|
+
background: transparent;
|
|
510
|
+
border-radius: 6px;
|
|
511
|
+
cursor: pointer;
|
|
512
|
+
color: var(--text-tertiary, #999);
|
|
513
|
+
transition: all 0.15s ease;
|
|
514
|
+
-webkit-tap-highlight-color: transparent;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.landscape-sidebar__tab span {
|
|
518
|
+
font-size: 9px;
|
|
519
|
+
font-weight: 600;
|
|
520
|
+
letter-spacing: 0.2px;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.landscape-sidebar__tab svg {
|
|
524
|
+
width: 16px;
|
|
525
|
+
height: 16px;
|
|
526
|
+
opacity: 0.6;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.landscape-sidebar__tab--active {
|
|
530
|
+
color: var(--color-brand-primary, #EC4E0B);
|
|
531
|
+
background: rgba(236, 78, 11, 0.08);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.landscape-sidebar__tab--active svg {
|
|
535
|
+
opacity: 1;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/* Sidebar content area */
|
|
539
|
+
.landscape-sidebar__content {
|
|
540
|
+
flex: 1;
|
|
541
|
+
min-width: 0;
|
|
542
|
+
overflow-y: auto;
|
|
543
|
+
overflow-x: hidden;
|
|
544
|
+
padding: 10px;
|
|
545
|
+
scrollbar-width: none;
|
|
546
|
+
-ms-overflow-style: none;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.landscape-sidebar__content::-webkit-scrollbar {
|
|
550
|
+
display: none;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/* ============================================
|
|
554
|
+
iOS CSS ROTATION FALLBACK
|
|
555
|
+
============================================ */
|
|
556
|
+
.main-layout--css-rotated {
|
|
557
|
+
position: fixed;
|
|
558
|
+
top: 0;
|
|
559
|
+
left: 0;
|
|
560
|
+
/* Swap dimensions: viewport height becomes width, viewport width becomes height */
|
|
561
|
+
width: 100vh;
|
|
562
|
+
height: 100vw;
|
|
563
|
+
transform-origin: top left;
|
|
564
|
+
transform: rotate(-90deg) translateX(-100%);
|
|
565
|
+
z-index: 9999;
|
|
566
|
+
overflow: hidden;
|
|
567
|
+
/* Safe area padding for notched devices */
|
|
568
|
+
padding-left: env(safe-area-inset-top, 0px);
|
|
569
|
+
padding-right: env(safe-area-inset-bottom, 0px);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as a}from"react/jsx-runtime";import"./30be653f00.css";function c({title:l,body:o,fix:e=null,reason:s="error",onRetry:t=null}){const n=(()=>{try{return!!import.meta.env?.DEV}catch{return!1}})();return r("div",{className:"error-screen boot-error","data-part":"boot-error","data-reason":s,role:"alert",children:a("div",{className:"boot-error__card",children:[r("h1",{className:"boot-error__title",children:l}),o?r("p",{className:"boot-error__body",children:o}):null,t?r("button",{type:"button",className:"boot-error__retry",onClick:t,children:"Try again"}):null,n&&e?a("details",{className:"boot-error__dev",children:[r("summary",{className:"boot-error__dev-tag",children:"For the developer"}),r("p",{className:"boot-error__dev-fix",children:e})]}):null]})})}export{c as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const w=.0254,a=.9,i=c=>{const t=c?.width;return typeof t=="number"&&t>0?t*.0254:.9};var _={id:"append-sequence",label:"Append in a row",mode:"compute",computeLayout(c,{getProduct:t,getDims:r}){let n=0;const e=[];for(const s of c||[]){const o=r?.(s.productId),d=o?.width>0?o.width:i(t(s.productId)),u=o?.cx||0,p=o?.cz||0;e.push({position:[n+d/2-u,0,-p],rotation:[0,0,0]}),n+=d}return e}};export{_ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import h from"./8f60e5059a.js";import d from"./d94df858ea.js";import u from"./be337ddda5.js";import{captureSceneState as y,restoreSceneState as _}from"./1fac915f8b.js";import{buildCanonicalState as g}from"./bcd44b4040.js";const b=1;function w(){const e=u.getState();let t=null;try{const c=new URLSearchParams(window.location.search);c.has("theme")&&(t=c.get("theme"))}catch{}const r=e.systemTheme??null,o=e.systemThemeRecord??null;return r==null&&o==null&&t==null?null:{systemTheme:r,systemThemeRecord:o,preview:t}}function T(e){if(!(!e||typeof e!="object"))try{e.preview!=null?u.setState({systemTheme:String(e.preview),systemThemeRecord:null}):u.setState({systemTheme:e.systemTheme??null,systemThemeRecord:e.systemThemeRecord??null})}catch{}}function m(e){switch(e){case"left":return"left";case"right":case"side":return"right";case"front":case"front-left":case"front-right":return"front";default:return"back"}}function p(e,t){if(!e)return"back";for(const[r,o]of Object.entries(e))if(Array.isArray(o)&&o.map(String).includes(String(t)))return r;return"back"}function P(e,t={}){const r=e.indexOf("-"),o=r===-1?e:e.slice(0,r),c=r===-1?null:e.slice(r+1);switch(o){case"base":return`floor_${m(p(t.baseByWall,c))}`;case"upper":return`wall_${m(p(t.upperByWall,c))}`;case"tall":return"floor_tall";case"corner":return"floor_back_corner";case"wallcorner":case"wallCorner":return"wall_back_corner";case"counter":return"countertop";default:return o}}function v(){const e=h.getState(),t=e.basePiecePositions||{},r=e.hostProductOverrides||{},o=e.pieceConfigSnapshot||{},c=e.occupiedPieceSlots||{},i=[],l={},a=n=>(l[n]=(l[n]??-1)+1,l[n]),S=Object.keys(t).sort((n,s)=>n.localeCompare(s,void 0,{numeric:!0}));for(const n of S){const s=r[n]??t[n]?.productId??null;if(s==null)continue;const f=P(n,o);i.push({variant_id:s,placement_group:f,sequence:a(f),...c[n]?.hostedProductId?{has_hosted_product:!0}:{}})}for(const n of e.sceneHostedProducts||[])n?.hostedProductId!=null&&i.push({variant_id:n.hostedProductId,placement_group:"appliance",sequence:a("appliance")});return i}function C(){return{_v:b,placements:v(),system_selections:{...d.getState().sceneSelections},environment_overrides:null,theme:w(),_state:y(),canonical:g()}}function q(e){if(!e||typeof e!="object")return!1;if(T(e.theme),e._state)return _(e._state);const t=e.system_selections;if(t&&typeof t=="object"){const r=d.getState().setSceneSelection;for(const[o,c]of Object.entries(t))try{r(o,c)}catch{}return!0}return!1}export{C as buildSceneSnapshot,q as restoreSceneSnapshot};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useCallback as w,useEffect as k,useMemo as C,useRef as x}from"react";import g from"./9c6c598569.js";import{registerBuiltinCommand as H,hasCommand as B,COMMANDS as S}from"./d6851ea979.js";import z from"./d94df858ea.js";import J from"./be337ddda5.js";import D from"./872c4302e0.js";import Q from"./60d697292c.js";import{runIntent as b,INTENTS as y}from"./6d238282c1.js";import{addProduct as W,moveProduct as X,removeProduct as Y}from"./a77b15c0d6.js";function Z(){const d=g(e=>e.selectedInstanceId),V=g(e=>e.addProductInstance),M=g(e=>e.removeProductInstance),_=g(e=>e.clearSelection),R=z(e=>e.placementPricing),N=J(e=>e.getChannelPriceConfig),$=D(e=>e.getProduct),{edgeOf:I,isMovable:G,ordered:T,syntheticHosts:L,moveInFlightRef:E,productInstances:h}=Q(),O=C(()=>{if(!d)return null;const e=h||{};return e[d]??Object.values(e).find(r=>String(r?.instanceId??r?.id)===String(d))??null},[d,h]),v=w((e,r)=>{const o=g.getState().productInstances||{},l=o[r],i=o[e],c=Number(l?.sequence),p=Number.isFinite(c)?Math.round(c):null;let a=i?.positionedAbove!=null?String(i.positionedAbove):null,s=null;if(a){const u=o[a];s=u?u.variantId??u.productId??null:null}else{const u=D.getState(),t=u.getProduct?.(i?.variantId)||u.getProduct?.(i?.productId),n=t?.hostVariants??t?.host_variants;if(Array.isArray(n)&&n.length){const f=n.find(P=>P?.isDefault??P?.is_default)||n[0];s=f?.hostVariantId??f?.host_variant_id??null}}const m=Number(i?.sequence);p==null||Number.isFinite(m)&&Math.round(m)===p||E.current||(E.current=!0,X({placementId:e,sequence:p,hostPlacementId:a,hostVariantId:s}).catch(()=>{}).finally(()=>{E.current=!1}))},[]),q=C(()=>{let e=O;if(!e&&d!=null){const t=L.find(n=>n.id===String(d));if(t){const n=h||{};e=n[t.hostedProductId]??Object.values(n).find(f=>String(f?.id??f?.instanceId)===String(t.hostedProductId))??null}}if(!e)return null;const r=I(e),o=G(e),l=e.placementGroup??null,i=T.filter(t=>(t.placementGroup??null)===l),c=i.findIndex(t=>t.id===e.id),p=i[c-1],a=i[c+1],s=t=>t==="left"||t==="right",m=!o&&!s(r)&&p&&!s(I(p)),u=!o&&!s(r)&&a&&!s(I(a));return{targetId:e.id,placementId:e.id,onMoveLeft:()=>b({type:y.PRODUCT_MOVE,placementId:e.id,direction:"left"},()=>{m&&v(e.id,p.id)}),onMoveRight:()=>b({type:y.PRODUCT_MOVE,placementId:e.id,direction:"right"},()=>{u&&v(e.id,a.id)}),onDuplicate:r?void 0:()=>b({type:y.PRODUCT_DUPLICATE,placementId:e.id},()=>{const t=D.getState(),n=t.getProduct?.(e.variantId)||t.getProduct?.(e.productId),f=n?.productGraph??n?.product_graph??null,P=e.placementGroup??n?.placementGroup??n?.placement_group??null,j=Array.isArray(e.position)?e.position:[0,0,0],F=Number.isFinite(Number(e.sequence))?Number(e.sequence):void 0;W({productGraphId:f,variantId:e.variantId??e.productId,placementGroup:P,position:j,sequence:F}).catch(()=>{})}),onDelete:()=>b({type:y.PRODUCT_REMOVE,placementId:e.id},()=>{const t=e.id;Y(t).then(n=>{n&&n.applied&&(M(t),_())}).catch(()=>{})}),disabledActions:{moveLeft:m?void 0:{disabled:!0,reason:o?"Drag to move":"Already at the start"},moveRight:u?void 0:{disabled:!0,reason:o?"Drag to move":"Already at the end"},duplicate:r?{disabled:!0,reason:"Only one of this piece allowed"}:void 0}}},[O,d,L,h,T,I,G,v,V,M,_]),A=x(null);A.current=q,k(()=>{const e=(o,l,i)=>async()=>{let c=A.current;for(let a=0;a<5;a++){const s=g.getState().selectedInstanceId;if(s==null?c==null:c!=null&&String(c.targetId)===String(s))break;await new Promise(u=>setTimeout(u,0)),c=A.current}return!c||(i?c.disabledActions?.[i]:null)||typeof c[l]!="function"?!1:(c[l](),!0)},r=[[S.MOVE_LEFT,e("moveLeft","onMoveLeft","moveLeft")],[S.MOVE_RIGHT,e("moveRight","onMoveRight","moveRight")],[S.DUPLICATE,e("duplicate","onDuplicate","duplicate")],[S.DELETE,e("deleteSelected","onDelete",null)]].map(([o,l])=>B(o)?()=>{}:H(o,l));return()=>r.forEach(o=>o())},[]);const U=C(()=>{const e=d?R?.[d]:null,r=e?.unitPrice??e?.unit_price;return e==null||!Number.isFinite(Number(r))?null:{unitPrice:Number(r),adjustments:Array.isArray(e.adjustments)?e.adjustments:[],currency:(N?.()||{}).currency||"USD"}},[d,R,N]);return{selectedInst:O,swapOrder:v,panelActions:q,priceInfo:U}}export{Z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let o=null,r=null,d=0;const a=new Set;let c={};function y(i){const n=String(i),t=n.endsWith("__host"),e=t?n.replace(/__host$/,""):n,s=(o?.placements||[]).find(l=>String(l.id)===e)||null;return{host:t,realId:e,p:s}}function u(i){const{host:n,realId:t,p:e}=y(i),s=n?e?.hostBindings:e?.bindings;if(Array.isArray(s))return s;const l=c[t],p=n?l?.hostBindings:l?.bindings;return Array.isArray(p)?p:[]}function v(i){const{host:n,realId:t,p:e}=y(i),s=n?e?.hostEffectiveSelections:e?.effectiveSelections;if(s)return s;const l=c[t];return(n?l?.hostEffectiveSelections:l?.effectiveSelections)||null}function b(i){const n={};for(const t of Array.isArray(i)?i:[])t?.id!=null&&(Array.isArray(t.bindings)||t.effectiveSelections||Array.isArray(t.hostBindings)||t.hostEffectiveSelections)&&(n[String(t.id)]={bindings:t.bindings,effectiveSelections:t.effectiveSelections,hostBindings:t.hostBindings,hostEffectiveSelections:t.hostEffectiveSelections});c=n}let g=null;function S(i){g=typeof i=="function"?i:null}function f(){d+=1;for(const i of a)try{i({state:o,resolved:r})}catch{}}function x(i){return a.add(i),()=>a.delete(i)}const h=()=>d,V=()=>o,_=()=>r,B=()=>o?.catalogVersion??null;function m(i){return u(i)}function E(i){return v(i)}function A(i,n){const t=u(i);return!Array.isArray(t)||!t.length?null:t.find(e=>String(e.optionSetId)===String(n))||null}function w(i,n){const t=A(i,n);return Array.isArray(t?.available)?t.available:null}function C(){return r?.optionAvailability||null}function O(i,n){const t=r?.optionAvailability,e=t?.[String(i)]??t?.[i];return e?(e[String(n)]??e[n])!==!1:!0}function P(){return r?.optionVisibility||null}function k(i,n){const t=r?.optionVisibility;if(t){const e=t[String(i)]??t[i];return!(e&&e[String(n)]===!1||e&&e[n]===!1)}if(g){const e=g(i);if(Array.isArray(e)&&e.length)return!e.some(s=>String(s)===String(n))}return!0}function H(){return r?.optionSetVisibility||null}function L(i){const n=r?.optionSetVisibility;return!n||i==null?!0:(n[String(i)]??n[i])!==!1}function R(i){if(i==null)return null;const n=u(i);return!Array.isArray(n)||!n.length?null:n.map(t=>String(t?.optionSetId??t?.option_set_id)).filter(Boolean)}function F(i){i&&i.state?(o=i.state,b(o?.placements),r={fired:i.fired??[],errors:i.errors??[],warnings:i.warnings??[],optionVisibility:i.optionVisibility??null,optionSetVisibility:i.optionSetVisibility??null,optionAvailability:i.optionAvailability??null,defaultOptionOverrides:i.defaultOptionOverrides??null,status:200}):o=i||null,f()}function W(i){o=i||null,f()}function $(i){i&&(r={fired:i.fired??[],errors:i.errors??[],warnings:i.warnings??[],optionVisibility:i.optionVisibility??null,optionSetVisibility:i.optionSetVisibility??null,optionAvailability:i.optionAvailability??null,defaultOptionOverrides:i.defaultOptionOverrides??null,status:i.status??null,code:i.code??null},i.applied&&i.resolvedState&&(o=i.resolvedState,b(o?.placements)),f())}function j(i){typeof i!="function"||!o||(o=i(o)||o,f())}function q(){o=null,r=null,c={},f()}export{$ as applyEvaluateResult,w as getBindingAvailable,B as getCatalogVersion,V as getConfigState,E as getEffectiveSelections,C as getOptionAvailability,H as getOptionSetVisibility,P as getOptionVisibility,A as getPlacementBinding,m as getPlacementBindings,R as getPlacementOSAllowlist,_ as getResolved,h as getVersion,O as isOptionAvailable,L as isOptionSetVisible,k as isOptionVisible,j as patchConfigState,S as registerBaselineHiddenLookup,q as resetConfigState,W as setConfigState,F as setInitial,x as subscribe};
|