@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,60 @@
|
|
|
1
|
+
import{useMemo as _,useSyncExternalStore as ee}from"react";import{useCopilotAction as D,useCopilotReadable as U,useCopilotAdditionalInstructions as te}from"@copilotkit/react-core";import ne from"./d94df858ea.js";import q from"./8f60e5059a.js";import v from"./9c6c598569.js";import $ from"./872c4302e0.js";import G from"./be337ddda5.js";import{isAddFeature as ie}from"./8c27edda0f.js";import{getPlacementBindings as Y,getEffectiveSelections as ae,subscribe as oe,getVersion as K}from"./817d930a49.js";import{selectOption as se}from"./dbd5ba1d07.js";import{getLastEvaluation as H}from"./9f474b5d1a.js";const X="Adding pieces is not available for the current product.";function j(g=2){return new Promise(A=>{let f=g;const h=()=>{f-=1,f<=0?A():requestAnimationFrame(h)};requestAnimationFrame(h)})}async function re({instanceId:g,featureKey:A,optionKey:f}){if(g==null)return{ok:!1,msg:"No piece is selected. Select a piece first (selectPiece)."};const h=await import("./a77b15c0d6.js"),C=$.getState().features||{},P=$.getState().options||{},W=$.getState().products||{};try{v.getState().selectInstance?.(g)}catch{}try{await h.reevaluateForFocus()}catch{}await j(2);let V=h.getPlacementBindings(g)||[];if(V.length||(await j(2),V=h.getPlacementBindings(g)||[]),!V.length)return{ok:!1,msg:"This piece has no editable options yet \u2014 try selecting it again."};const E=s=>String((C[s]||C[String(s)]||{}).name||""),x=s=>String((C[s]||C[String(s)]||{}).type||""),F=String(A).toLowerCase(),b=V.find(s=>{const T=E(s.optionSetId).toLowerCase();return String(s.optionSetId)===String(A)||T===F||T&&(T.includes(F)||F.includes(T))});if(!b){const s=V.map(T=>E(T.optionSetId)).filter(Boolean).join(", ");return{ok:!1,msg:`"${A}" isn't an option on the selected piece. Available: ${s||"(none)"}.`}}const S=(b.available||[]).map(s=>P[s]||P[String(s)]).filter(Boolean),L=String(f).toLowerCase(),y=S.find(s=>String(s.id)===String(f)||String(s.name).toLowerCase()===L||String(s.name).toLowerCase().includes(L)||L.includes(String(s.name).toLowerCase()));if(!y)return{ok:!1,msg:`"${f}" not available for ${E(b.optionSetId)||"that feature"}. Available: ${S.map(s=>s.name).join(", ")||"(none)"}.`};const R=E(b.optionSetId)||"Feature",N=/finish/i.test(x(b.optionSetId))||/finish|colou?r|material/i.test(R);try{if(N){const{applyFinishClick:s}=await import("./dc2a1a0e13.js"),T=C[b.optionSetId]||C[String(b.optionSetId)]||{},M=s({option:y,feature:{...T,id:b.optionSetId,name:T.name||R},scope:"single",pieceIndex:g});if(!M||M.ok===!1)return{ok:!1,msg:`Couldn't apply ${y.name} \u2014 ${R} has no matching material slot on this piece.`}}else{const s=y.value;s!=null&&!!(W[s]||W[String(s)])?await h.changeProductVariant({placementId:g,variantId:s}):await h.selectOptionForProduct({placementId:g,optionSetId:b.optionSetId,optionId:y.id})}}catch(s){return{ok:!1,msg:`Couldn't change ${R}: ${s?.message||"engine error"}.`}}return{ok:!0,msg:`${R} changed to ${y.name} for the selected piece.`}}async function ce(g,A){const f=A!=null?String(A).match(/\d+(?:\.\d+)?/g):null;if(!f||!f.length||g==null)return{ok:!1,reason:"no-size"};const h=await import("./a77b15c0d6.js"),C=$.getState().features||{},P=$.getState().options||{},W=$.getState().products||{};try{v.getState().selectInstance?.(g)}catch{}try{await h.reevaluateForFocus()}catch{}await j(2);const E=(h.getPlacementBindings(g)||[]).find(S=>{const L=C[S.optionSetId]||C[String(S.optionSetId)];return/width|frame|size/i.test(String(L?.name||""))});if(!E)return{ok:!1,reason:"no-binding"};const x=(E.available||[]).map(S=>P[S]||P[String(S)]).filter(Boolean),F=x.find(S=>f.every(L=>String(S.name).includes(L)))||x.find(S=>String(S.name).includes(f[f.length-1]));if(!F)return{ok:!1,reason:"no-match",available:x.map(S=>S.name)};try{const S=F.value;S!=null&&!!(W[S]||W[String(S)])?await h.changeProductVariant({placementId:g,variantId:S}):await h.selectOptionForProduct({placementId:g,optionSetId:E.optionSetId,optionId:F.id})}catch{return{ok:!1,reason:"apply-failed"}}return{ok:!0,featureName:(C[E.optionSetId]||C[String(E.optionSetId)])?.name||"size",matchedName:F.name}}function le(){try{te({instructions:`
|
|
2
|
+
You help the user customize the 3D product in the scene. Act immediately \u2014 never ask
|
|
3
|
+
follow-up questions; infer the best option from the catalogs and execute.
|
|
4
|
+
|
|
5
|
+
CRITICAL \u2014 NEVER answer from memory. The user edits the scene directly in the UI, so
|
|
6
|
+
your conversation history is ALWAYS stale. For ANY request to change/add/remove/select,
|
|
7
|
+
you MUST call the matching tool \u2014 do not reply from what you "remember". NEVER say a
|
|
8
|
+
value is "already set", "already X", or claim what is currently selected from memory.
|
|
9
|
+
Read sceneInventory fresh each time. If sceneInventory.selectedPiece is null, either
|
|
10
|
+
selectPiece the piece the user means, or state that nothing is selected \u2014 never invent
|
|
11
|
+
a selection or its current value.
|
|
12
|
+
|
|
13
|
+
ANSWERING STATE QUESTIONS ("what layout are we in?", "what finish is the selected piece?", "what's
|
|
14
|
+
selected?"): answer ONLY from the current readables \u2014 featureCatalog[].current for
|
|
15
|
+
scene-wide features (layout, finishes, \u2026), sceneInventory for pieces/selection. Use the
|
|
16
|
+
".current" value verbatim. NEVER answer such a question from earlier conversation turns;
|
|
17
|
+
the state changes underneath you.
|
|
18
|
+
|
|
19
|
+
You have a small, GENERIC toolset that works for whatever product is loaded. Read the
|
|
20
|
+
provided catalogs to know what THIS product offers (they change per product \u2014 pieces,
|
|
21
|
+
sofa modules, islands, etc. are all just "features" and "pieces"):
|
|
22
|
+
\u2022 featureCatalog \u2014 scene-wide features and their options.
|
|
23
|
+
\u2022 addPieceCatalog \u2014 kinds of pieces you can ADD and their options.
|
|
24
|
+
\u2022 sceneInventory \u2014 pieces currently in the scene, which is selected, and the
|
|
25
|
+
features/options the SELECTED piece can change.
|
|
26
|
+
|
|
27
|
+
Tools:
|
|
28
|
+
\u2022 addPiece(pieceType, option, size?) \u2014 add a piece (any "add <piece type> /
|
|
29
|
+
add module" request; free pieces / corners / hosted products are just pieceTypes in addPieceCatalog).
|
|
30
|
+
\u2022 selectOption(featureKey, optionKey) \u2014 change a scene-wide feature (finish, layout, \u2026).
|
|
31
|
+
\u2022 selectPiece(description) \u2014 select a piece by its name/description.
|
|
32
|
+
\u2022 updatePieceFeature(featureKey, optionKey) \u2014 change a feature on the SELECTED piece
|
|
33
|
+
(select it first with selectPiece if needed).
|
|
34
|
+
\u2022 movePiece(direction) \u2014 reorder the SELECTED piece left/right within
|
|
35
|
+
its run (this is how "move the piece right / left / over" works; pieces snap into
|
|
36
|
+
a sequenced run, so moving = reordering, not free-dragging). Select the piece first.
|
|
37
|
+
\u2022 deleteSelectedPiece() \u2014 remove the selected piece.
|
|
38
|
+
\u2022 Scene tools: switchView (2D/3D), resetCamera, toggleFullscreen,
|
|
39
|
+
toggleDimensions, toggleWalls. Some are only available when the product has
|
|
40
|
+
them (a room-based product has walls + dimensions; a bare product may not) \u2014
|
|
41
|
+
if a scene tool is disabled, tell the user it isn't available for this
|
|
42
|
+
product rather than pretending it worked.
|
|
43
|
+
|
|
44
|
+
CHANGING A PIECE THAT ALREADY EXISTS (width, size, tier, door, finish, colour, \u2026):
|
|
45
|
+
1. If no piece is selected (check sceneInventory.selectedPiece), FIRST call
|
|
46
|
+
selectPiece(description) to select the matching piece.
|
|
47
|
+
2. Then read sceneInventory.selectedFeatures for that piece's actual feature and
|
|
48
|
+
option names, and call updatePieceFeature(featureKey, optionKey).
|
|
49
|
+
Do NOT refuse or say you can "only add". Size/width phrases like "8 feet", "wider",
|
|
50
|
+
"large", "30 inch", "double" map to the closest size/dimension/tier OPTION \u2014 resize
|
|
51
|
+
by changing that option on the selected piece (it swaps the piece's variant), not by
|
|
52
|
+
adding a new one. Only if the piece genuinely has no such option should you say so,
|
|
53
|
+
and then list what it CAN change (from sceneInventory.selectedFeatures).
|
|
54
|
+
|
|
55
|
+
Match names/options against the catalogs; always pick the closest rather than refusing.
|
|
56
|
+
|
|
57
|
+
NEVER refuse a change by claiming it's "already set" to that value. When the user asks
|
|
58
|
+
to set a feature to a value, ALWAYS call the tool to apply it \u2014 applying an already-set
|
|
59
|
+
value is harmless. The current values in sceneInventory.selectedFeatures may be
|
|
60
|
+
approximate (per-piece finishes especially), so do not skip the action based on them.`})}catch{}const g=ne(e=>e.sceneSelections),A=v(e=>e.activeSceneConfigId),f=$(e=>e.features),h=$(e=>e.options),C=v(e=>e.productInstances),P=v(e=>e.selectedInstanceId),W=G(e=>e.sceneConfigurations),V=G(e=>e.getSceneFeatures),E=q(e=>e.hostMaterialOverrides),x=ee(oe,K,K),F=$(e=>e.systemUiToggles)||{},b=F.walls!==!1,S=F.dimensions!==!1,L=A?V(A)||[]:[],y=_(()=>L.map(e=>{const t=e.feature_id||e.id,l=f[t]||f[String(t)];let i=(l?.options||[]).map(n=>{const o=typeof n=="string"||typeof n=="number"?n:n?.id,u=h[o]||h[String(o)];return u?{id:u.id,name:u.name}:null}).filter(Boolean);i.length===0&&(i=Object.values(h).filter(n=>n?.optionSetId==t||n?.option_set_id==t||n?.optionSet==t||n?.feature_id==t).sort((n,o)=>(n?.sequence||0)-(o?.sequence||0)).map(n=>({id:n.id,name:n.name})));const d=g[e.id]??g[String(e.id)]??g[t]??g[String(t)]??null,m=d!=null?i.find(n=>String(n.id)===String(d))?.name??null:null;return{sceneFeatureId:e.id,featureId:t,name:e.name||l?.name||t,current:m,currentSelection:d,options:i}}),[L,f,h,g]);U({description:"Scene-wide features and their options for the current product (from the live catalog \u2014 any configurator). Use featureKey when calling selectOption.",value:y});const R=_(()=>{const e=C||{},t=$.getState().products||{},l=n=>{const o=t[n?.variantId]||t[n?.productId]||t[String(n?.variantId)]||t[String(n?.productId)];return String(o?.name||n?.name||"")},i=Object.entries(e).map(([n,o])=>{const u=(Y(n)||[]).map(r=>(f[r.optionSetId]||f[String(r.optionSetId)]||{}).name).filter(Boolean);return{id:n,name:l(o),selected:String(n)===String(P),features:u}});let d=null;if(P!=null){const n=Y(P)||[],o=ae(P)||{},u=E?.[P]||{};d=n.map(r=>{const a=f[r.optionSetId]||f[String(r.optionSetId)],I=a?.name||String(r.optionSetId),c=(r.available||[]).map(w=>h[w]||h[String(w)]).filter(Boolean),k=/finish/i.test(String(a?.type||""))||/finish|colou?r|material/i.test(I);let p=null;if(k){const w=new Set(Object.values(u).map(String));if(p=c.find(O=>O.value!=null&&w.has(String(O.value)))?.name??null,p==null){const O=y.find(B=>String(B.featureId)===String(r.optionSetId)),z=O?g[O.sceneFeatureId]:null;p=z!=null?(h[z]||h[String(z)])?.name??null:null}}else{const w=o[r.optionSetId]??o[String(r.optionSetId)];p=w!=null?(h[w]||h[String(w)])?.name??null:null}return{feature:I,current:p,options:c.map(w=>w.name)}})}const m=i.find(n=>n.selected)?.name||null;return{pieces:i,selectedPiece:m,selectedFeatures:d,note:P==null?'NOTHING is selected. For a "change/delete the selected piece" request, first call selectPiece(description) to select the piece the user means, or reply that no piece is currently selected. Do NOT claim any current value or that something is "already set".':`"${m}" is selected; its changeable features are in selectedFeatures.`}},[C,P,f,h,g,y,E,x]);U({description:"Pieces in the scene (each with its feature names), which is selected, and the selected piece's current values + options. To change a feature of a piece that isn't selected (e.g. a hosted product's option), find the piece in pieces[] whose features include it and selectPiece it \u2014 or just call updatePieceFeature(featureKey, optionKey); it auto-targets the piece that has that feature when only one does.",value:R});const N=_(()=>{const e=new Set((L||[]).filter(t=>ie(t,{productSelected:!1})).map(t=>String(t.feature_id||t.id)));return y.filter(t=>e.has(String(t.featureId))).filter(t=>Array.isArray(t.options)&&t.options.length>0)},[L,y]),s=N.length>0,T=N.map(e=>`${e.name}: ${e.options.map(t=>t.name).join(", ")}`).join("; "),M=N.map(e=>e.name);U({description:"Kinds of pieces that can be ADDED for this product, with their options. Use these exact names as pieceType when calling addPiece.",value:N.map(e=>({pieceType:e.name,options:e.options.map(t=>t.name)}))});const Q=y.map(e=>`${e.name} (e.g. ${e.options.slice(0,3).map(t=>t.name).join(", ")})`).join(", "),J=y.slice(0,4).map(e=>`"${e.name}"`).join(", "),Z=y.flatMap(e=>e.options.slice(0,1)).slice(0,4).map(e=>`"${e.name}"`).join(", ");D({name:"selectOption",description:`Change a scene-wide feature option (finish, layout, door style, handle, \u2026). Features: ${Q}.`,parameters:[{name:"featureKey",type:"string",description:`The feature name or id. Examples: ${J}.`,required:!0},{name:"optionKey",type:"string",description:`The option name or id. Examples: ${Z}.`,required:!0}],handler:async({featureKey:e,optionKey:t})=>{const l=String(e).toLowerCase(),i=y.find(a=>String(a.sceneFeatureId)===String(e)||String(a.featureId)===String(e)||String(a.sceneFeatureId).toLowerCase()===l||String(a.featureId).toLowerCase()===l||String(a.name).toLowerCase()===l||String(a.name).toLowerCase().includes(l)||l.includes(String(a.name).toLowerCase()));if(!i)return`Feature "${e}" not found. Available: ${y.map(a=>a.name).join(", ")}`;const d=String(t).toLowerCase(),m=i.options.find(a=>String(a.id)===String(t)||String(a.id).toLowerCase()===d||String(a.name).toLowerCase()===d||String(a.name).toLowerCase().includes(d)||d.includes(String(a.name).toLowerCase()));if(!m)return`Option "${t}" not found for ${i.name}. Available: ${i.options.map(a=>a.name).join(", ")}`;const n=f[i.featureId]||f[String(i.featureId)]||{id:i.featureId},o=H();let u=!1;try{u=await se(i.featureId,m.id,n),await j(2)}catch(a){return`Could not change ${i.name}: ${a?.message||a}`}const r=H();if(r&&r!==o&&r.rejected){const a=r.errors?.[0]?.message||r.code||"the engine refused it";return`${i.name} could not be changed to ${m.name}: ${a}`}return u===!1?`${i.name} could not be changed to ${m.name}.`:`${i.name} changed to ${m.name}.`}}),D({name:"addPiece",available:s?"enabled":"disabled",description:s?`Add a new piece to the scene. Choose a pieceType and an option (free pieces / corners / hosted products are pieceTypes here too). Available \u2014 ${T}.`:X,parameters:[{name:"pieceType",type:"string",required:!1,description:`Which kind of piece. Valid: ${M.join(", ")||"(none)"}. Optional when there's only one.`,...M.length?{enum:M}:{}},{name:"option",type:"string",required:!0,description:"The option to add \u2014 name or id."},{name:"size",type:"string",required:!1,description:'Optional size/width, e.g. "18" or "30x18". Applied after adding if the piece has a size option.'}],handler:async({pieceType:e,option:t,size:l})=>{if(!s)return X;let i=null;if(e!=null&&String(e).trim()!==""){const c=String(e).trim().toLowerCase();i=N.find(k=>String(k.name).toLowerCase()===c||String(k.featureId).toLowerCase()===c||String(k.name).toLowerCase().includes(c)||c.includes(String(k.name).toLowerCase()))}if(!i&&N.length===1&&(i=N[0]),!i)return`Which piece type? Choose one of: ${M.join(", ")}.`;const d=String(t).trim().toLowerCase(),m=i.options.find(c=>String(c.id)===String(t)||String(c.name).toLowerCase()===d||String(c.name).toLowerCase().includes(d)||d.includes(String(c.name).toLowerCase()));if(!m)return`Option "${t}" not found for ${i.name}. Available: ${i.options.map(c=>c.name).join(", ")}.`;let n,o;const u=new Set(Object.keys(v.getState().productInstances||{}));try{n=await import("./a77b15c0d6.js"),o=await n.addProductFromOption({optionSetId:i.featureId,optionId:m.id})}catch(c){return`Couldn't add ${m.name}: ${c?.message||"the engine is unavailable"}.`}await j(2);let r=o?.addedPlacements?.[0]?.id??null;r==null&&(r=Object.keys(v.getState().productInstances||{}).find(c=>!u.has(c))??null);const a=`Added ${m.name} (${i.name}) to the scene.`;if(l==null||String(l).trim()===""||r==null)return a;const I=await ce(r,l);return I.ok?`Added ${m.name} (${i.name}) and set ${I.featureName} to ${I.matchedName}.`:I.reason==="no-match"?`${a} Couldn't match size "${l}" \u2014 available: ${(I.available||[]).join(", ")||"(none)"}.`:a}}),D({name:"selectPiece",description:'Select a piece in the scene so it can be changed or deleted. Match by product name / description (e.g. "left chaise", "the elevated piece", "the hosted product").',parameters:[{name:"description",type:"string",required:!0,description:"The piece's product name or a description of it."}],handler:async({description:e})=>{const t=v.getState().productInstances||{},l=$.getState().products||{},i=Object.entries(t).map(([o,u])=>{const r=l[u?.variantId]||l[u?.productId]||l[String(u?.variantId)]||l[String(u?.productId)];return{id:o,name:String(r?.name||u?.name||o)}});if(!i.length)return"There are no pieces in the scene to select.";const d=String(e).toLowerCase().trim(),m=d.split(/\s+/).filter(o=>o.length>2),n=i.find(o=>o.name.toLowerCase()===d)||i.find(o=>o.name.toLowerCase().includes(d))||i.find(o=>d.includes(o.name.toLowerCase()))||i.find(o=>m.some(u=>o.name.toLowerCase().includes(u)));if(!n)return`Couldn't find a piece matching "${e}". In the scene: ${i.map(o=>o.name).join(", ")}.`;try{v.getState().selectInstance?.(n.id)}catch{}return await j(2),`Selected ${n.name}. You can now change or delete it.`}}),D({name:"updatePieceFeature",description:"Change a feature (width, door, handle, finish, size, \u2026) on the CURRENTLY SELECTED piece. Select one first with selectPiece. See sceneInventory for the selected piece's features and options.",parameters:[{name:"featureKey",type:"string",required:!0,description:"The feature name (or id) to change \u2014 from the selected piece's features."},{name:"optionKey",type:"string",required:!0,description:"The option name (or id) to select."}],handler:async({featureKey:e,optionKey:t})=>{let l=v.getState().selectedInstanceId;if(l==null){const d=await import("./a77b15c0d6.js"),m=v.getState().productInstances||{},n=$.getState().products||{},o=$.getState().features||{},u=String(e).toLowerCase(),r=Object.keys(m).filter(a=>(d.getPlacementBindings(a)||[]).some(I=>{const c=String((o[I.optionSetId]||o[String(I.optionSetId)]||{}).name||"").toLowerCase();return c&&(c===u||c.includes(u)||u.includes(c))}));if(r.length===1)l=r[0];else if(r.length>1){const a=r.map(I=>{const c=m[I];return(n[c?.variantId]||n[c?.productId])?.name||I});return`Several pieces have a "${e}" option (${a.join(", ")}). Say which one (e.g. by its name), then I'll change it.`}}const i=await re({instanceId:l,featureKey:e,optionKey:t});return await j(2),i.msg}}),D({name:"deleteSelectedPiece",description:"Delete the currently selected piece from the scene. Select one first with selectPiece if needed.",parameters:[],handler:async()=>{const e=v.getState().selectedInstanceId;if(e==null)return"No piece is selected. Select one first (selectPiece).";try{await(await import("./a77b15c0d6.js")).removeProduct(e)}catch(t){return`Couldn't delete the selected piece: ${t?.message||"the engine is unavailable"}.`}try{v.getState().removeProductInstance?.(e)}catch{}try{v.getState().selectInstance?.(null)}catch{}return await j(2),"Deleted the selected piece."}}),D({name:"movePiece",description:"Move/reorder the CURRENTLY SELECTED piece one position left or right within its run. Select a piece first with selectPiece if needed. (Pieces snap into a sequenced run, so this reorders rather than free-positions.)",parameters:[{name:"direction",type:"string",required:!0,enum:["left","right"],description:'"left" or "right".'}],handler:async({direction:e})=>{const t=v.getState(),l=t.selectedInstanceId;if(l==null)return"No piece is selected. Select one first (selectPiece), then say which way to move it.";const i=t.productInstances||{},d=i[l];if(!d)return"The selected piece is no longer in the scene.";const m=p=>p?.placementGroup??p?.placement_group??null,n=p=>{const w=Number(p?.sequence);return Number.isFinite(w)?w:null},o=m(d),u=Object.entries(i).filter(([,p])=>m(p)===o&&n(p)!=null).map(([p,w])=>({id:p,seq:n(w)})).sort((p,w)=>p.seq-w.seq),r=u.findIndex(p=>String(p.id)===String(l));if(r<0||u.length<2)return"There is nothing to reorder \u2014 the selected piece has no neighbours in its run.";const a=/right|next|forward|end/i.test(String(e)),I=a?u[r+1]:u[r-1];if(!I)return a?"The piece is already at the right end of its run.":"The piece is already at the left end of its run.";let c=d?.positionedAbove!=null?String(d.positionedAbove):null,k=null;if(c){const p=i[c];k=p?p.variantId??p.productId??null:null}else{const p=$.getState(),w=p.getProduct?.(d?.variantId)||p.getProduct?.(d?.productId),O=w?.hostVariants??w?.host_variants;if(Array.isArray(O)&&O.length){const z=O.find(B=>B?.isDefault??B?.is_default)||O[0];k=z?.hostVariantId??z?.host_variant_id??null}}try{await(await import("./a77b15c0d6.js")).moveProduct({placementId:l,sequence:Math.round(I.seq),hostPlacementId:c,hostVariantId:k})}catch(p){return`Couldn't move the piece: ${p?.message||"the engine is unavailable"}.`}return await j(2),`Moved the selected piece one position to the ${a?"right":"left"}.`}}),D({name:"toggleFullscreen",description:"Toggle fullscreen for the 3D scene.",parameters:[{name:"enabled",type:"boolean",required:!0,description:"true = enter, false = exit."}],handler:async({enabled:e})=>{const t=document.querySelector(".scene-canvas");return t?e&&!document.fullscreenElement?(await t.requestFullscreen?.(),"Entered fullscreen."):!e&&document.fullscreenElement?(await document.exitFullscreen?.(),"Exited fullscreen."):e?"Already in fullscreen.":"Not in fullscreen.":"Could not find the scene element."}}),D({name:"switchView",description:"Switch between 2D top-down and 3D perspective view.",parameters:[{name:"view",type:"string",required:!0,enum:["2D","3D"],description:'"2D" or "3D".'}],handler:async({view:e})=>{const t=e==="3D";return q.getState().is3D===t?`Already in ${e} view.`:(v.getState().setCameraPosition(t?[4,4,6]:[0,10,.1]),q.getState().toggleView(),`Switched to ${e} view.`)}}),D({name:"resetCamera",description:"Reset the camera to the default 3D view.",parameters:[],handler:async()=>(v.getState().setCameraPosition([4,4,6]),q.getState().is3D||q.getState().toggleView(),"Camera reset.")}),D({name:"toggleDimensions",available:S?"enabled":"disabled",description:S?"Show or hide the dimension overlay.":"This product has no dimension overlay to show or hide.",parameters:[{name:"show",type:"boolean",required:!0,description:"true = show, false = hide."}],handler:async({show:e})=>S?q.getState().showDimensions===e?e?"Dimensions already visible.":"Dimensions already hidden.":(q.getState().toggleDimensions(),e?"Dimensions shown.":"Dimensions hidden."):"This product has no dimension overlay."}),D({name:"toggleWalls",available:b?"enabled":"disabled",description:b?"Show or hide the room walls in the scene.":"This product has no room walls to show or hide.",parameters:[{name:"show",type:"boolean",required:!0,description:"true = show walls, false = hide walls."}],handler:async({show:e})=>b?q.getState().showWalls===e?e?"Walls already visible.":"Walls already hidden.":(q.getState().toggleWalls(),e?"Walls shown.":"Walls hidden."):"This product has no walls to toggle."})}export{le as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let t=null;function o(e){return typeof e!="function"?()=>{}:(t=e,()=>{t===e&&(t=null)})}function s(){return t!==null}function u(e,n={}){if(!t)return e;try{const r=t(e,n);return r===null||typeof r=="string"?r:e}catch{return e}}function l(){t=null}export{l as _resetAssetResolver,s as hasAssetResolver,o as registerAssetResolver,u as resolveAssetUrl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as F,useState as J}from"react";import t from"./8f60e5059a.js";import K from"./9c6c598569.js";import r from"./1fac915f8b.js";import W from"./872c4302e0.js";import{canUseFullscreen as P,canLockOrientation as Q}from"./89ab18ebc5.js";import{setViewMode as X}from"./2cafe3274b.js";import{runIntent as n,INTENTS as s}from"./6d238282c1.js";import{toggleValue as D,useHostToggles as M}from"./41ed5985ad.js";function ie(){const u=W(o=>o.systemUiToggles)||{};return M(),o=>D(o,u)}function Z({isMobile:u=!1}={}){const o=t(e=>e.is3D),g=t(e=>e.showDimensions),b=t(e=>e.toggleDimensions),d=t(e=>e.showWalls),I=t(e=>e.toggleWalls),C=t(e=>e.showFloor),U=t(e=>e.toggleFloor),V=t(e=>e.showCeiling),_=t(e=>e.toggleCeiling),c=t(e=>e.showWallGuide),O=t(e=>e.isLayoutLoading),R=t(e=>e.sceneCapabilities),m=K(e=>e.resetCameraToDefault),k=r(e=>e.past.length>0),v=r(e=>e.future.length>0),[f,x]=J(!1);F(()=>{const e=()=>{const i=!!document.fullscreenElement;if(x(i),!i){try{screen.orientation.unlock()}catch{}const{isLandscapeMode:l,landscapeMethod:B}=t.getState();l&&B==="fullscreen"&&t.getState().setLandscapeMode(!1)}};return document.addEventListener("fullscreenchange",e),document.addEventListener("webkitfullscreenchange",e),()=>{document.removeEventListener("fullscreenchange",e),document.removeEventListener("webkitfullscreenchange",e)}},[]),F(()=>{if(!c)return;const e=setTimeout(()=>{t.setState({showWallGuide:!1})},5e3);return()=>clearTimeout(e)},[c]);const q=()=>X(!o),G=()=>{I(),c&&t.setState({showWallGuide:!1})},N=async()=>{if(document.fullscreenElement){try{screen.orientation.unlock()}catch{}document.exitFullscreen?.();return}const e=u?document.querySelector(".main-layout--mobile"):document.querySelector(".scene-canvas");try{await e?.requestFullscreen?.()}catch{}},H=()=>r.getState().undo(),A=()=>r.getState().redo(),Y=t(e=>e.isLandscapeMode),a=t(e=>e.setLandscapeMode),h=async()=>{const{isLandscapeMode:e,landscapeMethod:i}=t.getState();if(e){if(i==="fullscreen"){try{screen.orientation.unlock()}catch{}try{await document.exitFullscreen()}catch{}}a(!1);return}const l=document.querySelector(".main-layout--mobile");if(l)if(P()){a(!0,"fullscreen");try{if(await(l.requestFullscreen?.()||l.webkitRequestFullscreen?.()),Q())try{await screen.orientation.lock("landscape")}catch{}}catch{a(!0,"css-rotation")}}else a(!0,"css-rotation")},p=()=>n({type:s.VIEW_MODE,mode:o?"2d":"3d"},q),y=()=>n({type:s.VIEW_WALLS,next:!d},G),w=()=>n({type:s.VIEW_FULLSCREEN,next:!f},N),S=()=>n({type:s.HISTORY_UNDO},H),L=()=>n({type:s.HISTORY_REDO},A),j=()=>n({type:s.VIEW_DIMENSIONS,next:!g},()=>b()),T=t(e=>e),E=W(e=>e.systemUiToggles)||{};M();const z=e=>D(e,E);return{guiVisible:T.guiVisible,isMobile:T.isMobile,isOn:z,uiToggles:E,is3D:o,showDimensions:g,showWalls:d,showFloor:C,showCeiling:V,showWallGuide:c,isLayoutLoading:O,isFullscreen:f,canUndo:k,canRedo:v,sceneCapabilities:R,handleToggleView:p,toggleView:p,toggleDimensions:j,handleWallsToggle:y,toggleWalls:y,toggleFloor:U,toggleCeiling:_,handleFullscreen:w,toggleFullscreen:w,resetCameraToDefault:m,resetCamera:m,handleUndo:S,undo:S,handleRedo:L,redo:L,isLandscapeMode:Y,handleLandscapeToggle:h,toggleLandscape:h}}export{Z as default,ie as useUiToggles};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as y,jsx as a,jsxs as d}from"react/jsx-runtime";import{useUIState as f}from"./9840b9ce12.js";import{useSystem as u}from"./066fc9aa40.js";import{LogoIcon as p}from"./c5e990946e.js";import{useHasIcon as N}from"./09c4973968.js";function g({embedded:m=!1,title:c,header:o,className:t="",children:e}){const l=N("logo"),{isMobile:b,isLayoutLoading:_}=f(),{name:v}=u(),s=_?{opacity:.5,pointerEvents:"none"}:void 0,i=n=>t?`${n} ${t}`:n;if(b)return a("div",{className:i("sidebar__content sidebar__content--mobile"),style:s,"data-part":"sidebar-frame",children:e});if(m)return a("div",{className:i("sidebar sidebar--embedded"),style:s,"data-part":"sidebar-frame",children:a("div",{className:"sidebar__content",children:e})});const r=o===void 0?d("div",{className:"sidebar__logo",children:[l?d(y,{children:[a(p,{className:"sidebar__logo-icon"}),a("span",{className:"sidebar__logo-divider"})]}):null,a("span",{className:"sidebar__logo-text",children:c??v??"Configurator"})]}):o;return a("div",{className:i("sidebar-container"),style:s,"data-part":"sidebar-frame",children:d("aside",{className:"sidebar sidebar--card",children:[r!=null&&a("div",{className:"sidebar__header",children:r}),a("div",{className:"sidebar__content",children:e})]})})}export{g as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{getQuoteDocument as B,COLUMN_DEFS as P,quoteHeading as G,quoteDate as J}from"./12b8165d6d.js";import{activeQuoteDesignKey as K,resolveQuoteTemplate as V}from"./4ba4f544b9.js";import{renderQuoteTemplatePdf as Y}from"./297e653adf.js";function X(a){const r=/^#([0-9a-f]{6})$/i.exec(String(a??""));if(!r)return null;const m=parseInt(r[1],16);return[m>>16&255,m>>8&255,m&255]}const b=new Map,H="default",_=a=>a==null?null:String(a).trim().toLowerCase();function Z(a,r){const m=typeof a=="function"&&r===void 0,s=m?H:_(a),f=m?a:r;return!s||typeof f!="function"?()=>{}:(b.set(s,f),()=>{b.get(s)===f&&b.delete(s)})}function R(a){const r=a!==void 0?_(a):K();return r&&b.has(r)?b.get(r):b.get(H)??null}function ot(a={}){const{url:r,headers:m={},method:s="POST",timeoutMs:f=3e4,body:t,fallback:l=!0,key:h="default"}=a;return!r||typeof r!="string"?()=>{}:Z(h,async(y,C)=>{const u=new AbortController,S=setTimeout(()=>u.abort(),f);try{const g=await fetch(r,{method:s,headers:{"Content-Type":"application/json",...m},body:JSON.stringify(t?t(y,C):{quote:y,options:C}),signal:u.signal});if(!g.ok)throw new Error(`${g.status} ${g.statusText}`);const x=await g.blob();if(!x||x.size===0)throw new Error("empty response");const n=x.type||"";if(n&&!/pdf|octet-stream/i.test(n))throw new Error(`expected a PDF, got "${n}"`);return x}catch(g){const x=g?.name==="AbortError"?`no response in ${f}ms`:g?.message||g;if(!l)throw g;return M(y,{...C,_skipEndpoint:!0})}finally{clearTimeout(S)}})}function rt(a){return a===void 0?R()!==null:b.has(_(a))}function at(){return[...b.keys()]}function it(){b.clear()}function v(a,r=8e3){return new Promise(m=>{if(!a){m(null);return}const s=new Image;let f=!1;const t=h=>{f||(f=!0,m(h))},l=setTimeout(()=>t(null),r);s.crossOrigin="anonymous",s.onload=()=>{clearTimeout(l);try{const h=document.createElement("canvas");h.width=s.naturalWidth,h.height=s.naturalHeight,h.getContext("2d").drawImage(s,0,0),t({dataUrl:h.toDataURL("image/jpeg",.82),w:s.naturalWidth,h:s.naturalHeight})}catch{t(null)}},s.onerror=()=>{clearTimeout(l),t(null)},s.src=a})}const o={pageW:210,pageH:297,margin:15};function q(a){const r={qty:16,unit:26,total:30},m=a.filter(u=>r[u]),s=a.filter(u=>!r[u]),f=m.reduce((u,S)=>u+r[S],0),t=o.pageW-o.margin*2-f,l=Math.max(28,t/Math.max(1,s.length)),h={};let y=o.margin;for(const u of s)h[u]={x:y,w:l-4,align:"left"},y+=l;let C=o.pageW-o.margin;for(const u of[...m].reverse())h[u]={x:C,w:r[u],align:"right"},C-=r[u];return h}async function M(a,r={}){const m=R(r.template);if(m&&!r._skipEndpoint)return m(a,r);const s=r._skipTemplate?null:V(r.template);if(s)try{return await Y(s,a,r)}catch{}if(r._skipTextLayout)throw new Error("no host quote document produced a PDF");const{jsPDF:f}=await import("jspdf"),t=new f({orientation:"portrait",unit:"mm",format:"a4"}),l=B(),h=r.company??l.company??"",y=r.customer??l.customer??"",C=r.reference??l.reference??"",u=r.notes??[l.notes,l.terms].filter(Boolean).join(`
|
|
2
|
+
|
|
3
|
+
`),S=Array.isArray(r.columns)&&r.columns.length?r.columns.filter(e=>P[e]):l.columns,g=q(S),x=X(r.accent??l.accent);let n=o.margin;const T=(e,i,c)=>t.text(String(e??""),i,n,c),W=(e,i)=>t.splitTextToSize(String(e??""),i),F=(e,i=!1)=>{n+e<=o.pageH-o.margin||(t.addPage(),n=o.margin,i&&$())};function $(){t.setFontSize(8).setFont(void 0,"bold"),t.setTextColor(110);for(const e of S){const i=g[e];T(P[e].label.toUpperCase(),i.x,i.align==="right"?{align:"right"}:void 0)}t.setTextColor(20),n+=2,x?t.setDrawColor(x[0],x[1],x[2]):t.setDrawColor(210),t.line(o.margin,n,o.pageW-o.margin,n),t.setDrawColor(210),n+=5,t.setFont(void 0,"normal")}const Q=r.logoUrl??l.logoUrl??null;if(Q){const e=await v(Q);if(e){const p=e.w>0&&e.h>0?e.w/e.h:1;let d=12,w=12*p;w>60&&(w=60,d=60/p),t.addImage(e.dataUrl,"JPEG",o.margin,n,w,d),n+=d+3}}if(h&&(t.setFontSize(14).setFont(void 0,"bold"),x&&t.setTextColor(x[0],x[1],x[2]),T(h,o.margin),t.setTextColor(20),n+=7),t.setFontSize(16).setFont(void 0,"bold"),T(G(a,l),o.margin),t.setFontSize(9).setFont(void 0,"normal").setTextColor(110),T(J(a,l),o.pageW-o.margin,{align:"right"}),n+=6,(C||y)&&(T([C&&`Quote ${C}`,y&&`For ${y}`].filter(Boolean).join(" \xB7 "),o.margin),n+=5),t.setTextColor(20),l.showSceneSelections&&a.scene.selections.length){const e=a.scene.selections.map(c=>`${c.setName}: ${c.optionName}`).join(" \xB7 ");t.setFontSize(8).setTextColor(110);const i=W(e,o.pageW-o.margin*2);F(i.length*4+4),t.text(i,o.margin,n),n+=i.length*4+3,t.setTextColor(20)}n+=3,t.setFontSize(9),$(),a.lines.length||(t.setTextColor(120),T("Nothing configured yet.",o.margin),t.setTextColor(20),n+=6);for(const e of a.lines){const i=S.map(p=>{const d=g[p],w=P[p].value(e);return{key:p,c:d,lines:d.align==="right"?[String(w)]:W(w,d.w)}}),c=Math.max(...i.map(p=>p.lines.length))*4+3;F(c+2,!0);for(const{key:p,c:d,lines:w}of i)p==="options"&&t.setTextColor(90),d.align==="right"?t.text(w[0],d.x,n,{align:"right"}):t.text(w,d.x,n),p==="options"&&t.setTextColor(20);e.sku&&!S.includes("sku")&&g.item&&(t.setFontSize(7).setTextColor(140),t.text(String(e.sku),g.item.x,n+3.5),t.setFontSize(9).setTextColor(20)),n+=c,t.setDrawColor(235).line(o.margin,n-2,o.pageW-o.margin,n-2)}const U=Array.isArray(a.additionalLines)?a.additionalLines:[];if(U.length){F(14,!0),n+=2,t.setFontSize(8).setTextColor(120),T("ADDITIONAL OPTIONS",o.margin),t.setFontSize(9).setTextColor(20),n+=5;for(const e of U){const i=W(e.setName?`${e.setName}: ${e.label}`:String(e.label??""),g.qty-g.item-8),c=i.length*4+3;F(c+2,!0),t.text(i,g.item,n),T(e.count,g.qty,{align:"right"}),T(e.amountFormatted??"\u2014",g.total,{align:"right"}),e.unitAmountFormatted&&e.count>1&&(t.setFontSize(7).setTextColor(140),t.text(`${e.count} \xD7 ${e.unitAmountFormatted}`,g.opts,n),t.setFontSize(9).setTextColor(20)),n+=c,t.setDrawColor(235).line(o.margin,n-2,o.pageW-o.margin,n-2)}}F(20),n+=3,t.setDrawColor(20).setLineWidth(.4).line(o.margin,n,o.pageW-o.margin,n),t.setLineWidth(.2),n+=6,t.setFontSize(11).setFont(void 0,"bold");const E=a.totals.unitCount??a.totals.lineCount;if(T(`${E} item${E===1?"":"s"}`,o.margin),T(a.totals.grandTotalFormatted??a.totals.subtotalFormatted??"\u2014",o.pageW-o.margin,{align:"right"}),t.setFont(void 0,"normal"),n+=6,a.totals.hasSceneLevelAdjustment){t.setFontSize(8).setTextColor(120);const e=W(`Items total ${a.totals.subtotalFormatted}`+(a.totals.additionalSubtotal?` + ${a.totals.additionalSubtotalFormatted} options`:"")+`; quoted total ${a.totals.grandTotalFormatted}.`,o.pageW-o.margin*2);F(e.length*4),t.text(e,o.margin,n),n+=e.length*4,t.setTextColor(20)}const z=r.imageTypes??l.images?.types,A=Array.isArray(z)&&z.length?new Set(z):null,I=(a.images?.ready??[]).filter(e=>e.type!=="pdf"&&e.type!=="ar").filter(e=>!A||A.has(e.type)),j=Number.isFinite(r.maxImages)?r.maxImages:Number.isFinite(l.images?.max)?l.images.max:6,N=Math.max(0,j);if(I.length&&N>0&&r.images!==!1){const e=(await Promise.all(I.slice(0,N).map(i=>v(i.url)))).filter(Boolean);if(e.length){F(14),n+=6,t.setFontSize(8).setFont(void 0,"bold").setTextColor(110),T("RENDERS",o.margin),t.setFont(void 0,"normal").setTextColor(20),n+=4;const i=4,c=2,p=(o.pageW-o.margin*2-i*(c-1))/c;for(let d=0;d<e.length;d+=1){const w=e[d],L=w.h/w.w*p,D=d%c;D===0&&F(L+i),t.addImage(w.dataUrl,"JPEG",o.margin+D*(p+i),n,p,L),(D===c-1||d===e.length-1)&&(n+=L+i)}}}const O=(a.images?.images??[]).find(e=>e.type==="ar"&&e.status==="complete"&&e.url),k=r.arUrl??O?.url??null;if(k&&r.arQr!==!1&&l.arQr!==!1)try{const i=await(await import("qrcode")).default.toDataURL(k,{margin:1,width:400}),c=26;F(c+8),n+=6,t.addImage(i,"PNG",o.margin,n,c,c),t.setFontSize(9).setFont(void 0,"bold"),t.text(r.arQrLabel??l.arQrLabel??"View in your room",o.margin+c+5,n+7),t.setFont(void 0,"normal").setFontSize(8).setTextColor(110),t.text("Scan with a phone camera to place this",o.margin+c+5,n+12),t.text("configuration in your own space.",o.margin+c+5,n+16),t.setTextColor(20),n+=c+4}catch{}if(u){n+=4,t.setFontSize(8).setTextColor(110);const e=W(u,o.pageW-o.margin*2);F(e.length*4),t.text(e,o.margin,n),t.setTextColor(20)}return t.output("blob")}async function st(a,r={}){const m=await M(a,r),s=r.filename??`quote-${(a.system.name??"configuration").replace(/\s+/g,"-").toLowerCase()}.pdf`,f=URL.createObjectURL(m),t=document.createElement("a");return t.href=f,t.download=s,document.body.appendChild(t),t.click(),t.remove(),setTimeout(()=>URL.revokeObjectURL(f),1e4),m}export{it as _resetQuotePdf,M as buildQuotePdfBlob,rt as hasQuotePdf,at as listQuotePdfBuilders,Z as registerQuotePdf,ot as registerQuotePdfEndpoint,st as saveQuotePdf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"./ae96f219e3.js";import{captureDesignViews as p}from"./e75f1e5992.js";import{collectGenericBom as f}from"./81802759ca.js";import{generateGenericBomPdf as m}from"./f8fec86f10.js";import{buildQuotePdfBlob as d,hasQuotePdf as h}from"./d20718159b.js";import{hasQuoteTemplate as w}from"./4ba4f544b9.js";import{readQuote as g}from"./3656ffa1b8.js";import{generateARModel as S}from"./f7b4a178e3.js";import"./9c6c598569.js";import{emitEvent as y,EVENTS as b}from"./2e366d7386.js";import{getR3FState as k}from"./e1cd279733.js";async function P(e,n){if(!e||n==null)return null;try{return await o.uploadDesignPdf(n,e)}catch{return null}}async function x(){return p()}function L({onProgress:e}={}){return new Promise(n=>{const a=k()?.scene??null;if(!a){n(null);return}S({scene:a,onProgress:e||(()=>{}),onComplete:u=>n(u||null),onError:()=>n(null)})})}async function F({views:e,images:n,projectName:a,customer:u={},shareUrl:i=null,arUrl:r=null}={}){const c=u,t=a,l=await D({views:e,images:n,shareUrl:i,arUrl:r,source:"save-project"});return(await fetch(l)).blob()}async function T({views:e,images:n,shareUrl:a=null,arUrl:u=null,source:i=null}={}){let r=n;if(!r){const t=e||await x();r={perspective:t.perspective,front:t.front,side:t.top}}const c=await f({lifestyleImages:r,shareUrl:a,arUrl:u});if(h()||w())try{const t=await d(g(),{bom:c,images:r,shareUrl:a,arUrl:u,source:i,_skipTextLayout:!0});if(t)return{url:URL.createObjectURL(t),kind:"quote"}}catch{}return{url:await m(c),kind:"bom"}}async function D(e={}){return(await T(e)).url}async function I(e={},{pdfBlob:n=null,buildPdf:a=null}={}){const u=o.parseShareToken(),i=u?await o.update(u,e):await o.save(e),r=i?.share_token||u||null,c=r?o.buildShareUrl(r):null;let t=n;if(!t&&typeof a=="function")try{t=await a({shareUrl:c,shareToken:r,project:i})}catch{}const l=t?await P(t,i?.id??null):null;if(l&&r)try{await o.update(r,{...e,pdfUrl:l})}catch{}const s={project:i,shareToken:r,shareUrl:c,pdfUrl:l};return y(b.PROJECT_SAVED,s),s}async function N(e){return o.load(e)}function O(e){return o.restore(e)}function q(){return o.parseShareToken()}function J(e){return o.buildShareUrl(e)}function M(e){return o.adoptShareTokenInUrl(e)}export{M as adoptShareTokenInUrl,F as buildDesignPdf,T as buildDesignPdfDocument,D as buildDesignPdfUrl,J as buildShareUrl,x as captureDesignViews,L as generateArForCurrentScene,N as loadProject,q as parseShareToken,O as restoreProject,I as saveProject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{trackEmbed as f}from"./0af28430ab.js";let e=!0,n=!1;const o=new Set,a=new Set;function c(){if(!(typeof document>"u"||!document.documentElement))try{document.documentElement.setAttribute("data-watermark",e?"on":"off")}catch{}}c();function u(){c();for(const t of o)try{t()}catch{}}function i(t){t===!0&&(n=!0);const r=t===!1?n:!0;r!==e&&(e=r,u())}function d(t){return o.add(t),()=>{o.delete(t)}}function s(){return e}function p(t,r={}){if(e&&!a.has(t)){a.add(t);try{f("watermark_tamper",{reason:t,...r})}catch{}}}function k(){e=!0,n=!1,a.clear(),u()}export{k as _resetWatermarkGate,s as getWatermarkShown,p as reportWatermarkTamper,i as setWatermarkFromBackend,d as subscribeWatermark};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as p,jsx as e,jsxs as d}from"react/jsx-runtime";import{memo as R,useEffect as b,useMemo as g,useRef as B,lazy as m,Suspense as O}from"react";import*as w from"three";import{Environment as C}from"@react-three/drei";import{useThree as z}from"@react-three/fiber";import{RectAreaLightUniformsLib as M}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import U from"./983cbed22c.js";import{applyEnvironmentToRenderer as F}from"./4e7d0a0d4a.js";import{getApiBaseUrl as P}from"./8ade32d067.js";const T=(()=>{let t=null;const r=()=>t||(t=import("@react-three/postprocessing"));return{EffectComposer:m(()=>r().then(o=>({default:o.EffectComposer}))),Bloom:m(()=>r().then(o=>({default:o.Bloom}))),SSAO:m(()=>r().then(o=>({default:o.SSAO}))),FXAA:m(()=>r().then(o=>({default:o.FXAA}))),N8AO:m(()=>r().then(o=>({default:o.N8AO})))}})(),{EffectComposer:I,Bloom:N,SSAO:W,FXAA:$,N8AO:j}=T;let _=!1;function G(){if(!_){try{M.init()}catch{}_=!0}}function X(t){if(!t||/^([a-z]+:)?\/\//i.test(t)||t.startsWith("data:")||t.startsWith("blob:"))return t;const r=P()||"";return t.startsWith("/")?`${r}${t}`:`${r}/${t}`}function S(t,r){return r?512:typeof t.shadow_map_size=="number"?t.shadow_map_size:2048}function x({env:t,isMobile:r,is3D:o,reducedQuality:f,captureMode:s}){const{gl:i,invalidate:l}=z();b(()=>{t&&Object.keys(t).length>0&&(F(t,i),l())},[t,i,l]);const n=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(()=>n.some(a=>a?.type==="rect_area"),[n])&&G();const h=g(()=>{if(!t?.hdr)return null;const a=t.hdr,u=r?a.url_1k??a.url1k??a.url??null:a.url_2k??a.url2k??a.url??null;return u?{url:X(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,r]);if(!t||Object.keys(t).length===0)return null;let y=null;h?.as_background||(y=t.background?.color??"#ffffff");const A=typeof t.shadows?.bias=="number"?t.shadows.bias:15e-5,k=typeof t.shadows?.radius=="number"?t.shadows.radius:typeof t.ground?.shadow_blur=="number"?t.ground.shadow_blur:null,E=typeof t.shadows?.normal_bias=="number"?t.shadows.normal_bias:null;return d(p,{children:[h&&e(C,{files:h.url,background:h.as_background,environmentIntensity:h.intensity,environmentRotation:[0,w.MathUtils.degToRad(h.rotation_deg),0]}),y&&e("color",{attach:"background",args:[y]}),n.map((a,u)=>!a||a.enabled===!1?null:e(H,{light:a,is3D:o,reducedQuality:f,globalShadowBias:A,globalShadowRadius:k,globalShadowNormalBias:E},u)),e(q,{ground:t.ground,is3D:o,reducedQuality:f,captureMode:s}),e(D,{postProcessing:t.post_processing,is3D:o,reducedQuality:f,captureMode:s})]})}function q({ground:t,is3D:r,reducedQuality:o,captureMode:f}){if(f||!t||t.enabled!==!0)return null;const s=t.floor_color??t.color??"#ffffff",i=typeof t.size=="number"?t.size:21,l=o?-.05:r?-.005:-.02,n=typeof t.shadow_opacity=="number"?t.shadow_opacity:.5,c=t.shadow_color??"#000000";return d(p,{children:[d("mesh",{rotation:[-Math.PI/2,0,0],position:[0,l,0],renderOrder:o?-1:0,children:[e("circleGeometry",{args:[i,64]}),e("meshBasicMaterial",{color:s,toneMapped:!1,depthWrite:!o,polygonOffset:!0,polygonOffsetFactor:2,polygonOffsetUnits:2})]}),r&&n>0&&d("mesh",{rotation:[-Math.PI/2,0,0],position:[0,l+5e-4,0],receiveShadow:!0,children:[e("circleGeometry",{args:[i,64]}),e("shadowMaterial",{transparent:!0,opacity:n,color:c})]})]})}function D({postProcessing:t,is3D:r,reducedQuality:o,captureMode:f}){if(f||!r||!t)return null;const s=t.bloom,i=t.ssao,l=t.fxaa,n=t.n8ao;return!s&&!i&&!l&&!n?null:e(U,{children:e(O,{fallback:null,children:d(I,{children:[s&&e(N,{intensity:typeof s?.intensity=="number"?s.intensity:.5,luminanceThreshold:typeof s?.threshold=="number"?s.threshold:.9,luminanceSmoothing:typeof s?.smoothing=="number"?s.smoothing:.025,mipmapBlur:!0}),n&&e(j,{aoRadius:typeof n?.radius=="number"?n.radius:o?.3:.5,intensity:typeof n?.intensity=="number"?n.intensity:o?1:1.5,distanceFalloff:typeof n?.falloff=="number"?n.falloff:.5,quality:o?"low":"medium"}),i&&!n&&e(W,{intensity:typeof i?.intensity=="number"?i.intensity:1,radius:typeof i?.radius=="number"?i.radius:.1,samples:o?9:16}),l&&e($,{})]})})})}function H({light:t,is3D:r,reducedQuality:o,globalShadowBias:f,globalShadowRadius:s,globalShadowNormalBias:i}){const l=B();b(()=>{t.target&&l.current&&l.current.position.set(t.target[0],t.target[1],t.target[2])},[t.target]);const n=c=>c?{"shadow-bias":typeof t.bias=="number"?t.bias:f,"shadow-normalBias":typeof t.normal_bias=="number"?t.normal_bias:i??.1,"shadow-radius":typeof t.radius=="number"?t.radius:s??4,"shadow-mapSize-width":S(t,o),"shadow-mapSize-height":S(t,o),"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 c=r&&!!t.cast_shadow,h=t.position??[0,5,5];return d(p,{children:[e("directionalLight",{color:t.color,intensity:t.intensity??1,position:h,castShadow:c,...n(c)}),t.target&&e("object3D",{ref:l})]})}case"point":{const c=r&&!!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:c,...n(c)})}case"spot":{const c=r&&!!t.cast_shadow;return d(p,{children:[e("spotLight",{color:t.color,intensity:t.intensity??1,position:t.position??[0,5,0],distance:t.distance??0,angle:w.MathUtils.degToRad(t.angle_deg??30),penumbra:t.penumbra??0,decay:t.decay??2,castShadow:c,...n(c)}),t.target&&e("object3D",{ref:l})]})}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 tt=R(x);export{tt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSyncExternalStore as t}from"react";import{getQuoteDocument as e,subscribeQuoteDocument as o}from"./12b8165d6d.js";function u(){return t(o,e,e)}var m=u;export{m as default,u as useQuoteDocument};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useEffect as v,useRef as u}from"react";import{CloseIcon as f}from"./c5e990946e.js";import"./15d6bec3b5.css";function _({isOpen:a,onClose:o,title:m,children:n,size:c="medium",footer:l}){const i=u(null);v(()=>{const d=s=>{s.key==="Escape"&&o()};return a&&(document.addEventListener("keydown",d),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",d),document.body.style.overflow=""}},[a,o]);const r=d=>{d.target===d.currentTarget&&o()};return a?e("div",{className:"modal-overlay",onClick:r,children:t("div",{className:`modal modal--${c}`,ref:i,children:[t("div",{className:"modal__header",children:[e("h2",{className:"modal__title",children:m}),e("button",{className:"modal__close",onClick:o,children:e(f,{})})]}),e("div",{className:"modal__content",children:n}),l&&e("div",{className:"modal__footer",children:l})]})}):null}var k=_;export{k as default};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{jsx as h}from"react/jsx-runtime";import{useLayoutEffect as s,useRef as d}from"react";import"./aaa0e82d7f.css";const p="https://admin-configurator.imagine.io/",f={display:"flex",visibility:"visible",opacity:"1",position:"absolute",inset:"0","z-index":"2147483646","pointer-events":"auto",transform:"none","clip-path":"none",filter:"none",background:"#f4f5f7","align-items":"center","justify-content":"center",padding:"24px","box-sizing":"border-box","color-scheme":"light"},u=`
|
|
2
|
+
:host { all: initial; }
|
|
3
|
+
.card {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
max-width: 440px;
|
|
6
|
+
padding: 28px 32px;
|
|
7
|
+
background: #ffffff;
|
|
8
|
+
border: 1px solid #e3e5e8;
|
|
9
|
+
border-radius: 12px;
|
|
10
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
|
|
11
|
+
text-align: center;
|
|
12
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
13
|
+
color: #111111;
|
|
14
|
+
}
|
|
15
|
+
.title { margin: 0 0 10px; font-size: 17px; font-weight: 600; line-height: 1.35; color: #111111; }
|
|
16
|
+
.body { margin: 0; font-size: 14px; line-height: 1.55; color: #555b66; }
|
|
17
|
+
.action {
|
|
18
|
+
margin: 16px 0 0; padding-top: 14px; border-top: 1px solid #ecedf0;
|
|
19
|
+
font-size: 13px; line-height: 1.55; color: #6b7280;
|
|
20
|
+
}
|
|
21
|
+
.link {
|
|
22
|
+
color: #d8481f; font-weight: 600; text-decoration: none;
|
|
23
|
+
border-bottom: 1px solid rgba(216, 72, 31, 0.35);
|
|
24
|
+
}
|
|
25
|
+
.link:hover { border-bottom-color: #d8481f; }
|
|
26
|
+
`;function b(a,c){const i=document.createElement("style");i.textContent=u;const e=document.createElement("div");e.className="card",e.classList.add("licence-notice__card");const n=document.createElement("h1");if(n.className="title licence-notice__title",n.textContent="Configurator not licensed for this site",e.appendChild(n),c){const r=document.createElement("p");r.className="body licence-notice__body",r.textContent=c,e.appendChild(r)}const t=document.createElement("p");t.className="action",t.append("To run on a public website, upgrade your plan in the ");const o=document.createElement("a");o.className="link",o.href=p,o.target="_blank",o.rel="noopener noreferrer",o.textContent="imagine.io admin panel",t.appendChild(o),t.append("."),e.appendChild(t),a.replaceChildren(i,e)}function m({message:a,...c}){const i=d(null);return s(()=>{const e=i.current;if(!e)return;const n=()=>{for(const[r,l]of Object.entries(f))e.style.setProperty(r,l,"important")};n();let t=e.shadowRoot;if(!t)try{t=e.attachShadow({mode:"open"})}catch{t=null}t&&b(t,a);let o=null;try{o=new MutationObserver(()=>n()),o.observe(e,{attributes:!0,attributeFilter:["style","class"]})}catch{}return()=>o?.disconnect()},[a]),h("div",{ref:i,className:"error-screen licence-notice","data-part":"unlicensed",role:"status",...c})}export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useMemo as c}from"react";import*as y from"three";import{getConcreteWallMaterial as v}from"./22bd38ddcf.js";const o=.1;function b({width:h=4,depth:l=3.5,height:i=2.7,showCeiling:u=!1,showLeftWall:S=!0,showRightWall:w=!0,segments:p=null,floor:a=null}){const r=c(()=>{try{return v()}catch{return null}},[]),g=c(()=>new y.MeshStandardMaterial({color:"#d8d2c8",roughness:.95,metalness:0}),[]),M=c(()=>new y.MeshStandardMaterial({color:"#f0ece6",roughness:1,metalness:0}),[]);if(Array.isArray(p))return s("group",{name:"scene-room",children:[a&&e("mesh",{rotation:[-Math.PI/2,0,0],position:[a.cx||0,0,a.cz||0],material:g,receiveShadow:!0,children:e("planeGeometry",{args:[a.w>0?a.w:4,a.d>0?a.d:4]})}),p.map((t,x)=>s("mesh",{position:[t.cx,t.cy??i/2,t.cz],rotation:[0,t.rotY||0,0],material:r||void 0,receiveShadow:!0,children:[e("boxGeometry",{args:[t.length>0?t.length:1,t.height>0?t.height:i,t.thickness>0?t.thickness:o]}),!r&&e("meshStandardMaterial",{color:"#e8e4dd",roughness:.95})]},x)),u&&a&&e("mesh",{rotation:[Math.PI/2,0,0],position:[a.cx||0,i,a.cz||0],material:M,children:e("planeGeometry",{args:[a.w>0?a.w:4,a.d>0?a.d:4]})})]});const m=h>0?h:4,d=l>0?l:3.5,n=i>0?i:2.7,G=-d/2;return s("group",{name:"scene-room",children:[e("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,0],material:g,receiveShadow:!0,children:e("planeGeometry",{args:[m,d]})}),s("mesh",{position:[0,n/2,G-o/2],material:r||void 0,receiveShadow:!0,children:[e("boxGeometry",{args:[m+o*2,n,o]}),!r&&e("meshStandardMaterial",{color:"#e8e4dd",roughness:.95})]}),S&&s("mesh",{position:[-m/2-o/2,n/2,0],material:r||void 0,receiveShadow:!0,children:[e("boxGeometry",{args:[o,n,d]}),!r&&e("meshStandardMaterial",{color:"#e8e4dd",roughness:.95})]}),w&&s("mesh",{position:[m/2+o/2,n/2,0],material:r||void 0,receiveShadow:!0,children:[e("boxGeometry",{args:[o,n,d]}),!r&&e("meshStandardMaterial",{color:"#e8e4dd",roughness:.95})]}),u&&e("mesh",{rotation:[Math.PI/2,0,0],position:[0,n,0],material:M,children:e("planeGeometry",{args:[m,d]})})]})}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=Object.freeze({MOVE_LEFT:"moveLeft",MOVE_RIGHT:"moveRight",DUPLICATE:"duplicate",DELETE:"delete",ADD_CABINET:"addPiece",OPEN_FINISH:"openFinish",SELECT_ELEMENT:"selectElement",GENERATE_ASSETS:"generateAssets"}),n=new Map;function o(e,t){return n.set(e,t),()=>{n.get(e)===t&&n.delete(e)}}const u=new Set(Object.values(i));function s(e,t){return!e||typeof t!="function"?()=>{}:o(e,t)}function c(e,t){return!e||typeof t!="function"?()=>{}:u.has(e)?()=>{}:o(e,t)}function E(e){return n.has(e)}function f(e,...t){const r=n.get(e);if(r)return r(...t)}function d(){return Array.from(n.keys())}function m(){n.clear()}export{i as COMMANDS,E as hasCommand,d as listCommands,s as registerBuiltinCommand,c as registerCommand,m as resetCommands,f as runCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{uploadAiReference as T,generateAiImage as x,fetchAiImageJob as L}from"./79a397bb92.js";const N=2500,A=360*1e3,S={silo:{size:"1024x768",imageStrength:.94,angles:["silo_front"]},lifestyle:{size:"1536x1152",imageStrength:.85,angles:["lifestyle_1"]}};function O(e){const t=String(e||"");return t.startsWith("silo")?"silo":t.startsWith("lifestyle")?"lifestyle":"silo"}function F(e){const t=/^(\d+)x(\d+)$/.exec(String(e||""));if(!t)return"4:3";const[n,r]=[Number(t[1]),Number(t[2])];if(!n||!r)return"4:3";const i=n/r;return Math.abs(i-1)<.02?"1:1":Math.abs(i-16/9)<.03?"16:9":Math.abs(i-3/2)<.03?"3:2":"4:3"}function c(e,{assetId:t}={}){const n=e?.code||null,r=e instanceof Error?e:new Error(String(e));return r.code=n,r.status=e?.status??null,r.quota=e?.body?.quota??null,r.isQuota=n==="AI_QUOTA_EXCEEDED",r.isDeadReference=n==="INVALID_REFERENCE",r.assetId=t??null,r}function C(e,t="Generation failed. Try again."){return"Generation failed. Try again."}async function V(e,t){const n=new FormData,r=e?.name||`reference_${Date.now()}.jpg`;n.append("image",e,r);const i=await T(n),o=i?.url||null;if(!o)throw new Error("Reference upload returned no url");return t&&t(100),{url:o,key:i?.key??null}}async function $({assetId:e,family:t,productName:n,productDescription:r,prompt:i,imageUrl:o,referenceUrl:b,allowedAngles:M,size:d,aspectRatio:D,imageStrength:R,negativePrompt:g,layoutType:E,layoutName:_,systemId:m,attempt:w}){const u=t||O(e),f=S[u]||S.silo,h=/^\d+x\d+$/.test(String(d||""))?d:f.size,y=b||o;if(!y)throw new Error("generateImage: a reference_url is required");const a={reference_url:y,family:u,asset_id:e||`${u}-1`,prompt:i||r||"",product_name:n||"Product",allowed_angles:M||f.angles,size:h,aspect_ratio:D||F(h),image_strength:R??f.imageStrength};g&&(a.negative_prompt=g),E&&(a.layout_type=E),_&&(a.layout_name=_),m!=null&&(a.system_id=m),w!=null&&(a.attempt=w);let s;try{s=await x(a)}catch(l){throw c(l,{assetId:e})}if(Array.isArray(s?.images))return I(s,e);const p=s?.job_id;if(!p){const l=new Error("generate returned neither images nor a job_id");throw l.code="IMAGE_SERVICE_BAD_RESPONSE",c(l,{assetId:e})}return G(p,e)}async function G(e,t){const n=Date.now()+A;for(;;){await new Promise(o=>setTimeout(o,N));let r;try{r=await L(e)}catch(o){if(Date.now()>=n)throw c(o,{assetId:t});continue}const i=String(r?.status||"");if(i==="succeeded")return I(r,t);if(i==="failed"){const o=new Error(r?.error?.detail||r?.detail||"Image generation failed");throw o.code=r?.error?.code||r?.code||"IMAGE_GENERATION_FAILED",o.body=r,c(o,{assetId:t})}if(Date.now()>=n){const o=new Error(`Image generation did not finish within ${Math.round(A/1e3)}s`);throw o.code="IMAGE_SERVICE_TIMEOUT",c(o,{assetId:t})}}}function I(e,t){if(!e?.images?.[0]?.url){const r=new Error("generation succeeded with no image url");throw r.code="IMAGE_SERVICE_BAD_RESPONSE",r.body=e,c(r,{assetId:t})}return e}export{O as assetFamily,$ as generateImage,C as generationErrorMessage,V as uploadReferenceImage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{chain as r}from"./a493e9aa8f.js";var i={id:"chain-with-corners",label:"Chain with corners (L / U)",mode:"compute",computeLayout(e,o){return r(e,o)}};export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let h=null,F=null;async function C(){return h||(h=(await import("jspdf")).jsPDF),h}async function y(){return F||(F=(await import("html2canvas")).default),F}class w{async generatePDF(a){const{sceneCanvasElement:n,configuration:i,priceBreakdown:s,channelConfig:P,includePrice:x=!0}=a,D=await C(),t=new D({orientation:"portrait",unit:"mm",format:"a4"}),b=t.internal.pageSize.getWidth(),u=t.internal.pageSize.getHeight(),o=20;let e=o;if(t.setFontSize(24),t.setFont("helvetica","bold"),t.text(a?.title||"Configuration",o,e),e+=15,t.setFontSize(10),t.setFont("helvetica","normal"),t.setTextColor(128,128,128),t.text(`Generated: ${new Date().toLocaleDateString()}`,o,e),e+=20,n)try{const r=await(await y())(n,{useCORS:!0,allowTaint:!0,scale:2}),p=r.toDataURL("image/jpeg",.8),l=b-o*2,m=100,d=r.width/r.height;let g=l,f=l/d;f>m&&(f=m,g=m*d);const S=o+(l-g)/2;t.addImage(p,"JPEG",S,e,g,f),e+=f+15}catch{}if(t.setFontSize(14),t.setFont("helvetica","bold"),t.setTextColor(0,0,0),t.text("Configuration Details",o,e),e+=10,t.setFontSize(10),t.setFont("helvetica","normal"),i?.products)for(const c of i.products){e>u-40&&(t.addPage(),e=o),t.setFont("helvetica","bold"),t.text(c.productName||c.productId,o,e),e+=6,t.setFont("helvetica","normal"),t.setTextColor(80,80,80);const r=i.selections?.[c.instanceId]||{};for(const[p,l]of Object.entries(r)){const m=this.formatFeatureName(p),d=this.formatOptionName(l);t.text(` ${m}: ${d}`,o,e),e+=5}e+=5,t.setTextColor(0,0,0)}if(x&&s&&P?.can_see_pricing!==!1){e+=10,e>u-60&&(t.addPage(),e=o),t.setFontSize(14),t.setFont("helvetica","bold"),t.text("Pricing",o,e),e+=10,t.setFontSize(10),t.setFont("helvetica","normal");for(const[c,r]of Object.entries(s.breakdown||{}))t.text(`${r.productName}: ${this.formatPrice(r.total,s.currency)}`,o,e),e+=5;e+=5,t.setFont("helvetica","bold"),t.text(`Total: ${this.formatPrice(s.total,s.currency)}`,o,e)}return t.setFontSize(8),t.setFont("helvetica","normal"),t.setTextColor(128,128,128),t.text("Generated by Configurator",o,u-10),t}async downloadPDF(a){const n=await this.generatePDF(a),i=`configuration-${Date.now()}.pdf`;return n.save(i),i}async getPDFBlob(a){return(await this.generatePDF(a)).output("blob")}formatFeatureName(a){return a.replace(/^feat_/,"").replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}formatOptionName(a){return a.replace(/^opt_/,"").replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}formatPrice(a,n="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:n}).format(a)}}const z=new w;var N=z;export{w as PDFService,N as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{create as F}from"zustand";import{devtools as V}from"./52436e0169.js";let r=null;function _(i){r=typeof i=="function"?i:null}let a=0;const k=F(V((i,c)=>({instanceSelections:{},sceneSelections:{},seededSelections:{},selectionOrder:{},sceneSelectionsSettled:!1,lockedFeatures:{},disabledOptions:{},filteredOptions:{},validationErrors:[],calculatedValues:{},totalPrice:0,placementPricing:{},aggregateAdjustments:[],setBackendPricing:e=>{if(!e||typeof e!="object")return;const t=e.grandTotal??e.grand_total??null,n=e.placements??e.placementPricing??{},l=e.aggregateAdjustments??e.aggregate_adjustments??[];i({...typeof t=="number"?{totalPrice:t}:{},placementPricing:n&&typeof n=="object"?n:{},aggregateAdjustments:Array.isArray(l)?l:[]})},setFeatureSelection:(e,t,n)=>{i(l=>({instanceSelections:{...l.instanceSelections,[e]:{...l.instanceSelections[e],[t]:n}}}))},setSceneFeatureSelection:(e,t)=>{i(n=>({sceneSelections:{...n.sceneSelections,[e]:t}}))},initializeInstanceSelections:(e,t)=>{i(n=>({instanceSelections:{...n.instanceSelections,[e]:{...t}}}))},initializeSceneSelections:e=>{i({sceneSelections:{...e}})},setLockedFeature:(e,t,n)=>{i(l=>({lockedFeatures:{...l.lockedFeatures,[e]:{...l.lockedFeatures[e],[t]:n}}}))},clearLockedFeature:(e,t)=>{i(n=>{const l={...n.lockedFeatures[e]};return delete l[t],{lockedFeatures:{...n.lockedFeatures,[e]:l}}})},setDisabledOptions:(e,t,n)=>{i(l=>({disabledOptions:{...l.disabledOptions,[e]:{...l.disabledOptions[e],[t]:n}}}))},clearDisabledOptions:(e,t)=>{i(n=>{const l={...n.disabledOptions[e]};return delete l[t],{disabledOptions:{...n.disabledOptions,[e]:l}}})},setFilteredOptions:(e,t,n)=>{i(l=>({filteredOptions:{...l.filteredOptions,[e]:{...l.filteredOptions[e],[t]:n}}}))},clearFilteredOptions:(e,t)=>{i(n=>{const l={...n.filteredOptions[e]};return delete l[t],{filteredOptions:{...n.filteredOptions,[e]:l}}})},setCalculatedValue:(e,t,n)=>{i(l=>({calculatedValues:{...l.calculatedValues,[e]:{...l.calculatedValues[e],[t]:n}}}))},setInstancePrice:(e,t)=>{i(n=>{const l={...n.calculatedValues,[e]:{...n.calculatedValues[e],price:t}},s=Object.values(l).reduce((o,d)=>o+(d.price||0),0);return{calculatedValues:l,totalPrice:s}})},setValidationErrors:e=>{i({validationErrors:e})},addValidationError:e=>{i(t=>({validationErrors:[...t.validationErrors,e]}))},clearValidationErrors:()=>{i({validationErrors:[]})},getInstanceSelection:(e,t)=>c().instanceSelections[e]?.[t],getAllInstanceSelections:e=>c().instanceSelections[e]||{},getSceneSelection:e=>c().sceneSelections[e],isFeatureLocked:(e,t)=>c().lockedFeatures[e]?.[t]||!1,isOptionDisabled:(e,t,n)=>(c().disabledOptions[e]?.[t]||[]).includes(n),isOptionAllowed:(e,t,n)=>{const l=c().filteredOptions[e]?.[t];return l?l.includes(n):!0},getAvailableOptions:(e,t,n)=>{const l=c().disabledOptions[e]?.[t]||[],s=c().filteredOptions[e]?.[t];return n.filter(o=>!(l.includes(o.id)||s&&!s.includes(o.id)))},getInstanceCalculatedValues:e=>c().calculatedValues[e]||{},getInstancePrice:e=>c().calculatedValues[e]?.price||0,getFullConfigurationState:()=>({instanceSelections:c().instanceSelections,sceneSelections:c().sceneSelections,calculatedValues:c().calculatedValues,totalPrice:c().totalPrice}),resetInstance:e=>{i(t=>{const{[e]:n,...l}=t.instanceSelections,{[e]:s,...o}=t.lockedFeatures,{[e]:d,...S}=t.disabledOptions,{[e]:m,...p}=t.filteredOptions,{[e]:g,...u}=t.calculatedValues,O=Object.values(u).reduce((f,b)=>f+(b.price||0),0);return{instanceSelections:l,lockedFeatures:o,disabledOptions:S,filteredOptions:p,calculatedValues:u,totalPrice:O}})},resetAll:()=>{i({instanceSelections:{},sceneSelections:{},lockedFeatures:{},disabledOptions:{},filteredOptions:{},validationErrors:[],calculatedValues:{},totalPrice:0})},applyRuleResults:e=>{i({lockedFeatures:e.lockedFeatures||{},disabledOptions:e.disabledOptions||{},filteredOptions:e.filteredOptions||{},calculatedValues:e.calculatedValues||{},validationErrors:e.validationErrors||[],totalPrice:e.totalPrice||0})},setSceneSelection:(e,t)=>{const n=c().sceneSelections?.[e];a+=1;const l=a;if(i(s=>({sceneSelections:{...s.sceneSelections,[e]:t},selectionOrder:{...s.selectionOrder,[String(e)]:l}})),r)try{r()}catch{}},setSeededSceneSelection:(e,t)=>{const n=String(e);a+=1;const l=a;if(i(s=>({sceneSelections:{...s.sceneSelections,[e]:t},seededSelections:{...s.seededSelections,[n]:t},selectionOrder:{...s.selectionOrder,[n]:l}})),r)try{r()}catch{}},markSceneSelectionsSettled:()=>{c().sceneSelectionsSettled||i({sceneSelectionsSettled:!0})}}),{name:"scene-config"}));var E=k;export{E as default,_ as registerSelectionReconciler};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as i from"three";import{getR3FState as p}from"./e1cd279733.js";import{waitForAssetsIdle as f}from"./2774152dd2.js";function d(t){if(!t||t.isEmpty())return null;const e=t.getSize(new i.Vector3);return{min:[t.min.x,t.min.y,t.min.z],max:[t.max.x,t.max.y,t.max.z],w:e.x,h:e.y,d:e.z}}function y(){const t=p()?.scene;if(!t)return null;const e=[],a=new i.Box3;return t.updateMatrixWorld(!0),t.traverse(n=>{const o=n?.userData?.instanceId;if(o==null||!n.isGroup||n.parent&&n.parent.userData?.instanceId===o)return;const r=new i.Box3().setFromObject(n);if(r.isEmpty())return;a.union(r);const s=n.matrixWorld.clone().invert(),c=r.clone().applyMatrix4(s);e.push({placementId:String(o),productId:n.userData?.productId??null,worldBox:d(r),localBox:d(c),matrixWorld:n.matrixWorld.toArray()})}),{total:d(a),pieces:e}}function g(t){if(t==null)return null;const e=p()?.scene;if(!e)return null;const a=String(t);let n=null;if(e.updateMatrixWorld(!0),e.traverse(u=>{if(n)return;const l=u?.userData?.instanceId;l==null||!u.isGroup||String(l)!==a||u.parent&&u.parent.userData?.instanceId===l||(n=u)}),!n)return null;const o=new i.Box3().setFromObject(n);if(o.isEmpty())return null;const r=o.getCenter(new i.Vector3),s=o.getBoundingSphere(new i.Sphere),c=n.getWorldQuaternion(new i.Quaternion),m=new i.Euler().setFromQuaternion(c,"YXZ").y;return{center:[r.x,r.y,r.z],radius:s.radius,facingY:m}}function B(t){const e=f();return typeof t=="function"?e.then(()=>t()):e}export{B as onSettled,y as readBounds,g as readPieceFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as Te,jsx as t,jsxs as a}from"react/jsx-runtime";import f,{useCallback as Q,useEffect as X,useMemo as G,useRef as Z,useState as ee,useSyncExternalStore as te,Suspense as ae}from"react";import{subscribe as se,getVersion as x}from"./817d930a49.js";import{useLabels as ie}from"./28d887bf8a.js";import y from"./8f60e5059a.js";import{useUIRegions as oe}from"./9840b9ce12.js";import O from"./9c6c598569.js";import ne from"./d94df858ea.js";import v from"./be337ddda5.js";import{useCopilotAvailable as re}from"./672404d987.js";import le from"./ce663020e4.js";import ce from"./921bf270dd.js";import de from"./35d8449ed8.js";import me from"./2990ba64d6.js";import ue from"./bdec200d00.js";import pe from"./82a8a4bc35.js";import fe from"./9794652102.js";import ve from"./54413c1eae.js";import{resolveComponent as p,useComponentRegistry as W}from"./882bc739c8.js";import ge from"./37596ace72.js";import be from"./26155bf68c.js";import _e from"./2cab5c5c23.js";import{ShellAssistants as he,useMobileSync as we,formatPrice as U,useFocusedItemPrice as ye}from"./c71892453b.js";import{LogoIcon as ze}from"./c5e990946e.js";import{useHasIcon as Se}from"./09c4973968.js";import"./8a22e8944f.css";const Ce="__summary",Ne=f.lazy(()=>import("./5d5e8a9c58.js")),Pe=f.lazy(()=>import("./28df2aa12f.js")),Re=f.lazy(()=>import("./4c24338793.js")),Ie=f.lazy(()=>import("./f89d7cd931.js"));function Me(){return le(),null}function ke({Scene:g}){return t(Ae,{Scene:g})}function Ae({Scene:g}){W();const F=p("Sidebar",ue);W();const $=p("SceneToolbar",ve),z=p("GenerateAssetsButton",be),S=p("SaveProjectButton",_e),j=p("ConfigurationSummary",pe);we();const u=oe(),i=ie(),c=y(e=>e.isLayoutLoading),K=Se("logo"),C=y(e=>e.isMobile),V=y(e=>e.openModal),H=O(e=>e.setCameraPosition),Y=re();de({disabled:C});const{handleGenerateAssets:N,isGenerating:P}=ce({openModal:V,setCameraPosition:H}),q=v(e=>e.systemName)||"Configurator",R=ne(e=>e.totalPrice),I=(v(e=>e.getChannelPriceConfig)?.()||{}).currency||"USD",b=O(e=>e.activeSceneConfigId),M=v(e=>e.getSceneFeatures),D=v(e=>e.sceneConfigurations),{productOptionSets:_,scope:k}=me(),{price:h}=ye(),J=te(se,x,x),o=G(()=>{const e=[],s=(n,d)=>{const l=String(n??"");l&&e.push({key:l,label:d||`${i("wizard.step","Step")} ${e.length+1}`,featureIds:[n]})};if(k.isPlacementScoped&&_.length)for(const n of _)s(n?.feature_id??n?.id,n?.name);else{const n=b?M(b)||[]:[],d=new Set;for(const l of n){const m=l?.feature_id??l?.id;m==null||d.has(String(m))||(d.add(String(m)),s(m,l?.name))}}return e.push({key:Ce,label:i("wizard.summary","Summary"),featureIds:null,isSummary:!0}),e},[b,M,D,k.isPlacementScoped,_,J]),[A,T]=ee(null),r=G(()=>{const e=o.findIndex(s=>s.key===A);return e>=0?e:0},[o,A]),E=Q(e=>{const s=o[Math.max(0,Math.min(o.length-1,e))];s&&T(s.key)},[o]),w=o[r]||o[0],L=Z(null);return X(()=>{const e=L.current,s=e?.querySelector(".wizard-step--active");if(!e||!s||e.scrollWidth<=e.clientWidth)return;const n=e.getBoundingClientRect(),d=s.getBoundingClientRect(),l=d.left-n.left-(e.clientWidth-d.width)/2,m=e.scrollWidth-e.clientWidth,B=Math.max(0,Math.min(m,e.scrollLeft+l));Math.abs(B-e.scrollLeft)<1||e.scrollTo({left:B,behavior:"smooth"})},[w?.key,o.length]),a("div",{className:"wizard-layout",children:[t(fe,{}),Y&&t(Me,{}),u.header&&a("header",{className:"wizard-header",children:[a("div",{className:"wizard-header__brand",children:[K?a(Te,{children:[t(ze,{className:"wizard-header__logo"}),t("span",{className:"wizard-header__divider"})]}):null,t("span",{className:"wizard-header__title",children:q})]}),a("div",{className:"wizard-header__actions",children:[t(S,{disabled:c,className:"wizard-header__save"}),t(z,{onClick:N,isGenerating:P,disabled:c,className:"wizard-header__cta"})]})]}),a("div",{className:"wizard-body",children:[a("main",{className:"wizard-scene",children:[t(g,{isMobile:C}),u.toolbar&&t($,{variant:"desktop"}),u.notifications&&t(ge,{}),u.panels&&a("div",{className:"wizard-price",children:[i("shell.totalPrice","TOTAL PRICE")?t("span",{className:"wizard-price__label",children:i("shell.totalPrice","TOTAL PRICE")}):null,t("span",{className:"wizard-price__value",children:U(R,I)})]}),t(he,{})]}),u.sidebar&&a("aside",{className:"wizard-panel",children:[t("nav",{className:"wizard-steps","aria-label":"Configuration steps",ref:L,children:o.map((e,s)=>a("button",{type:"button",className:`wizard-step${s===r?" wizard-step--active":""}${s<r?" wizard-step--done":""}`,onClick:()=>T(e.key),disabled:c,children:[t("span",{className:"wizard-step__num",children:String(s+1).padStart(2,"0")}),t("span",{className:"wizard-step__label",children:e.label})]},e.key))}),t("div",{className:"wizard-panel__body",children:w?.isSummary?a("div",{className:"wizard-summary",children:[i("wizard.review","Review your configuration")?t("h2",{className:"wizard-summary__title",children:i("wizard.review","Review your configuration")}):null,a("div",{className:"wizard-summary__price",children:[(h!=null?i("shell.itemPrice","ITEM PRICE"):i("shell.totalPrice","TOTAL PRICE"))?t("span",{className:"wizard-price__label",children:h!=null?i("shell.itemPrice","ITEM PRICE"):i("shell.totalPrice","TOTAL PRICE")}):null,t("span",{className:"wizard-summary__price-value",children:U(h??R,I)})]}),t(j,{className:"wizard-summary__list"}),a("div",{className:"wizard-summary__actions",children:[t(S,{disabled:c,className:"wizard-summary__save"}),t(z,{onClick:N,isGenerating:P,disabled:c,className:"wizard-summary__cta"})]})]}):t(F,{embedded:!0,backHeader:!1,filterFeatureIds:w?.featureIds})}),a("div",{className:"wizard-nav",children:[t("button",{type:"button",className:"wizard-nav__btn wizard-nav__btn--prev",onClick:()=>E(r-1),disabled:r===0||c,children:i("wizard.back","Back")}),t("button",{type:"button",className:"wizard-nav__btn wizard-nav__btn--next",onClick:()=>E(r+1),disabled:r>=o.length-1||c,children:r>=o.length-2?i("wizard.reviewBtn","Review"):i("wizard.next","Next")})]})]})]}),a(ae,{fallback:null,children:[t(Ne,{}),t(Pe,{}),t(Re,{}),t(Ie,{})]})]})}var nt=ke;export{nt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerSlot as y}from"./73f7d65985.js";import{registerComponent as h}from"./882bc739c8.js";import{registerAction as d,registerIcon as b,registerModal as v}from"./09c4973968.js";import{setLabels as m,unsetLabels as R,getLabels as k,setLocale as f,getLocale as j,setCurrency as u,getCurrency as A}from"./28d887bf8a.js";import{applyTheme as E}from"./5c9fd9201c.js";import{use as L}from"./6d238282c1.js";import{onEvent as S}from"./2e366d7386.js";import{onRequest as w,onResponse as C,setTransport as i}from"./a3f18e76fe.js";import{registerPlacementStrategy as O}from"./281cf952fa.js";import{registerTargetRenderer as I}from"./58e6419ba8.js";import{registerComponentRenderer as M,registerMaterialResolver as T,registerInteraction as q,onSceneReady as x}from"./95a44ebec2.js";import{on as H,registerEffectHandler as P}from"./970313b92b.js";function s(e,t,r){if(!(!e||typeof e!="object"))for(const[n,o]of Object.entries(e)){const c=Array.isArray(o)?o:[o];for(const a of c){const l=t(n,a);typeof l=="function"&&r.push(l)}}}function p(e,t,r){if(Array.isArray(e))for(const n of e){const o=t(n);typeof o=="function"&&r.push(o)}}function _(e={}){const t=[];if(s(e.slots,y,t),s(e.components,h,t),s(e.icons,b,t),s(e.modals,v,t),s(e.actions,d,t),p(e.middleware,L,t),s(e.events,S,t),s(e.backendEvents,H,t),s(e.effectHandlers,P,t),e.http&&(p([].concat(e.http.onRequest||[]),w,t),p([].concat(e.http.onResponse||[]),C,t),typeof e.http.transport=="function"&&(i(e.http.transport),t.push(()=>i(null)))),p(e.placementStrategies,O,t),e.scene&&(s(e.scene.renderers,M,t),p([].concat(e.scene.materialResolvers||[]),T,t),s(e.scene.interactions,q,t),p([].concat(e.scene.onReady||[]),x,t),typeof e.scene.targetRenderer=="function"&&t.push(I(e.scene.targetRenderer))),e.labels&&typeof e.labels=="object"){const r=k(),n=Object.keys(e.labels);m(e.labels),t.push(()=>{const o={},c=[];for(const a of n)Object.prototype.hasOwnProperty.call(r,a)?o[a]=r[a]:c.push(a);R(c),m(o)})}if(e.locale){const r=j();f(e.locale),t.push(()=>f(r))}if(e.currency){const r=A();u(e.currency),t.push(()=>u(r))}return e.theme&&E(e.theme),function(){for(const n of t.reverse())try{n()}catch{}t.length=0}}var X=_;export{_ as configureSDK,X as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import y from"./872c4302e0.js";import F from"./9c6c598569.js";import L from"./d94df858ea.js";import V from"./8f60e5059a.js";import j from"./be337ddda5.js";import{applyFinishClick as X,normalizeMaterialTargets as z}from"./dc2a1a0e13.js";import{executeLayoutChange as Z}from"./9526094bb7.js";import{clearSceneLoadingAfterRender as $}from"./2774152dd2.js";import"./9326c23506.js";import"./061b81ad81.js";import{isOptionAvailable as U,isOptionVisible as ee}from"./817d930a49.js";import{runIntent as x,INTENTS as H}from"./6d238282c1.js";import{emitEvent as k,EVENTS as D}from"./2e366d7386.js";import{isAddFeature as te}from"./8c27edda0f.js";import{armHostedProduct as ne}from"./ab6c80484f.js";function oe(e,t,s){const o=y.getState(),{options:a,features:i,materials:c}=o,r=F.getState(),h=(r.selectedInstanceId??null)!=null,S=V.getState(),{hostStyles:d,hostHandleTypes:E,freePieceTier:N,setFreePieceTier:A,setSceneLoading:P,showInfo:G,clearSelectedFeature:W,clearPendingHostedProduct:Y}=S,I=r.activeSceneConfigId,b=L.getState().setSceneSelection,O=j.getState(),_=I?O.getSceneFeatures?.(I)||[]:[],m={layoutFeature:_.find(l=>l.type==="layout_change"),finishFeatures:_.filter(l=>l.type==="finish_change"),productFeatures:_.filter(l=>l.type==="load_new_product"),appliancesFeature:_.find(l=>l.type==="appliance_selection")};if(!e||!t)return!1;const T=i||{},g=e.id??e.feature_id??Object.keys(T).find(l=>T[l]===e);return g==null?!1:(import("./a77b15c0d6.js").then(({selectOptionForScene:l})=>l({optionSetId:g,optionId:s})).catch(()=>{}),!0)}function M(e,t,s=null,o=null){const a=y.getState(),i=s??a.features?.[e]??a.features?.[String(e)]??null;let c=o??a.options?.[t]??a.options?.[String(t)]??null;return!c&&Array.isArray(i?.options)&&(c=i.options.find(r=>r&&typeof r=="object"&&String(r.id)===String(t))??null),{optionSetName:i?.name??null,optionName:c?.name??c?.label??null}}function Oe(e,t,s){return x({type:H.OPTION_SELECT,optionSetId:e,optionId:t,optionSetType:s?.type??null,featureId:e,featureType:s?.type??null},()=>{const o=se(e,t,s);return k(D.OPTION_SELECTED,{optionSetId:e,optionId:t,featureType:s?.type??null,...M(e,t,s)}),o})}function se(e,t,s){const o=s?.type;if(o==="appliance_selection"){const n=y.getState(),u=n.options||{},v=u[t]||u[String(t)]||null,f=v?.value??v?.valueText??t,Q=n.getProduct?.(f)||n.products?.[f]||{id:f};return ne(Q)}if(o==="product_change"||o==="load_new_component"||o==="load_new_product"){const n=y.getState().options||{},u=n[t]||n[String(t)]||{id:t};return R(s,u)}const a=y.getState(),{options:i,features:c,materials:r}=a,p=F.getState(),h=p.selectedInstanceId??null,S=h!=null,d=V.getState(),{hostStyles:E,hostHandleTypes:N,freePieceTier:A,setFreePieceTier:P,setSceneLoading:G,showInfo:W,clearSelectedFeature:Y,clearPendingHostedProduct:I}=d,b=p.activeSceneConfigId,O=L.getState().setSceneSelection,_=j.getState(),m=b?_.getSceneFeatures?.(b)||[]:[],T={layoutFeature:m.find(n=>n.type==="layout_change"),finishFeatures:m.filter(n=>n.type==="finish_change"),productFeatures:m.filter(n=>n.type==="load_new_product"),appliancesFeature:m.find(n=>n.type==="appliance_selection")},g=i[t];if(g&&!ee(e,t)||g&&!U(e,t))return;const l=c?.[e]||c?.[String(e)]||s||{},C={...s||{},...l},B=z(g?.materialSlots??g?.material_slots),J=z(C?.material_targets??C?.materialTargets??C?.materials);if(B.length>0||J.length>0)return X({option:g,feature:C,scope:S?"single":"all",pieceIndex:S?h:null}),!0;let w="Updating...";const q=T.layoutFeature?.id===e,K=T.productFeatures?.some(n=>n.id===e);if(q)w="Changing layout...";else if(K){w=i[t]?.value===null?"Removing island...":"Adding island...";const u=i[t]?.tier??i[t]?.islandTier??null;(u==="single"||u==="double")&&P(u)}if(G(!0,w),q){const n=x({type:H.LAYOUT_CHANGE,optionSetId:e,optionId:t,featureId:e},()=>(requestAnimationFrame(()=>{Z(t,m),O(e,t),import("./a77b15c0d6.js").then(({applyLayoutPreset:u,refreshCanonicalState:v})=>setTimeout(()=>{const f=F.getState().activeSceneConfigId;f!=null?u(f):v()},400)).catch(()=>{})}),!0));return n!==!0&&G(!1),n===!0}return O(e,t),$(),!0}function Ce(e,t){return x({type:H.OPTION_SELECT,optionSetId:e?.id??e?.feature_id??null,optionId:t?.id??null,optionSetType:e?.type??null,featureId:e?.id??e?.feature_id??null,featureType:e?.type??null},()=>{const s=R(e,t);return k(D.OPTION_SELECTED,{optionSetId:e?.id??e?.feature_id??null,optionId:t?.id??null,featureType:e?.type??null,...M(e?.id??e?.feature_id,t?.id,e,t)}),s})}function R(e,t){const o=F.getState().selectedInstanceId??null,a=o!=null,i=L.getState().setSceneSelection;if(U(e?.id,t?.id))if(te(e,{productSelected:a}))i(e.id,t.id);else if(e.type==="load_new_product"&&a&&o!=null&&!String(o).endsWith("__host")){const c=y.getState(),r=t.value??t.valueText??t.value_text,p=r!=null?c.getProduct?.(r)||c.products?.[r]||c.products?.[String(r)]:null,h=p?.id??r,S=p?.productGraph??p?.product_graph??null,d=F.getState().productInstances?.[o]||null,E=d?.placementGroup??p?.placementGroup??p?.placement_group??null,N=d&&Number.isFinite(Number(d.sequence))?Number(d.sequence):void 0,A=Array.isArray(d?.position)?d.position:void 0;import("./a77b15c0d6.js").then(({addProduct:P})=>P({productGraphId:S,variantId:h,placementGroup:E,sequence:N,position:A,replace:!0,replacePlacementId:o})).catch(()=>{})}else a&&o!=null&&!String(o).endsWith("__host")?import("./a77b15c0d6.js").then(({selectOptionForProduct:c})=>c({placementId:o,optionSetId:t.optionSetId??t.option_set_id??e.feature_id??e.id,optionId:t.id})).catch(()=>{}):(oe(e,t,t.id),i(e.id,t.id))}export{oe as applyGlobalSwapViaGroup,Oe as selectOption,Ce as selectProductOption};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import b from"./8f60e5059a.js";import M from"./d94df858ea.js";import m from"./872c4302e0.js";import D,{deriveSceneFeatures as L}from"./be337ddda5.js";import I from"./9c6c598569.js";function w(t){return Array.isArray(t)?t:typeof t=="string"&&t.trim()?[t]:t&&typeof t=="object"?Object.keys(t):[]}function F({placementId:t,optionSetId:o,optionId:r}){o==null||r==null||import("./a77b15c0d6.js").then(e=>{t!=null?e.selectOptionForProduct?.({placementId:t,optionSetId:o,optionId:r}):e.selectOptionForScene?.({optionSetId:o,optionId:r})}).catch(()=>{})}function N(){const t=M.getState().sceneSelections||{},o=m.getState().options||{},r=m.getState().products||{},e=D.getState().sceneConfigurations||{},a=I.getState().activeSceneConfigId,h=e[a];for(const v of L(h)){if(v?.type!=="load_new_product")continue;const g=t?.[v.id],f=g!=null?o?.[g]?.value:null;if(f==null)continue;const _=r[f]||r[String(f)];if(!_)continue;if(String(_.placement_group??_.placementGroup??"").includes("freestanding"))return f}return null}function $({option:t,feature:o,scope:r,pieceIndex:e}){if(!t)return{ok:!1,scope:null,wrote:0};if(t.value==null)return{ok:!1,scope:null,wrote:0};const a=o?.id??o?.feature_id;if(a==null)return{ok:!1,scope:null,wrote:0};const h=w(t?.materialSlots??t?.material_slots),v=w(o?.material_targets??o?.materialTargets??o?.materials),g=(h.length>0?h:v).map(n=>String(n).toLowerCase()).filter(Boolean);if(g.length===0)return{ok:!1,scope:null,wrote:0};const f=r==="single"||r==="all"?r:e?"single":"all";if(f==="single"&&!e)return{ok:!1,scope:null,wrote:0};if(f==="single"){const n=b.getState(),p=m.getState().products||{},l=m.getState().components||{},c=I.getState().productInstances?.[e];let i=n.hostProductOverrides?.[e]??n.basePiecePositions?.[e]?.productId??c?.variantId??c?.productId;if(i==null&&String(e).endsWith("__host")){const u=I.getState(),s=m.getState(),d=String(e).replace(/__host$/,""),k=u.productInstances?.[d],P=s.getProduct?.(k?.variantId??k?.productId),O=P?.hostVariants??P?.host_variants,j=Array.isArray(O)?O.find(A=>A?.isDefault??A?.is_default)??O[0]:null;i=j?.hostVariantId??j?.host_variant_id??null}i=i??N();const G=(i!=null?p[i]||p[String(i)]:null)?.components_configuration||{},T=new Set(g);let y=0;const B=Object.values(G).reduce((u,s)=>Array.isArray(s)?[...u,...s.map(d=>d?.componentId).filter(Boolean)]:(s&&typeof s=="object"&&s.componentId!=null&&u.push(s.componentId),u),[]);for(const u of B){const s=l[u]||l[String(u)],d=String(s?.materialSlot??s?.material_slot??"").toLowerCase();d&&T.has(d)&&(n.setHostMaterialOverride(e,d,t.value),y++)}return y>0&&F({placementId:e,optionSetId:Number(a),optionId:t.id}),{ok:y>0,scope:"single",wrote:y}}M.getState().setSceneSelection(a,t.id);const S={...b.getState().hostMaterialOverrides};let C=0;for(const n of Object.keys(S)){const p=S[n]||{};let l=null;for(const c of g)p[c]!=null&&(l||(l={...p}),delete l[c],C++);l&&(S[n]=l)}C>0&&b.setState({hostMaterialOverrides:S});try{const n=I.getState(),p=n.placementSelections||{};for(const[l,c]of Object.entries(p))if(c&&Object.prototype.hasOwnProperty.call(c,String(a))){const i={...c};delete i[String(a)],n.setPlacementSelections?.(l,i)}}catch{}return F({optionSetId:Number(a),optionId:t.id}),{ok:!0,scope:"all",wrote:0}}export{$ as applyFinishClick,w as normalizeMaterialTargets};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=n=>String(n?.placementGroup??n?.placement_group??""),u=n=>Number.isFinite(Number(n?.sequence))?Number(n.sequence):0;function p(n){const t={};for(const e of Array.isArray(n)?n:[]){const r=s(e);r&&(t[r]||(t[r]=[])).push(e)}for(const e of Object.keys(t))t[e].sort((r,o)=>u(r)-u(o));return t}function g(n,t){const e=s(n);return e?(Array.isArray(t)?t:[]).filter(r=>s(r)===e).sort((r,o)=>u(r)-u(o)):[]}function l(n,t,e=r=>r?.id){const r=g(n,t),o=r.findIndex(i=>e(i)===e(n));return o===-1?{prev:null,next:null}:{prev:r[o-1]??null,next:r[o+1]??null}}function a(n,t){const e=String(n??""),r=(Array.isArray(t)?t:[]).filter(c=>s(c)===e).sort((c,f)=>u(c)-u(f)),o=r[r.length-1]??null,i=r.length?u(o)+1:0;return{after:o,nextSequence:i,isFirst:r.length===0}}function x(n,t){const e=s(n);return!!e&&e===s(t)}export{a as appendTargetFor,p as groupByPlacement,l as neighborsFor,g as rowFor,x as sameGroup};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
@layer sdk-base, vendor, sdk;
|
|
2
|
+
@layer sdk {
|
|
3
|
+
/* Quote dialog chrome. The DOCUMENT inside is the host's — these rules deliberately style the
|
|
4
|
+
frame and the shipped default template only, and every element carries a `data-part` hook so
|
|
5
|
+
a theme can restyle without replacing the template. */
|
|
6
|
+
.quote-view__backdrop {
|
|
7
|
+
position: fixed; inset: 0; z-index: var(--z-modal, 1000);
|
|
8
|
+
background: rgba(0, 0, 0, .45);
|
|
9
|
+
/* Every dialog backdrop (ours, host-registered, quote, backend show_message) blurs the page
|
|
10
|
+
behind it by this much. 0 turns it off; the dimming stays. */
|
|
11
|
+
backdrop-filter: blur(var(--modal-backdrop-blur, 4px));
|
|
12
|
+
-webkit-backdrop-filter: blur(var(--modal-backdrop-blur, 4px));
|
|
13
|
+
display: flex; align-items: center; justify-content: center; padding: 24px;
|
|
14
|
+
}
|
|
15
|
+
.quote-view {
|
|
16
|
+
background: var(--color-surface, #fff); color: var(--color-text, #14181b);
|
|
17
|
+
border-radius: 10px; max-width: 780px; width: 100%; max-height: 85vh;
|
|
18
|
+
display: flex; flex-direction: column; overflow: hidden;
|
|
19
|
+
}
|
|
20
|
+
.quote-view__doc { padding: 26px; overflow: auto; }
|
|
21
|
+
.quote-view__actions {
|
|
22
|
+
display: flex; gap: 8px; justify-content: flex-end;
|
|
23
|
+
padding: 12px 16px; border-top: 1px solid var(--color-border, #e4e7ea);
|
|
24
|
+
}
|
|
25
|
+
.quote-view__btn {
|
|
26
|
+
font: 500 13px/1 inherit; padding: 8px 14px; border-radius: 6px;
|
|
27
|
+
border: 1px solid var(--color-border, #e4e7ea); background: transparent; cursor: pointer;
|
|
28
|
+
color: inherit;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* ── the shipped default template ─────────────────────────────────────────── */
|
|
32
|
+
.quote-doc { font: 13px/1.55 inherit; }
|
|
33
|
+
.quote-doc__head {
|
|
34
|
+
display: flex; justify-content: space-between; align-items: baseline;
|
|
35
|
+
border-bottom: 2px solid var(--color-primary, #0b7285); padding-bottom: 10px;
|
|
36
|
+
}
|
|
37
|
+
.quote-doc__title { margin: 0; font-size: 18px; }
|
|
38
|
+
.quote-doc__date { opacity: .6; font-size: 12px; }
|
|
39
|
+
.quote-doc__scene { margin: 12px 0 0; opacity: .7; font-size: 12px; }
|
|
40
|
+
.quote-doc__empty { opacity: .6; }
|
|
41
|
+
.quote-doc__table { width: 100%; border-collapse: collapse; margin-top: 14px; }
|
|
42
|
+
.quote-doc__table th {
|
|
43
|
+
text-align: left; font: 600 11px/1 inherit; letter-spacing: .07em; text-transform: uppercase;
|
|
44
|
+
opacity: .6; padding: 0 8px 8px; border-bottom: 1px solid var(--color-border, #e4e7ea);
|
|
45
|
+
}
|
|
46
|
+
.quote-doc__table td {
|
|
47
|
+
padding: 9px 8px; border-bottom: 1px solid var(--color-border, #eef1f3); vertical-align: top;
|
|
48
|
+
}
|
|
49
|
+
.quote-doc__n { text-align: right; white-space: nowrap; }
|
|
50
|
+
.quote-doc__sku { display: block; font-size: 11px; opacity: .55; }
|
|
51
|
+
.quote-doc__opts { font-size: 12px; opacity: .75; }
|
|
52
|
+
.quote-doc__totals {
|
|
53
|
+
display: flex; justify-content: space-between; align-items: baseline;
|
|
54
|
+
margin-top: 14px; padding-top: 10px; border-top: 2px solid currentColor; font-size: 15px;
|
|
55
|
+
}
|
|
56
|
+
.quote-doc__note { margin: 10px 0 0; font-size: 11px; opacity: .7; }
|
|
57
|
+
|
|
58
|
+
/* Generated renders. Auto-fit rather than a fixed column count so the grid works at the
|
|
59
|
+
dialog's width and again on a printed page without a second breakpoint. */
|
|
60
|
+
.quote-doc__renders { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--color-border, #eef1f3); }
|
|
61
|
+
.quote-doc__renders-title {
|
|
62
|
+
margin: 0 0 10px; font: 600 11px/1 inherit; letter-spacing: .07em; text-transform: uppercase;
|
|
63
|
+
opacity: .6;
|
|
64
|
+
}
|
|
65
|
+
.quote-doc__render-grid {
|
|
66
|
+
display: grid; gap: 8px;
|
|
67
|
+
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
68
|
+
}
|
|
69
|
+
.quote-doc__render { margin: 0; }
|
|
70
|
+
.quote-doc__render img {
|
|
71
|
+
display: block; width: 100%; height: auto; border-radius: 6px;
|
|
72
|
+
background: var(--color-surface-2, #f4f6f8);
|
|
73
|
+
/* The renders are not all the same aspect ratio; a fixed box would letterbox or crop
|
|
74
|
+
them. Only the pending placeholder needs a reserved shape. */
|
|
75
|
+
}
|
|
76
|
+
.quote-doc__render figcaption { margin-top: 4px; font-size: 11px; opacity: .55; }
|
|
77
|
+
.quote-doc__render--pending {
|
|
78
|
+
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
79
|
+
aspect-ratio: 4 / 3; border-radius: 6px;
|
|
80
|
+
background: var(--color-surface-2, #f4f6f8);
|
|
81
|
+
border: 1px dashed var(--color-border, #d7dde2);
|
|
82
|
+
}
|
|
83
|
+
.quote-doc__render-pending { font: 600 15px/1 inherit; opacity: .45; }
|
|
84
|
+
|
|
85
|
+
/* A quote is printed. Drop the dialog chrome and let the document own the page. */
|
|
86
|
+
@media print {
|
|
87
|
+
.quote-view__backdrop { position: static; background: none; padding: 0; }
|
|
88
|
+
.quote-view { max-height: none; border-radius: 0; }
|
|
89
|
+
.quote-view__actions { display: none; }
|
|
90
|
+
tr { break-inside: avoid; }
|
|
91
|
+
/* Nothing half-finished on paper, and never a render split across two pages. */
|
|
92
|
+
.quote-doc__render--pending { display: none; }
|
|
93
|
+
.quote-doc__render, .quote-doc__renders { break-inside: avoid; }
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* AR QR. Sits beside the renders; white plate regardless of theme, because a QR inheriting a
|
|
97
|
+
dark palette becomes light-on-light and stops scanning — and a quote gets printed. */
|
|
98
|
+
.quote-doc__qr {
|
|
99
|
+
margin-top: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
|
|
100
|
+
}
|
|
101
|
+
.quote-doc__qr svg { background: #fff; padding: 6px; border-radius: 6px; }
|
|
102
|
+
.quote-doc__qr-label { font-size: 11px; opacity: .6; }
|
|
103
|
+
@media print {
|
|
104
|
+
.quote-doc__qr { break-inside: avoid; }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Spec-driven brand block. `--quote-accent` comes from `setDocument({ accent })`, with the
|
|
108
|
+
theme's primary as the fallback, so an unset accent still looks intentional. */
|
|
109
|
+
.quote-doc__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
|
|
110
|
+
.quote-doc__logo { max-height: 36px; max-width: 180px; width: auto; }
|
|
111
|
+
.quote-doc__company {
|
|
112
|
+
font: 600 11px/1 inherit; letter-spacing: .16em; text-transform: uppercase;
|
|
113
|
+
color: var(--quote-accent, var(--color-primary, #0b7285));
|
|
114
|
+
}
|
|
115
|
+
.quote-doc__head { border-bottom-color: var(--quote-accent, var(--color-primary, #0b7285)); }
|
|
116
|
+
.quote-doc__for { margin: 8px 0 0; font-size: 12px; opacity: .7; }
|
|
117
|
+
.quote-doc__terms {
|
|
118
|
+
margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--color-border, #eef1f3);
|
|
119
|
+
font-size: 11px; opacity: .7; white-space: pre-wrap;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Html as p}from"@react-three/drei";import{SELECTION_COLOR as a}from"./66c461dc2c.js";function d({gaps:o,onInsert:n,color:r=a}){return!Array.isArray(o)||o.length===0?null:o.map(t=>e(p,{position:t.position,center:!0,zIndexRange:[60,0],children:e("button",{onClick:i=>{i.stopPropagation(),n?.(t.index)},title:"Insert here",style:{width:28,height:28,borderRadius:"50%",border:"none",background:r,color:"#fff",fontSize:18,lineHeight:"28px",cursor:"pointer",boxShadow:"0 2px 6px rgba(0,0,0,0.25)",padding:0},children:"+"})},`gap-${t.index}`))}export{d as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=null;function a(){if(e)return e;const t=new Set;try{const n=new URLSearchParams(window.location.search).get("debug");n&&n.split(",").forEach(o=>{const r=o.trim().toLowerCase();r&&t.add(r)})}catch{}return e=t,t}function d(t){return a().has(String(t).toLowerCase())}try{typeof window<"u"&&(window.__debugHydrate=a().has("hydrate"))}catch{}export{d as debugEnabled};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let t=null;function n(e){t=e}function r(){return t}export{r as getR3FState,n as setR3FState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as p}from"react/jsx-runtime";import{QRCodeSVG as u}from"qrcode.react";import{useLabels as f}from"./28d887bf8a.js";function m({images:a,url:i,label:t,size:c=96,className:l=""}){const d=f(),o=t===void 0?d("quote.arScan","Scan to view in your room"):t,e=(a?.images??[]).find(s=>s.type==="ar"),n=i??(e?.status==="complete"&&e.url?e.url:null);return n?p("section",{className:`quote-doc__qr ${l}`.trim(),"data-part":"quote/qr",children:[r(u,{value:n,size:c,level:"M",bgColor:"#ffffff",fgColor:"#000000",marginSize:2}),o&&r("figcaption",{className:"quote-doc__qr-label",children:o})]}):null}export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as e}from"react/jsx-runtime";import"react";import{useLabels as N}from"./28d887bf8a.js";import S from"./8f60e5059a.js";import g from"./bdec200d00.js";import y from"./9794652102.js";import A from"./54413c1eae.js";import{resolveComponent as t,useComponentRegistry as n}from"./882bc739c8.js";import B from"./37596ace72.js";import T from"./26155bf68c.js";import _ from"./2cab5c5c23.js";import{useShellModel as C,CopilotActionsRegister as G,ShellModals as L,ShellAssistants as M}from"./c71892453b.js";import"./bdc4e4c5b9.css";function P({Scene:i}){return o(O,{Scene:i})}function O({Scene:i}){n();const l=t("Sidebar",g);n();const m=t("SceneToolbar",A),c=t("GenerateAssetsButton",T),d=t("SaveProjectButton",_),{regions:a,isLayoutLoading:r,copilotAvailable:p,handleGenerateAssets:h,isGenerating:u,systemName:v,priceText:f}=C(),w=S(b=>b.isMobile),s=N();return e("div",{className:"showroom-layout",children:[o(y,{}),p&&o(G,{}),e("main",{className:"showroom-scene",children:[o(i,{isMobile:w}),a.toolbar&&o(m,{variant:"desktop"}),a.notifications&&o(B,{}),o(M,{})]}),a.sidebar&&e("aside",{className:"showroom-panel",style:r?{opacity:.6,pointerEvents:"none"}:void 0,children:[e("div",{className:"showroom-head",children:[o("h1",{className:"showroom-title",children:v}),s("showroom.intro","Configure your piece below \u2014 each option updates the preview live.")?o("p",{className:"showroom-info",children:s("showroom.intro","Configure your piece below \u2014 each option updates the preview live.")}):null]}),o("div",{className:"showroom-body",children:o(l,{embedded:!0})}),e("div",{className:"showroom-foot",children:[e("div",{className:"showroom-foot__price",children:[s("shell.total","TOTAL")?o("span",{className:"showroom-foot__label",children:s("shell.total","TOTAL")}):null,o("strong",{className:"showroom-foot__value",children:f})]}),e("div",{className:"showroom-foot__actions",children:[o(d,{disabled:r,className:"showroom-save"}),o(c,{onClick:h,isGenerating:u,disabled:r,className:"showroom-cta"})]})]})]}),o(L,{})]})}var K=P;export{K as default};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@layer sdk-base, vendor, sdk;
|
|
2
|
+
@layer sdk {
|
|
3
|
+
/* Evaluate-in-flight veil: freezes input immediately and dims after a beat. The spinner +
|
|
4
|
+
message inside is the shared LoadingScreen (compact form), rendered through the override
|
|
5
|
+
registry — its look lives in globals.css (.loading-screen--compact) and in whatever a host
|
|
6
|
+
registered as 'LoadingScreen'. Nothing visual is drawn here. */
|
|
7
|
+
.evaluating-overlay {
|
|
8
|
+
position: fixed;
|
|
9
|
+
inset: 0;
|
|
10
|
+
z-index: 9999;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
cursor: progress;
|
|
15
|
+
pointer-events: auto; /* freeze all input while an evaluate is in flight */
|
|
16
|
+
background: transparent;
|
|
17
|
+
transition: background 120ms ease;
|
|
18
|
+
}
|
|
19
|
+
.evaluating-overlay--visible {
|
|
20
|
+
background: rgba(0, 0, 0, 0.06);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@media (prefers-color-scheme: dark) {
|
|
24
|
+
.evaluating-overlay--visible { background: rgba(0, 0, 0, 0.28); }
|
|
25
|
+
}
|
|
26
|
+
:root[data-theme-mode="dark"] .evaluating-overlay--visible { background: rgba(0, 0, 0, 0.28); }
|
|
27
|
+
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{captureMultipleViews as I}from"./921bf270dd.js";import{getR3FState as V}from"./e1cd279733.js";let T=null;async function $(){return T||(T=(await import("jspdf")).jsPDF),T}const z=[{key:"perspective",autoFit:!0,position:[4.2,3.4,4.5],target:[0,.4,0],label:"Perspective View"},{key:"front",autoFit:!0,position:[0,1.08,3.92],target:[0,1,0],label:"Front View"},{key:"top",autoFit:!0,position:[0,6.75,0],target:[0,.85,0],label:"Plan View"}],W=1152/1536;async function H(){const l=V()?.gl?.domElement||null;return I(l,z)}function E(l,m="USD"){return l==null||!Number.isFinite(Number(l))?"":new Intl.NumberFormat("en-US",{style:"currency",currency:m}).format(Number(l))}async function _({projectName:l,customer:m={},configuration:a,priceBreakdown:F,includePrice:c}={}){const b=await H();return M({views:b,projectName:l,customer:m,configuration:a,priceBreakdown:F,includePrice:c})}async function M({views:l={},projectName:m,customer:a={},configuration:F=null,priceBreakdown:c=null,includePrice:b=!0}={}){const A=await $(),t=new A({orientation:"portrait",unit:"mm",format:"a4"}),u=t.internal.pageSize.getWidth(),P=t.internal.pageSize.getHeight(),o=16,S=u-o*2;let e=o;const f=n=>{e+n>P-o&&(t.addPage(),e=o)},y=n=>{f(14),t.setFont("helvetica","bold"),t.setFontSize(13),t.setTextColor(30),t.text(n,o,e),e+=3,t.setDrawColor(220),t.setLineWidth(.3),t.line(o,e,u-o,e),e+=6,t.setTextColor(0)};t.setFont("helvetica","bold"),t.setFontSize(20),t.text(m||"My Design",o,e),e+=7,t.setFont("helvetica","normal"),t.setFontSize(9),t.setTextColor(120),t.text(`Generated ${new Date().toLocaleDateString()}`,o,e),t.setTextColor(0),e+=8;const C=S,p=Math.min(S*W,110);for(const n of z){const s=l[n.key];if(!s)continue;f(p+12),t.setFont("helvetica","bold"),t.setFontSize(10),t.text(n.label,o,e+4),e+=7;let i=C,r=p,x="JPEG";try{const h=t.getImageProperties(s),w=h?.width>0&&h?.height>0?h.width/h.height:1/W;r=C/w,r>p&&(r=p,i=p*w),h?.fileType&&(x=h.fileType)}catch{}const d=(u-i)/2;t.setDrawColor(210),t.rect(d,e,i,r);try{t.addImage(s,x,d,e,i,r)}catch{}e+=r+8}const v=Array.isArray(F?.products)?F.products:[];if(v.length>0){y("Configuration Details"),t.setFontSize(10);for(const n of v){f(10),t.setFont("helvetica","bold"),t.setTextColor(0),t.text(n.productName||"(unnamed)",o,e),e+=6,t.setFont("helvetica","normal"),t.setTextColor(80);const s=Array.isArray(n.selections)?n.selections:[];for(const i of s){if(!i?.name||i.value==null||i.value==="")continue;f(5);const r=`${i.name}: `,x=t.getTextWidth(r);t.text(r,o+4,e);const d=t.splitTextToSize(String(i.value),S-4-x);t.text(d,o+4+x,e),e+=Math.max(d.length,1)*5}e+=4,t.setTextColor(0)}}const D=Array.isArray(c?.items)?c.items:[];if(b&&c&&(D.length>0||Number.isFinite(Number(c.total)))){const n=c.currency||"USD";y("Pricing"),t.setFontSize(10),t.setFont("helvetica","normal"),t.setTextColor(30);for(const s of D){if(!s?.productName)continue;f(5);const i=E(s.total,n);t.text(String(s.productName),o,e),t.text(i,u-o,e,{align:"right"}),e+=5}Number.isFinite(Number(c.total))&&(e+=2,t.setDrawColor(200),t.setLineWidth(.3),t.line(o,e,u-o,e),e+=5,t.setFont("helvetica","bold"),t.setFontSize(11),t.setTextColor(0),t.text("Total",o,e),t.text(E(c.total,n),u-o,e,{align:"right"}),e+=8),t.setTextColor(0)}y("Submission Details"),t.setFontSize(10);const g=(n,s)=>{if(!s)return;f(6),t.setFont("helvetica","bold"),t.text(`${n}: `,o,e);const i=t.getTextWidth(`${n}: `);t.setFont("helvetica","normal");const r=t.splitTextToSize(String(s),S-i);t.text(r,o+i,e),e+=Math.max(r.length,1)*6};g("Name",[a.firstName,a.lastName].filter(Boolean).join(" ")),g("Email",a.email),g("Phone",a.phone),g("Project",m),g("Company",a.company),g("Address",a.address),g("Note",a.note);const N=t.internal.getNumberOfPages();for(let n=1;n<=N;n+=1)t.setPage(n),t.setFont("helvetica","normal"),t.setFontSize(8),t.setTextColor(140),t.text(`Page ${n} of ${N}`,u-o,P-8,{align:"right"}),t.setTextColor(0);return t.output("blob")}export{M as buildDesignPdf,_ as buildDesignPdfBlob,H as captureDesignViews};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveBasePrice as m}from"./b5c372377f.js";class h{constructor(){this.priceConfig={multiplier:1,currency:"USD",showPrices:!0}}setPriceConfig(t){this.priceConfig={...this.priceConfig,...t}}calculateInstancePrice(t){const{product:o,selections:s,options:a,features:l}=t;if(!o)return 0;let r=m(o)??0;for(const[c,n]of Object.entries(s)){if(!l[c])continue;const i=a[n],e=i?.priceModifier||i?.price_modifier;e&&(e.type==="add"?r+=e.value:e.type==="multiply"?r*=e.value:e.type==="percentage"&&(r+=r*(e.value/100)))}return r}calculateSceneTotal(t){const{productInstances:o,instanceSelections:s,products:a,options:l,features:r}=t;let c=0;const n={};for(const[i,e]of Object.entries(o)){const u=a[e.productId],y=s[i]||{},p=this.calculateInstancePrice({product:u,selections:y,options:l,features:r}),d=m(u)??0;n[i]={productId:e.productId,productName:u?.name||"Unknown",basePrice:d,modifiers:p-d,total:p},c+=p}const f=c*this.priceConfig.multiplier;return{subtotal:c,multiplier:this.priceConfig.multiplier,total:f,currency:this.priceConfig.currency,breakdown:n}}formatPrice(t){return new Intl.NumberFormat("en-US",{style:"currency",currency:this.priceConfig.currency}).format(t)}shouldShowPrices(){return this.priceConfig.showPrices}}const C=new h;var I=C;export{h as PriceCalculator,I as default};
|