@epigraph/solutions 1.0.12 → 1.0.13
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.
|
@@ -4342,7 +4342,7 @@ ${l.join(`
|
|
|
4342
4342
|
float verticalAperture = ${o.getFilmHeight().toPrecision(nn)}
|
|
4343
4343
|
}
|
|
4344
4344
|
|
|
4345
|
-
`}var rI=(o=>(o.NONE="none",o.CONTACT="contact",o.ACCUMULATIVE="accumulative",o))(rI||{});class Tz extends EventTarget{constructor(e){super(),this._loggerContext="THREEJS ENGINE",this.__scene=new Ca,this.__tweenGroup=new bC,this.__clock=new rC,this.__effectsComposer={},this.__canvas={},this.__mainRenderer={},this.__textRenderer={},this.__screenshotRenderer={},this.__sceneHierarchy={baseSceneGrp:new fi,lightsGrp:new fi,sceneStructure:{},dimensionLinesGrp:new fi,miscGrp:new fi},this.
|
|
4345
|
+
`}var rI=(o=>(o.NONE="none",o.CONTACT="contact",o.ACCUMULATIVE="accumulative",o))(rI||{});class Tz extends EventTarget{constructor(e){super(),this._loggerContext="THREEJS ENGINE",this.__scene=new Ca,this.__tweenGroup=new bC,this.__clock=new rC,this.__effectsComposer={},this.__canvas={},this.__mainRenderer={},this.__textRenderer={},this.__screenshotRenderer={},this.__sceneHierarchy={baseSceneGrp:new fi,lightsGrp:new fi,sceneStructure:{},dimensionLinesGrp:new fi,miscGrp:new fi},this.__lengthLine={},this.__depthLine={},this.__heightLine={},this.__textureAnisotropyToUse=4,this.__appWcRef=e,this.__sceneHierarchy.sceneStructure=this.__appWcRef.sceneManager.sceneStructure}get canvas(){return this.__canvas}get scene(){return this.__scene}get productSettings(){return this.__appWcRef.productSettings}get mainRenderer(){return this.__mainRenderer}get textRenderer(){return this.__textRenderer}get effectsComposer(){return this.__effectsComposer}get screenshotRenderer(){return this.__screenshotRenderer}get sceneHierarchy(){return this.__sceneHierarchy}get contactShadows(){return this.__contactShadows}get accumulativeShadows(){return this.__accumulativeShadows}getClockDelta(){return this.__clock.getDelta()}get tweenGroup(){return this.__tweenGroup}updateAllTextureAnisotropy(){this.__scene.traverse(e=>{const i=e.material;i?.map&&(i.map.anisotropy=this.__textureAnisotropyToUse,i.needsUpdate=!0)})}printSceneHierarchy(e=!1){(function t(i){if(e===!0)console.group(`------ ${i.name} ------`),console.log(i);else{const s="epgType"in i?i.epgType:i.type;console.group(" <"+s+"> "+i.name)}i.children.forEach(t),console.groupEnd()})(this.__scene)}printSceneStructure(){let e="--";(function t(i){if(i instanceof vo||i instanceof Gr){const s=i.epgType;console.group(`${e} < ${s} > ${i.name} || ${i.uuid}`),e+="--|"}i.children.forEach(t),console.groupEnd()})(this.__sceneHierarchy.sceneStructure)}async emptyScene(){Et.dispose3(this.scene),this.__sceneHierarchy.baseSceneGrp.clear(),this.__sceneHierarchy.lightsGrp.clear();const e=[];this.__sceneHierarchy.sceneStructure.rootEntity.traverse(t=>{t.uuid!==this.__sceneHierarchy.sceneStructure.rootEntity.uuid&&t instanceof vo&&e.push(t)});for(const t of e)t.removeFromParent(),Et.dispose3(t)}async _setupSceneHierarchy(){this.__sceneHierarchy.baseSceneGrp.name="GRP_BASE_SCENE",this.__scene.add(this.__sceneHierarchy.baseSceneGrp),this.__sceneHierarchy.lightsGrp.name="GRP_LIGHTS",this.__scene.add(this.__sceneHierarchy.lightsGrp),this.__scene.add(this.__sceneHierarchy.sceneStructure),this.__sceneHierarchy.dimensionLinesGrp.name="GRP_DIMENSIONS_LINES",this.__scene.add(this.__sceneHierarchy.dimensionLinesGrp),this.__sceneHierarchy.miscGrp.name="GRP_MISC",this.__scene.add(this.__sceneHierarchy.miscGrp)}updateEnvMap(e=this.__appWcRef.productSettings.render.envMap){new V1().load(e,i=>{i.mapping=gh,this.__scene.environment=i})}async _setupLights(){this.__mainRenderer.outputColorSpace=Qt,this.__mainRenderer.toneMapping=M0,this.updateEnvMap()}__setupEffectComposer(){this.__effectsComposer=new O$(this.__mainRenderer),window.epigraph.logger.info({title:"Effects to enable",details:this.productSettings.postEffect,contextOverride:this._loggerContext})}__constructLineSegment(e,t,i){const s=[e,t],l=new xi().setFromPoints(s),u=new Io(l,i);return u.castShadow=!1,u}__setupDimensionLines(){const e={color:new je().setHex(11776947).convertSRGBToLinear(),scale:1,dashSize:.02,gapSize:.02},t=new Sg(e),i=new Sg(e),s=new Sg(e),l=new se;this.__lengthLine=this.__constructLineSegment(l,l,t),this.__depthLine=this.__constructLineSegment(l,l,i),this.__heightLine=this.__constructLineSegment(l,l,s),this.__sceneHierarchy.dimensionLinesGrp.add(this.__lengthLine),this.__sceneHierarchy.dimensionLinesGrp.add(this.__depthLine),this.__sceneHierarchy.dimensionLinesGrp.add(this.__heightLine),this.setDimensionsVisibility(!1)}updateDimensionLines(e){this.__lengthLine.geometry?.setFromPoints([e.length.begin.worldPos,e.length.end.worldPos]),this.__depthLine.geometry?.setFromPoints([e.width.begin.worldPos,e.width.end.worldPos]),this.__heightLine.geometry?.setFromPoints([e.height.begin.worldPos,e.height.end.worldPos]),this.__lengthLine?.computeLineDistances(),this.__depthLine?.computeLineDistances(),this.__heightLine?.computeLineDistances()}frameUpdate(){this.__appWcRef.eventsManager.frameUpdated.fire()}repopulateHotspotIndicators(){this.__appWcRef.eventsManager.hotspotsUpdatedEvent.fire()}setDimensionsVisibility(e){this.__lengthLine.visible=e,this.__depthLine.visible=e,this.__heightLine.visible=e}async getSceneAsUsdzUrl(){const e=this.__sceneHierarchy.sceneStructure;this.printSceneHierarchy();const i=await new uz().parseAsync(e,{quickLookCompatible:!0}),s=new Blob([i],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(s)}async getSceneAsGlbUrl(){const e=new Sk;e.registerExtensions([i1]);const t=new Ih,s=this.__sceneHierarchy.sceneStructure;this.printSceneHierarchy();const l={binary:!0,forceIndices:!0,trs:!1,onlyVisible:!0,embedImages:!0,maxTextureSize:1024},u=await t.parseAsync(s,l),d=await e.readBinary(new Uint8Array(u)),f=await this.optimizeGlb(d),g=await e.writeBinary(f);return await this.saveArrayBufferAsURL(g)}async optimizeGlb(e){const i=e.getRoot().listNodes();for(const s of i){s.setExtras({});const l=s.getName();(l==="GRP_ProxyMesh"||l==="GRP_LoadingPlaceholder")&&s.dispose()}return await e.transform(uF(),TF()),e}async saveArrayBufferAsURL(e){const t=new Blob([e],{type:"application/gltf-buffer"});return window.epigraph.logger.info({title:"Approx scene GLB size: "+t.size/1e6}),URL.createObjectURL(t)}__perFrameUpdate(){const e=this.__clock.getDelta();this.__contactShadows?.isEnabled()&&this.__contactShadows.reCalculate(),this.__appWcRef.postRenderFrameUpdateInEngine(e),this.__effectsComposer.render(),this.__tweenGroup.update(),requestAnimationFrame(this.__perFrameUpdate.bind(this))}__setupRenderers(){this.__mainRenderer=new tp({antialias:this.productSettings.renderQuality.antiAlias,alpha:this.__appWcRef.transparentBackground});const e=this.__appWcRef.canvasSize.width||this.__appWcRef.getBoundingClientRect().width||300,t=this.__appWcRef.canvasSize.height||this.__appWcRef.getBoundingClientRect().height||150;this.__mainRenderer.setSize(e,t),this.__appWcRef.transparentBackground||this.__mainRenderer.setClearColor(this.productSettings.camera.backgroundColor),this.productSettings.screenshots.enabled&&(this.__screenshotRenderer=new tp({antialias:this.productSettings.renderQuality.antiAlias,preserveDrawingBuffer:!0}),document.body.appendChild(this.__screenshotRenderer.domElement),this.__screenshotRenderer.domElement.style.display="none"),this.__textRenderer=new j1,this.__textRenderer.setSize(e,t),this.__textRenderer.domElement.style.position="absolute",this.__textRenderer.domElement.style.top="0px",this.__textRenderer.domElement.style.pointerEvents="none",document.body.appendChild(this.__textRenderer.domElement)}showTextRenderer(){this.__textRenderer.domElement.style.display="block"}hideTextRenderer(){this.__textRenderer.domElement.style.display="none"}__setupShadows(){switch(this.__mainRenderer.shadowMap.enabled=!0,this.productSettings.shadows.shadowType){case"contact":this.__mainRenderer.shadowMap.type=C0,this.__contactShadows||(this.__contactShadows=new $$({scene:this.__scene,sceneHierarchyToCastShadow:this.__sceneHierarchy.sceneStructure,targetRenderer:this.__mainRenderer,settings:this.productSettings.shadows.contactShadows})),this.__accumulativeShadows?.disable(),this.__contactShadows?.enable();break;case"accumulative":this.__mainRenderer.shadowMap.type=MT,this.__accumulativeShadows||(this.__accumulativeShadows=new cz({scene:this.__scene,targetRenderer:this.__mainRenderer,settings:this.productSettings.shadows.accumulativeShadows,appWcRef:this.__appWcRef})),this.__contactShadows?.disable(),this.__accumulativeShadows?.enable();break;case"none":this.__accumulativeShadows?.disable(),this.__contactShadows?.disable();break}}async setup(){this.__setupRenderers(),this.__canvas=this.__mainRenderer.domElement,await this._setupSceneHierarchy(),await this._setupLights(),this.__setupShadows(),this.__setupDimensionLines(),this.__setupEffectComposer();const e=this.__mainRenderer.capabilities.getMaxAnisotropy();e<this.__textureAnisotropyToUse&&(this.__textureAnisotropyToUse=e),this.__perFrameUpdate(),requestAnimationFrame(this.__perFrameUpdate.bind(this));const t={canvasHtmlElem:this.__canvas,renderer:this.__mainRenderer,screenshotRenderer:this.__screenshotRenderer??void 0},i=1;return this.mainRenderer.setPixelRatio(i),this.effectsComposer.setPixelRatio(i),this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.experienceUpdatedEvent.name,()=>{this.__setupShadows()}),Promise.resolve(t)}}/*!
|
|
4346
4346
|
* camera-controls
|
|
4347
4347
|
* https://github.com/yomotsu/camera-controls
|
|
4348
4348
|
* (c) 2017 @yomotsu
|
|
@@ -8506,7 +8506,7 @@ void main() {
|
|
|
8506
8506
|
`:xe`
|
|
8507
8507
|
${super.render()}
|
|
8508
8508
|
${this.__renderQrModal()}
|
|
8509
|
-
`}};zo([Ut("#modelViewer")],Da.prototype,"modelViewerElem");zo([Ut("#arModal")],Da.prototype,"arModalElem");zo([Ut("#qrModal")],Da.prototype,"qrModalElem");zo([ue({attribute:!1})],Da.prototype,"appWcRef");zo([ue({type:String,attribute:"glb-src"})],Da.prototype,"glbSrc");zo([ue({type:String,attribute:"usdz-src"})],Da.prototype,"usdzSrc");zo([ue({type:Boolean,attribute:"debug"})],Da.prototype,"debug");let WQ=Da;class wt{constructor(e,t,i=""){this.__name="app:generic:event",this.__eventsManager=e,this.__name=t,this.__detail=i}get name(){return this.__name}get detail(){return this.__detail}fire(e){const t=new CustomEvent(this.__name,{detail:e??this.__detail});this.__eventsManager.eventHubRef.dispatchEvent(t)}}class YQ extends EventTarget{constructor(e){super(),this._loggerContext="EVENTS MANAGER",window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext}),e?this.eventHubRef=e:this.eventHubRef=this,this.assetLoadProgress=new wt(this,"assetLoadProgress",""),this.experienceUpdatedEvent=new wt(this,"experienceUpdated",""),this.appReadyEvent=new wt(this,"appReady",""),this.appFailedEvent=new wt(this,"appFailed",""),this.productClassChangedEvent=new wt(this,"productClassChanged",""),this.productChangedEvent=new wt(this,"productChanged",""),this.variantChangedEvent=new wt(this,"variantChanged",""),this.structureNodeAddedEvent=new wt(this,"structureNodeAdded",""),this.structureNodeRemovedEvent=new wt(this,"structureNodeRemoved",""),this.structureChangedEvent=new wt(this,"structureChanged",""),this.showNodeLoadingIcon=new wt(this,"nodeLoadingShow",""),this.hideNodeLoadingIcon=new wt(this,"nodeLoadingHide",""),this.cameraFitEvent=new wt(this,"cameraFit",""),this.hotspotsUpdatedEvent=new wt(this,"hotspotsUpdated",""),this.hotspotsVisibilityChanged=new wt(this,"hotspotsVisibilityChanged",""),this.hotspotClickedEvent=new wt(this,"hotspotClicked",""),this.hotspotOpenEvent=new wt(this,"hotspotOpen",""),this.hotspotClosedEvent=new wt(this,"hotspotClosed",""),this.hotspotNextEvent=new wt(this,"hotspotNext",""),this.hotspotPreviousEvent=new wt(this,"hotspotPrevious",""),this.sceneBoundsChanged=new wt(this,"sceneBoundsChanged",""),this.dimensionsPositionChanged=new wt(this,"dimensionsPositionChanged",""),this.dimensionsValueChanged=new wt(this,"dimensionsValueChanged",""),this.dimensionsVisibilityChanged=new wt(this,"dimensionsVisibilityChanged",""),this.arModelReadyEvent=new wt(this,"arGlbReady",""),this.cartChangedEvent=new wt(this,"cartChanged",""),this.sceneRestartedEvent=new wt(this,"sceneRestarted",""),this.pickerFoundPosition=new wt(this,"pickerFoundPosition",""),this.frameUpdated=new wt(this,"frameUpdated",""),this.cameraControlsStart=new wt(this,"cameraControlsStart",""),this.inputStart=new wt(this,"inputStart",""),this.inputMove=new wt(this,"inputMove",""),this.inputEnd=new wt(this,"inputEnd",""),this.cameraMoveToTransform=new wt(this,"cameraMoveToTransform",""),this.debugChanged=new wt(this,"debugChanged","")}}class XQ{constructor(e,t){this.__assets=new Map,this.__appWcRef=t,this.__config=e}async initialize(){for(const e in this.__config){const t=new Z1(this.__config[e],this.__appWcRef);await t.load(),this.__assets.set(e,t)}}async loadAllProxies(){for(const e of this.__assets.values())await e.loadProxyGltf()}async loadAllRenderAssets(){for(const e of this.__assets.values())await e.loadRenderGltf(!0)}getAssetByName(e){return this.__assets.get(e)}getFirstAsset(){return this.__assets.values().next().value}}class KQ{constructor(e){this.__assetClass=e.assetClass,this.__asset=e.asset,this.__assetId=e.assetId,this.__finish=e.finish,this.__productOptionValue=e.productOptionValue}get assetClass(){return this.__assetClass}get asset(){return this.__asset}get assetId(){return this.__assetId}get finish(){return this.__finish}get productOptionValue(){return this.__productOptionValue}}class JQ{constructor(e,t){this.__productParts=[],this.__id=e.id,this.__name=e.name,this.__productId=t,this.__sku=e.sku,this.__upc=e.upc,this.__asin=e.asin,this.__shopifyVariantId=e.shopifyVariantId,this.__uuid=e.uuid,this.parseProductParts(e.productParts)}get id(){return this.__id}get name(){return this.__name}get productId(){return this.__productId}get sku(){return this.__sku}get upc(){return this.__upc}get asin(){return this.__asin}get shopifyVariantId(){return this.__shopifyVariantId}get uuid(){return this.__uuid}get productParts(){return this.__productParts}parseProductParts(e){for(const t of e){const i=new KQ(t);this.__productParts.push(i)}}}class ZQ{constructor(e,t){this.__productVariants=new Map,this.__productVariantNames=new Map,this.__productVariantSkus=new Map,this.__productVariantUpcs=new Map,this.__productVariantAsins=new Map,this.__productVariantShopifyVariantIds=new Map,this.__productVariantUuids=new Map,this.__productId=t;for(const i of e){const s=new JQ(i,this.__productId);s&&this.addProductVariant(s)}}addProductVariant(e){this.__productVariants.set(e.id,e),this.__productVariantNames.set(e.name,e),e.sku&&this.__productVariantSkus.set(e.sku,e),e.upc&&this.__productVariantUpcs.set(e.upc,e),e.asin&&this.__productVariantAsins.set(e.asin,e),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.set(e.shopifyVariantId,e),e.uuid&&this.__productVariantUuids.set(e.uuid,e)}removeProductVariant(e){e.sku&&this.__productVariantSkus.delete(e.sku),e.upc&&this.__productVariantUpcs.delete(e.upc),e.asin&&this.__productVariantAsins.delete(e.asin),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.delete(e.shopifyVariantId),this.__productVariantNames.delete(e.name),this.__productVariants.delete(e.id)}getAllProductVariants(){return Array.from(this.__productVariants.values())}getAllProductVariantIds(){return Array.from(this.__productVariants.keys())}getAllProductVariantNames(){return Array.from(this.__productVariantNames.keys())}getProductVariantById(e){return this.__productVariants.get(e)}getProductVariantByName(e){return this.__productVariantNames.get(e)}getProductVariantBySku(e){return this.__productVariantSkus.get(e)}getProductVariantByUpc(e){return this.__productVariantUpcs.get(e)}getProductVariantByAsin(e){return this.__productVariantAsins.get(e)}getProductVariantByShopifyVariantId(e){return this.__productVariantShopifyVariantIds.get(e)}getProductVariantByUuid(e){return this.__productVariantUuids.get(e)}getProductVariantByIdentifierAndType(e,t){switch(t){case ro.SKU:return this.getProductVariantBySku(e);case ro.SHOPIFY_VARIANT_ID:return this.getProductVariantByShopifyVariantId(e);case ro.ASIN:return this.getProductVariantByAsin(e);case ro.UPC:return this.getProductVariantByUpc(e);case ro.EXPERIENCE_ID:return;case ro.PRODUCT_VARIANT_UUID:return this.getProductVariantByUuid(e);default:return}}}class e8 extends J1{constructor(e){super(e)}}class t8{constructor(e){this.__appWcRef=e,this.__materialLibraries=new Map}get materialLibraries(){return this.__materialLibraries}makeEmpty(){this.__materialLibraries.clear()}async addMaterialLibrary(e,t){const i=new e8({id:e,uri:t,preload:!1,appWcRef:this.__appWcRef});return this.__materialLibraries.set(i.id,i),i}}class vM{constructor(){this.productSettings={postEffect:{ao:!1},camera:{initial:null,backgroundColor:"#ffffff",backgroundAlpha:1,focalLength:35,nearClip:.01,farClip:1e3,canPan:!0,canZoom:!0,minDistance:2,maxDistance:8,minPolarAngle:null,maxPolarAngle:null,minAzimuthAngle:null,maxAzimuthAngle:null},renderQuality:{antiAlias:!0},screenshots:{enabled:!1},shadows:{shadowType:rI.NONE,accumulativeShadows:{shadowMaterial:{opacity:.8,alphaTest:.75,color:"#000000",blend:1},shadowParams:{frames:30,scale:10,radius:.8,ambient:.5},light:{direction:{x:3,y:5,z:3}}},contactShadows:{planeLength:3,planeWidth:3,cameraHeight:1,intensity:1,softness:1}},hotspots:{showNavigationButtons:!0}}}_deepCopyProductSettings(e){const t=this.productSettings;e.camera&&(e.camera.initial&&(t.camera.initial=e.camera.initial),e.camera.backgroundColor&&(t.camera.backgroundColor=e.camera.backgroundColor),e.camera.backgroundAlpha&&(t.camera.backgroundAlpha=e.camera.backgroundAlpha),e.camera.focalLength&&(t.camera.focalLength=e.camera.focalLength),e.camera.canPan!==void 0&&(t.camera.canPan=e.camera.canPan),e.camera.canZoom!==void 0&&(t.camera.canZoom=e.camera.canZoom),e.camera.minDistance&&(t.camera.minDistance=e.camera.minDistance),e.camera.maxDistance&&(t.camera.maxDistance=e.camera.maxDistance),e.camera.minPolarAngle&&(t.camera.minPolarAngle=e.camera.minPolarAngle),e.camera.maxPolarAngle&&(t.camera.maxPolarAngle=e.camera.maxPolarAngle),e.camera.minAzimuthAngle&&(t.camera.minAzimuthAngle=e.camera.minAzimuthAngle),e.camera.maxAzimuthAngle&&(t.camera.maxAzimuthAngle=e.camera.maxAzimuthAngle)),e.postEffect&&(t.postEffect=e.postEffect),e.renderQuality&&(t.renderQuality=e.renderQuality),e.screenshots&&(t.screenshots=e.screenshots),e.shadows?.shadowType&&(t.shadows.shadowType=e.shadows.shadowType),e.shadows?.accumulativeShadows&&(t.shadows.accumulativeShadows=e.shadows.accumulativeShadows),e.shadows?.contactShadows&&(e.shadows.contactShadows.cameraHeight&&(t.shadows.contactShadows.cameraHeight=e.shadows.contactShadows.cameraHeight),e.shadows.contactShadows.intensity&&(t.shadows.contactShadows.intensity=e.shadows.contactShadows.intensity),e.shadows.contactShadows.planeLength&&(t.shadows.contactShadows.planeLength=e.shadows.contactShadows.planeLength),e.shadows.contactShadows.planeWidth&&(t.shadows.contactShadows.planeWidth=e.shadows.contactShadows.planeWidth),e.shadows.contactShadows.softness&&(t.shadows.contactShadows.softness=e.shadows.contactShadows.softness)),e.hotspots?.showNavigationButtons!==void 0&&(t.hotspots.showNavigationButtons=e.hotspots.showNavigationButtons)}}class i8 extends vM{constructor({nexusApiResultPayload:e,appWcRef:t}){super(),this.__needsRootPlug=!1,window.epigraph.logger.info({title:"nexusApiPayload",details:e}),this._appWcRef=t,this._data=e,this.__materialLibraryCollection=new t8(this._appWcRef),this._data.product_data.settings&&this._deepCopyProductSettings(this._data.product_data.settings);const i=this._data.product_data.assets;if(Object.values(i).length===1){const s=Object.values(i)[0];s?.proxyGeo?window.epigraph.logger.warn({title:"Single asset experience detected and a proxy was provided. Please ensure that the proxy provided has a root plug in it. Expand for the asset config used...",details:s,contextOverride:"ASSET COLLECTION"}):(s.proxyGeo="https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/staging-assets/pipeline-assets/3d-assets/proxies/null-proxy.glb",this.__needsRootPlug=!0,s.autoGenerateProxyEntity=!0)}}get materialLibraryCollection(){return this.__materialLibraryCollection}get settings(){return this._data.settings}get channelName(){return this._data.settings.channel.name}get channelSettings(){return this._data.settings.channel.channel_settings}async __parseMaterialLibraries(){this.__materialLibraryCollection.makeEmpty();const e=this._data?.brand?.material_libraries;if(e)for(const[t,i]of Object.entries(e))await this.__materialLibraryCollection.addMaterialLibrary(t,i.url)}async __parseAssets(){return this.__assetCollection=new XQ(this._data.product_data.assets,this._appWcRef),await this.__assetCollection.initialize(),this.__needsRootPlug&&this.__assetCollection.getFirstAsset()?.proxyGltf?.plugs.push(new Ra({name:"root@plug",isPrimary:!0,connectionId:"root",position:new se,rotation:new Rn})),this.__assetCollection}getAssetCollection(){return this.__assetCollection}__parseProductVariants(){this.__productVariantCollection=new ZQ(this._data.product_data.product.productVariants,this._data.product_data.product.id)}get productVariantCollection(){return this.__productVariantCollection}async initialize(){await this.__parseMaterialLibraries(),await this.__parseAssets(),await this.__parseProductVariants()}}var hh=function(){var o=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(m){m.preventDefault(),i(++o%e.children.length)},!1);function t(m){return e.appendChild(m.dom),m}function i(m){for(var _=0;_<e.children.length;_++)e.children[_].style.display=_===m?"block":"none";o=m}var s=(performance||Date).now(),l=s,u=0,d=t(new hh.Panel("FPS","#0ff","#002")),f=t(new hh.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var g=t(new hh.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:e,addPanel:t,showPanel:i,begin:function(){s=(performance||Date).now()},end:function(){u++;var m=(performance||Date).now();if(f.update(m-s,200),m>=l+1e3&&(d.update(u*1e3/(m-l),100),l=m,u=0,g)){var _=performance.memory;g.update(_.usedJSHeapSize/1048576,_.jsHeapSizeLimit/1048576)}return m},update:function(){s=this.end()},domElement:e,setMode:i}};hh.Panel=function(o,e,t){var i=1/0,s=0,l=Math.round,u=l(window.devicePixelRatio||1),d=80*u,f=48*u,g=3*u,m=2*u,_=3*u,y=15*u,v=74*u,E=30*u,T=document.createElement("canvas");T.width=d,T.height=f,T.style.cssText="width:80px;height:48px";var C=T.getContext("2d");return C.font="bold "+9*u+"px Helvetica,Arial,sans-serif",C.textBaseline="top",C.fillStyle=t,C.fillRect(0,0,d,f),C.fillStyle=e,C.fillText(o,g,m),C.fillRect(_,y,v,E),C.fillStyle=t,C.globalAlpha=.9,C.fillRect(_,y,v,E),{dom:T,update:function(x,P){i=Math.min(i,x),s=Math.max(s,x),C.fillStyle=t,C.globalAlpha=1,C.fillRect(0,0,d,y),C.fillStyle=e,C.fillText(l(x)+" "+o+" ("+l(i)+"-"+l(s)+")",g,m),C.drawImage(T,_+u,y,v-u,E,_,y,v-u,E),C.fillRect(_+v-u,y,u,E),C.fillStyle=t,C.globalAlpha=.9,C.fillRect(_+v-u,y,u,l((1-x/P)*E))}}};class ws extends Np{constructor(){super(),this._loggerContext="DEBUG MANAGER",this.stats=new hh}static{this.webComponentName="debug-manager"}static setupWebComponent(){window.customElements.get(ws.webComponentName)||window.customElements.define(ws.webComponentName,ws)}static{this.styles=ut`
|
|
8509
|
+
`}};zo([Ut("#modelViewer")],Da.prototype,"modelViewerElem");zo([Ut("#arModal")],Da.prototype,"arModalElem");zo([Ut("#qrModal")],Da.prototype,"qrModalElem");zo([ue({attribute:!1})],Da.prototype,"appWcRef");zo([ue({type:String,attribute:"glb-src"})],Da.prototype,"glbSrc");zo([ue({type:String,attribute:"usdz-src"})],Da.prototype,"usdzSrc");zo([ue({type:Boolean,attribute:"debug"})],Da.prototype,"debug");let WQ=Da;class wt{constructor(e,t,i=""){this.__name="app:generic:event",this.__eventsManager=e,this.__name=t,this.__detail=i}get name(){return this.__name}get detail(){return this.__detail}fire(e){const t=new CustomEvent(this.__name,{detail:e??this.__detail});this.__eventsManager.eventHubRef.dispatchEvent(t)}}class YQ extends EventTarget{constructor(e){super(),this._loggerContext="EVENTS MANAGER",window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext}),e?this.eventHubRef=e:this.eventHubRef=this,this.assetLoadProgress=new wt(this,"assetLoadProgress",""),this.experienceUpdatedEvent=new wt(this,"experienceUpdated",""),this.appReadyEvent=new wt(this,"appReady",""),this.appFailedEvent=new wt(this,"appFailed",""),this.productClassChangedEvent=new wt(this,"productClassChanged",""),this.productChangedEvent=new wt(this,"productChanged",""),this.variantChangedEvent=new wt(this,"variantChanged",""),this.structureNodeAddedEvent=new wt(this,"structureNodeAdded",""),this.structureNodeRemovedEvent=new wt(this,"structureNodeRemoved",""),this.structureChangedEvent=new wt(this,"structureChanged",""),this.showNodeLoadingIcon=new wt(this,"nodeLoadingShow",""),this.hideNodeLoadingIcon=new wt(this,"nodeLoadingHide",""),this.cameraFitEvent=new wt(this,"cameraFit",""),this.hotspotsUpdatedEvent=new wt(this,"hotspotsUpdated",""),this.hotspotsVisibilityChanged=new wt(this,"hotspotsVisibilityChanged",""),this.hotspotClickedEvent=new wt(this,"hotspotClicked",""),this.hotspotOpenEvent=new wt(this,"hotspotOpen",""),this.hotspotClosedEvent=new wt(this,"hotspotClosed",""),this.hotspotNextEvent=new wt(this,"hotspotNext",""),this.hotspotPreviousEvent=new wt(this,"hotspotPrevious",""),this.sceneBoundsChanged=new wt(this,"sceneBoundsChanged",""),this.dimensionsPositionChanged=new wt(this,"dimensionsPositionChanged",""),this.dimensionsValueChanged=new wt(this,"dimensionsValueChanged",""),this.dimensionsVisibilityChanged=new wt(this,"dimensionsVisibilityChanged",""),this.arModelReadyEvent=new wt(this,"arGlbReady",""),this.cartChangedEvent=new wt(this,"cartChanged",""),this.sceneRestartedEvent=new wt(this,"sceneRestarted",""),this.pickerFoundPosition=new wt(this,"pickerFoundPosition",""),this.frameUpdated=new wt(this,"frameUpdated",""),this.cameraControlsStart=new wt(this,"cameraControlsStart",""),this.inputStart=new wt(this,"inputStart",""),this.inputMove=new wt(this,"inputMove",""),this.inputEnd=new wt(this,"inputEnd",""),this.cameraMoveToTransform=new wt(this,"cameraMoveToTransform",""),this.debugChanged=new wt(this,"debugChanged","")}}class XQ{constructor(e,t){this.__assets=new Map,this.__appWcRef=t,this.__config=e}async initialize(){for(const e in this.__config){const t=new Z1(this.__config[e],this.__appWcRef);await t.load(),this.__assets.set(e,t)}}async loadAllProxies(){for(const e of this.__assets.values())await e.loadProxyGltf()}async loadAllRenderAssets(){for(const e of this.__assets.values())await e.loadRenderGltf(!0)}getAssetByName(e){return this.__assets.get(e)}getFirstAsset(){return this.__assets.values().next().value}}class KQ{constructor(e){this.__assetClass=e.assetClass,this.__asset=e.asset,this.__assetId=e.assetId,this.__finish=e.finish,this.__productOptionValue=e.productOptionValue}get assetClass(){return this.__assetClass}get asset(){return this.__asset}get assetId(){return this.__assetId}get finish(){return this.__finish}get productOptionValue(){return this.__productOptionValue}}class JQ{constructor(e,t){this.__productParts=[],this.__id=e.id,this.__name=e.name,this.__productId=t,this.__sku=e.sku,this.__upc=e.upc,this.__asin=e.asin,this.__shopifyVariantId=e.shopifyVariantId,this.__uuid=e.uuid,this.parseProductParts(e.productParts)}get id(){return this.__id}get name(){return this.__name}get productId(){return this.__productId}get sku(){return this.__sku}get upc(){return this.__upc}get asin(){return this.__asin}get shopifyVariantId(){return this.__shopifyVariantId}get uuid(){return this.__uuid}get productParts(){return this.__productParts}parseProductParts(e){for(const t of e){const i=new KQ(t);this.__productParts.push(i)}}}class ZQ{constructor(e,t){this.__productVariants=new Map,this.__productVariantNames=new Map,this.__productVariantSkus=new Map,this.__productVariantUpcs=new Map,this.__productVariantAsins=new Map,this.__productVariantShopifyVariantIds=new Map,this.__productVariantUuids=new Map,this.__productId=t;for(const i of e){const s=new JQ(i,this.__productId);s&&this.addProductVariant(s)}}addProductVariant(e){this.__productVariants.set(e.id,e),this.__productVariantNames.set(e.name,e),e.sku&&this.__productVariantSkus.set(e.sku,e),e.upc&&this.__productVariantUpcs.set(e.upc,e),e.asin&&this.__productVariantAsins.set(e.asin,e),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.set(e.shopifyVariantId,e),e.uuid&&this.__productVariantUuids.set(e.uuid,e)}removeProductVariant(e){e.sku&&this.__productVariantSkus.delete(e.sku),e.upc&&this.__productVariantUpcs.delete(e.upc),e.asin&&this.__productVariantAsins.delete(e.asin),e.shopifyVariantId&&this.__productVariantShopifyVariantIds.delete(e.shopifyVariantId),this.__productVariantNames.delete(e.name),this.__productVariants.delete(e.id)}getAllProductVariants(){return Array.from(this.__productVariants.values())}getAllProductVariantIds(){return Array.from(this.__productVariants.keys())}getAllProductVariantNames(){return Array.from(this.__productVariantNames.keys())}getProductVariantById(e){return this.__productVariants.get(e)}getProductVariantByName(e){return this.__productVariantNames.get(e)}getProductVariantBySku(e){return this.__productVariantSkus.get(e)}getProductVariantByUpc(e){return this.__productVariantUpcs.get(e)}getProductVariantByAsin(e){return this.__productVariantAsins.get(e)}getProductVariantByShopifyVariantId(e){return this.__productVariantShopifyVariantIds.get(e)}getProductVariantByUuid(e){return this.__productVariantUuids.get(e)}getProductVariantByIdentifierAndType(e,t){switch(t){case ro.SKU:return this.getProductVariantBySku(e);case ro.SHOPIFY_VARIANT_ID:return this.getProductVariantByShopifyVariantId(e);case ro.ASIN:return this.getProductVariantByAsin(e);case ro.UPC:return this.getProductVariantByUpc(e);case ro.EXPERIENCE_ID:return;case ro.PRODUCT_VARIANT_UUID:return this.getProductVariantByUuid(e);default:return}}}class e8 extends J1{constructor(e){super(e)}}class t8{constructor(e){this.__appWcRef=e,this.__materialLibraries=new Map}get materialLibraries(){return this.__materialLibraries}makeEmpty(){this.__materialLibraries.clear()}async addMaterialLibrary(e,t){const i=new e8({id:e,uri:t,preload:!1,appWcRef:this.__appWcRef});return this.__materialLibraries.set(i.id,i),i}}class vM{constructor(){this.productSettings={postEffect:{ao:!1},render:{envMap:"https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/env-maps/neutral.hdr"},camera:{initial:null,backgroundColor:"#ffffff",backgroundAlpha:1,focalLength:35,nearClip:.01,farClip:1e3,canPan:!0,canZoom:!0,minDistance:2,maxDistance:8,minPolarAngle:null,maxPolarAngle:null,minAzimuthAngle:null,maxAzimuthAngle:null},renderQuality:{antiAlias:!0},screenshots:{enabled:!1},shadows:{shadowType:rI.NONE,accumulativeShadows:{shadowMaterial:{opacity:.8,alphaTest:.75,color:"#000000",blend:1},shadowParams:{frames:30,scale:10,radius:.8,ambient:.5},light:{direction:{x:3,y:5,z:3}}},contactShadows:{planeLength:3,planeWidth:3,cameraHeight:1,intensity:1,softness:1}},hotspots:{showNavigationButtons:!0}}}_deepCopyProductSettings(e){const t=this.productSettings;e.render&&e.render.envMap&&(t.render.envMap=e.render.envMap),e.camera&&(e.camera.initial&&(t.camera.initial=e.camera.initial),e.camera.backgroundColor&&(t.camera.backgroundColor=e.camera.backgroundColor),e.camera.backgroundAlpha&&(t.camera.backgroundAlpha=e.camera.backgroundAlpha),e.camera.focalLength&&(t.camera.focalLength=e.camera.focalLength),e.camera.canPan!==void 0&&(t.camera.canPan=e.camera.canPan),e.camera.canZoom!==void 0&&(t.camera.canZoom=e.camera.canZoom),e.camera.minDistance&&(t.camera.minDistance=e.camera.minDistance),e.camera.maxDistance&&(t.camera.maxDistance=e.camera.maxDistance),e.camera.minPolarAngle&&(t.camera.minPolarAngle=e.camera.minPolarAngle),e.camera.maxPolarAngle&&(t.camera.maxPolarAngle=e.camera.maxPolarAngle),e.camera.minAzimuthAngle&&(t.camera.minAzimuthAngle=e.camera.minAzimuthAngle),e.camera.maxAzimuthAngle&&(t.camera.maxAzimuthAngle=e.camera.maxAzimuthAngle)),e.postEffect&&(t.postEffect=e.postEffect),e.renderQuality&&(t.renderQuality=e.renderQuality),e.screenshots&&(t.screenshots=e.screenshots),e.shadows?.shadowType&&(t.shadows.shadowType=e.shadows.shadowType),e.shadows?.accumulativeShadows&&(t.shadows.accumulativeShadows=e.shadows.accumulativeShadows),e.shadows?.contactShadows&&(e.shadows.contactShadows.cameraHeight&&(t.shadows.contactShadows.cameraHeight=e.shadows.contactShadows.cameraHeight),e.shadows.contactShadows.intensity&&(t.shadows.contactShadows.intensity=e.shadows.contactShadows.intensity),e.shadows.contactShadows.planeLength&&(t.shadows.contactShadows.planeLength=e.shadows.contactShadows.planeLength),e.shadows.contactShadows.planeWidth&&(t.shadows.contactShadows.planeWidth=e.shadows.contactShadows.planeWidth),e.shadows.contactShadows.softness&&(t.shadows.contactShadows.softness=e.shadows.contactShadows.softness)),e.hotspots?.showNavigationButtons!==void 0&&(t.hotspots.showNavigationButtons=e.hotspots.showNavigationButtons)}}class i8 extends vM{constructor({nexusApiResultPayload:e,appWcRef:t}){super(),this.__needsRootPlug=!1,window.epigraph.logger.info({title:"nexusApiPayload",details:e}),this._appWcRef=t,this._data=e,this.__materialLibraryCollection=new t8(this._appWcRef),this._data.product_data.settings&&this._deepCopyProductSettings(this._data.product_data.settings);const i=this._data.product_data.assets;if(Object.values(i).length===1){const s=Object.values(i)[0];s?.proxyGeo?window.epigraph.logger.warn({title:"Single asset experience detected and a proxy was provided. Please ensure that the proxy provided has a root plug in it. Expand for the asset config used...",details:s,contextOverride:"ASSET COLLECTION"}):(s.proxyGeo="https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/staging-assets/pipeline-assets/3d-assets/proxies/null-proxy.glb",this.__needsRootPlug=!0,s.autoGenerateProxyEntity=!0)}}get materialLibraryCollection(){return this.__materialLibraryCollection}get settings(){return this._data.settings}get channelName(){return this._data.settings.channel.name}get channelSettings(){return this._data.settings.channel.channel_settings}async __parseMaterialLibraries(){this.__materialLibraryCollection.makeEmpty();const e=this._data?.brand?.material_libraries;if(e)for(const[t,i]of Object.entries(e))await this.__materialLibraryCollection.addMaterialLibrary(t,i.url)}async __parseAssets(){return this.__assetCollection=new XQ(this._data.product_data.assets,this._appWcRef),await this.__assetCollection.initialize(),this.__needsRootPlug&&this.__assetCollection.getFirstAsset()?.proxyGltf?.plugs.push(new Ra({name:"root@plug",isPrimary:!0,connectionId:"root",position:new se,rotation:new Rn})),this.__assetCollection}getAssetCollection(){return this.__assetCollection}__parseProductVariants(){this.__productVariantCollection=new ZQ(this._data.product_data.product.productVariants,this._data.product_data.product.id)}get productVariantCollection(){return this.__productVariantCollection}async initialize(){await this.__parseMaterialLibraries(),await this.__parseAssets(),await this.__parseProductVariants()}}var hh=function(){var o=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(m){m.preventDefault(),i(++o%e.children.length)},!1);function t(m){return e.appendChild(m.dom),m}function i(m){for(var _=0;_<e.children.length;_++)e.children[_].style.display=_===m?"block":"none";o=m}var s=(performance||Date).now(),l=s,u=0,d=t(new hh.Panel("FPS","#0ff","#002")),f=t(new hh.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var g=t(new hh.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:e,addPanel:t,showPanel:i,begin:function(){s=(performance||Date).now()},end:function(){u++;var m=(performance||Date).now();if(f.update(m-s,200),m>=l+1e3&&(d.update(u*1e3/(m-l),100),l=m,u=0,g)){var _=performance.memory;g.update(_.usedJSHeapSize/1048576,_.jsHeapSizeLimit/1048576)}return m},update:function(){s=this.end()},domElement:e,setMode:i}};hh.Panel=function(o,e,t){var i=1/0,s=0,l=Math.round,u=l(window.devicePixelRatio||1),d=80*u,f=48*u,g=3*u,m=2*u,_=3*u,y=15*u,v=74*u,E=30*u,T=document.createElement("canvas");T.width=d,T.height=f,T.style.cssText="width:80px;height:48px";var C=T.getContext("2d");return C.font="bold "+9*u+"px Helvetica,Arial,sans-serif",C.textBaseline="top",C.fillStyle=t,C.fillRect(0,0,d,f),C.fillStyle=e,C.fillText(o,g,m),C.fillRect(_,y,v,E),C.fillStyle=t,C.globalAlpha=.9,C.fillRect(_,y,v,E),{dom:T,update:function(x,P){i=Math.min(i,x),s=Math.max(s,x),C.fillStyle=t,C.globalAlpha=1,C.fillRect(0,0,d,y),C.fillStyle=e,C.fillText(l(x)+" "+o+" ("+l(i)+"-"+l(s)+")",g,m),C.drawImage(T,_+u,y,v-u,E,_,y,v-u,E),C.fillRect(_+v-u,y,u,E),C.fillStyle=t,C.globalAlpha=.9,C.fillRect(_+v-u,y,u,l((1-x/P)*E))}}};class ws extends Np{constructor(){super(),this._loggerContext="DEBUG MANAGER",this.stats=new hh}static{this.webComponentName="debug-manager"}static setupWebComponent(){window.customElements.get(ws.webComponentName)||window.customElements.define(ws.webComponentName,ws)}static{this.styles=ut`
|
|
8510
8510
|
.debug-label {
|
|
8511
8511
|
position: absolute;
|
|
8512
8512
|
top: 0%;
|
|
@@ -9372,7 +9372,7 @@ void main() {
|
|
|
9372
9372
|
<div class="view-in-your-space-button ${this._hasActiveHotspot?"hide":""}">
|
|
9373
9373
|
<slot name=${n0.slotCustomViewInYourSpaceButton.name} @click=${this.launchAR}></slot>
|
|
9374
9374
|
</div>
|
|
9375
|
-
`}getAllHotspotsFromScene(){const e=[];return this.sceneManager.sceneStructure.traverse(t=>{if(t instanceof vo)for(const i of t.asset.hotspots)this.hotspotsManager.addHotspot(i,!1)}),e}_repopulateHotspots(){window.epigraph.logger.info({title:"Override to repopulate hotspots in scene on identifier changes"}),this.featuresToEnable.hotspots===!0&&this.hotspotsManager&&(this.hotspotsManager.removeAllHotspots(),this.getAllHotspotsFromScene(),this.updateHotspotsOrder(Array.from(this.hotspotsManager.hotspots.keys())))}_setupAnalytics(){this._isDevEnv||this._isStagingEnv||(this._nexusAnalyticsPlugin=new aR({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),sessionId:window.epigraph.epigraphSessionId,xPath:this.xPath,verboseLogging:this._isDevEnv,sendToStaging:this._isStagingEnv}),this._epigraphAnalytics.addEventPlugin(this._nexusAnalyticsPlugin),this.gaMeasurementId&&(this._ga4AnalyticsPlugin=new rR({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),verboseLogging:this._isDevEnv}),this._epigraphAnalytics.addEventPlugin(this._ga4AnalyticsPlugin)))}__onWebComponentResize(){if(!this.appCanvasContainerElemRef)return;const{width:e,height:t}=this.appCanvasContainerElemRef.getBoundingClientRect();if(!(e===0||t===0)){if(this.__canvasSize.width=e,this.__canvasSize.height=t,this.renderEngine.mainRenderer.setSize(e,t),this.renderEngine.textRenderer.setSize(e,t),this.renderEngine.effectsComposer.setSize(e,t),this.cameraManager){const i=this.renderEngine.canvas.clientWidth/this.renderEngine.canvas.clientHeight;this.cameraManager.getCameras().main.aspect=i,this.cameraManager.getCameras().main.updateProjectionMatrix(),this.cameraManager.getCameras().screenshot.aspect=i,this.cameraManager.getCameras().screenshot.updateProjectionMatrix()}this.dimensionsManager&&!this.hotspotsManager?.activeHotspot&&this.cameraManager.fitCameraToSceneBounds(!1),this.isPortraitOrientation=e<700,this.postRenderFrameUpdateInEngine(this.renderEngine.getClockDelta())}}__onDimensionsPositionChanged(){this.renderEngine.updateDimensionLines(this.dimensionsManager.getCurrentDimensionsIndicatorState())}showSplashScreen(){this.splashScreenElem?.show()}hideSplashScreen(){this.splashScreenElem?.hide()}_setupVisibilityObserver(){new IntersectionObserver(()=>{this.isAppReady&&(window.epigraph.logger.info({title:"Component became visible, re-calculating scene hierarchy.",contextOverride:this._loggerContext}),this._onSceneHierarchyUpdate(),this.productSettings.camera.initial&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!0}))}).observe(this)}_setupResizeObservers(){new ResizeObserver(t=>{for(const i of t){const{width:s,height:l}=i.target.getBoundingClientRect(),u=s*.5,d=l*.5;if(u>230)this._isToolsetLargerThanTheLeftBottomQuadrant=!1;else{const f=this.toolsetElem?.getBoundingClientRect();if(!f)continue;const g=f.width>u,m=f.height>d;this._isToolsetLargerThanTheLeftBottomQuadrant=g||m}}}).observe(this)}async _postExperienceDataInitialization(){if(!this._identifier||!this._identifierType)return Promise.resolve(!0);const e=this._experienceData.productVariantCollection.getProductVariantByIdentifierAndType(this._identifier,this._identifierType);return e?await this.spawnProductVariant(e):Promise.resolve(!1)}async spawnProductVariant(e){if(!e.productParts)return Promise.reject(!1);for(const t of e.productParts)await this.spawnProductPart(t);return Promise.resolve(!0)}async spawnProductPart(e){let t=this.sceneManager.sceneStructure.getEntityForAssetId(e.assetId);if(!t){const s=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!s||(await s.load(),t=await this.spawnAssetInScene(s),!t))return Promise.reject(!1)}const i=e.finish;return i?(await t.selectAssetFinish(i),Promise.resolve(!0)):Promise.resolve(!1)}async _fetchExperienceDataConfig(){return null}async _buildExperienceData(){const e=await this._fetchExperienceDataConfig();if(e===null)return await this._onAuthenticationFailed("Unable to retrieve experience data config."),Promise.reject();if(!e.success)return await this._onAuthenticationFailed(e.message),Promise.reject();this._experienceData=new i8({nexusApiResultPayload:e.payload,appWcRef:this}),await this._experienceData.initialize();const t=this._experienceData.channelSettings.ga_measurement_id;!this.gaMeasurementId&&t&&(window.epigraph.logger.info({title:"GA Measurement ID set from experience data",details:t,contextOverride:this._loggerContext}),this.gaMeasurementId=t,this._setupAnalytics())}__checkIfCurrentExperienceHasIdentifier(e,t){let i=!1;switch(e){case"sku":this.experienceData?.productVariantCollection?.getProductVariantBySku(t)&&(i=!0);break;case"shopify_variant_id":this.experienceData?.productVariantCollection?.getProductVariantByShopifyVariantId(t)&&(i=!0);break;case"upc":this.experienceData?.productVariantCollection?.getProductVariantByUpc(t)&&(i=!0);break;case"asin":this.experienceData?.productVariantCollection?.getProductVariantByAsin(t)&&(i=!0);break;case"experience_id":break;case"product_variant_uuid":this.experienceData?.productVariantCollection?.getProductVariantByUuid(t)&&(i=!0);break}return i}async _clearAndLoadNewExperienceInScene(){this._onNewExperienceLoadStart(),this.__checkIfCurrentExperienceHasIdentifier(this.identifierType,this.identifier)===!1&&await this._buildExperienceData().catch(e=>(window.epigraph.logger.error({title:`Couldn't build experience data for "${this.identifierType}" - "${this.identifier}"`,details:e,contextOverride:this._loggerContext}),Promise.reject(e))),await this._resetSession(),await this._postExperienceDataInitialization(),this.parsedUrlParams.get(Wu.AR)&&!this.didARAutoLaunch&&(await this.launchAR(),this.didARAutoLaunch=!0),this._onNewExperienceLoadFinish()}async _onIdentifierOrTypeChange(){this.isAppReady&&(await this._resolveIdentifierAndType(),!(!this._identifier||!this._identifierType)&&(window.epigraph.logger.info({title:"IDENTIFIER CHANGED",details:`${this._identifierType} = ${this._identifier}`}),this._nexusAnalyticsPlugin&&(this._nexusAnalyticsPlugin.experienceID=this._identifier),this._ga4AnalyticsPlugin&&(this._ga4AnalyticsPlugin.experienceID=this._identifier),await this._clearAndLoadNewExperienceInScene().catch(e=>(window.epigraph.logger.error({title:"Error while clearing the session and loading a new experience.",details:e}),Promise.reject(e)))))}showCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.add("show")}hideCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.remove("show")}_onPlayInteractionPromptChange(){this.playInteractionPrompt?this.__onPlayInteractionPrompt():(this.hideCameraInteractionPromptIndicator(),this._cameraManager?.mainCameraControls?.stop&&this._cameraManager?.mainCameraControls?.stop())}connectedCallback(){super.connectedCallback(),this._loadTimeBegin=performance.now(),this.parsedUrlParams=Et.parseUrlForEpigraphParams(this.baseUrlOverride),this._setupAnalytics()}firstUpdated(){this.modalView&&(this.hide=!0),this._setup().then(()=>{this.featuresToEnable.viewer===!0&&(this._setupResizeObservers(),this.hideSplashScreen()),window.epigraph.logger.info({title:"All Initializations Complete",contextOverride:this._loggerContext}),this.isAppReady=!0,this._onIdentifierOrTypeChange()}).catch(e=>{window.epigraph.logger.error({title:"Error while setup",details:e})})}updated(e){(e.has("sku")||e.has("shopify_variant_id")||e.has("upc")||e.has("asin")||e.has("experience_id")||e.has("product_variant_uuid")||e.has("customVersionId"))&&this._onIdentifierOrTypeChange(),e.has("playInteractionPrompt")&&this._onPlayInteractionPromptChange(),e.has("_isActiveHotspot")&&(this._hasActiveHotspot?this._hideCustomViewInYourSpaceButton():this._showCustomViewInYourSpaceButton()),e.has("debug")&&this.eventsManager.debugChanged.fire({value:this.debug}),e.has("modalView")&&(this.hide=this.modalView)}_getSlottedElements(e){if(!this.customViewInYourSpaceButtonSlotElem)return[];const t=e.assignedElements();return[...t.length>0?t:e.children]}disconnectedCallback(){super.disconnectedCallback()}showFullScreenModal(){this.hide=!1}hideFullScreenModal(){this.hide=!0}render(){return xe`
|
|
9375
|
+
`}getAllHotspotsFromScene(){const e=[];return this.sceneManager.sceneStructure.traverse(t=>{if(t instanceof vo)for(const i of t.asset.hotspots)this.hotspotsManager.addHotspot(i,!1)}),e}_repopulateHotspots(){window.epigraph.logger.info({title:"Override to repopulate hotspots in scene on identifier changes"}),this.featuresToEnable.hotspots===!0&&this.hotspotsManager&&(this.hotspotsManager.removeAllHotspots(),this.getAllHotspotsFromScene(),this.updateHotspotsOrder(Array.from(this.hotspotsManager.hotspots.keys())))}_setupAnalytics(){this._isDevEnv||this._isStagingEnv||(this._nexusAnalyticsPlugin=new aR({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),sessionId:window.epigraph.epigraphSessionId,xPath:this.xPath,verboseLogging:this._isDevEnv,sendToStaging:this._isStagingEnv}),this._epigraphAnalytics.addEventPlugin(this._nexusAnalyticsPlugin),this.gaMeasurementId&&(this._ga4AnalyticsPlugin=new rR({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),verboseLogging:this._isDevEnv}),this._epigraphAnalytics.addEventPlugin(this._ga4AnalyticsPlugin)))}__onWebComponentResize(){if(!this.appCanvasContainerElemRef)return;const{width:e,height:t}=this.appCanvasContainerElemRef.getBoundingClientRect();if(!(e===0||t===0)){if(this.__canvasSize.width=e,this.__canvasSize.height=t,this.renderEngine.mainRenderer.setSize(e,t),this.renderEngine.textRenderer.setSize(e,t),this.renderEngine.effectsComposer.setSize(e,t),this.cameraManager){const i=this.renderEngine.canvas.clientWidth/this.renderEngine.canvas.clientHeight;this.cameraManager.getCameras().main.aspect=i,this.cameraManager.getCameras().main.updateProjectionMatrix(),this.cameraManager.getCameras().screenshot.aspect=i,this.cameraManager.getCameras().screenshot.updateProjectionMatrix()}this.dimensionsManager&&!this.hotspotsManager?.activeHotspot&&this.cameraManager.fitCameraToSceneBounds(!1),this.isPortraitOrientation=e<700,this.postRenderFrameUpdateInEngine(this.renderEngine.getClockDelta())}}__onDimensionsPositionChanged(){this.renderEngine.updateDimensionLines(this.dimensionsManager.getCurrentDimensionsIndicatorState())}showSplashScreen(){this.splashScreenElem?.show()}hideSplashScreen(){this.splashScreenElem?.hide()}_setupVisibilityObserver(){new IntersectionObserver(()=>{this.isAppReady&&(window.epigraph.logger.info({title:"Component became visible, re-calculating scene hierarchy.",contextOverride:this._loggerContext}),this._onSceneHierarchyUpdate(),this.productSettings.camera.initial&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!0}))}).observe(this)}_setupResizeObservers(){new ResizeObserver(t=>{for(const i of t){const{width:s,height:l}=i.target.getBoundingClientRect(),u=s*.5,d=l*.5;if(u>230)this._isToolsetLargerThanTheLeftBottomQuadrant=!1;else{const f=this.toolsetElem?.getBoundingClientRect();if(!f)continue;const g=f.width>u,m=f.height>d;this._isToolsetLargerThanTheLeftBottomQuadrant=g||m}}}).observe(this)}async _postExperienceDataInitialization(){if(!this._identifier||!this._identifierType)return Promise.resolve(!0);this.renderEngine.updateEnvMap(this.productSettings.render.envMap);const e=this._experienceData.productVariantCollection.getProductVariantByIdentifierAndType(this._identifier,this._identifierType);return e?await this.spawnProductVariant(e):Promise.resolve(!1)}async spawnProductVariant(e){if(!e.productParts)return Promise.reject(!1);for(const t of e.productParts)await this.spawnProductPart(t);return Promise.resolve(!0)}async spawnProductPart(e){let t=this.sceneManager.sceneStructure.getEntityForAssetId(e.assetId);if(!t){const s=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!s||(await s.load(),t=await this.spawnAssetInScene(s),!t))return Promise.reject(!1)}const i=e.finish;return i?(await t.selectAssetFinish(i),Promise.resolve(!0)):Promise.resolve(!1)}async _fetchExperienceDataConfig(){return null}async _buildExperienceData(){const e=await this._fetchExperienceDataConfig();if(e===null)return await this._onAuthenticationFailed("Unable to retrieve experience data config."),Promise.reject();if(!e.success)return await this._onAuthenticationFailed(e.message),Promise.reject();this._experienceData=new i8({nexusApiResultPayload:e.payload,appWcRef:this}),await this._experienceData.initialize();const t=this._experienceData.channelSettings.ga_measurement_id;!this.gaMeasurementId&&t&&(window.epigraph.logger.info({title:"GA Measurement ID set from experience data",details:t,contextOverride:this._loggerContext}),this.gaMeasurementId=t,this._setupAnalytics())}__checkIfCurrentExperienceHasIdentifier(e,t){let i=!1;switch(e){case"sku":this.experienceData?.productVariantCollection?.getProductVariantBySku(t)&&(i=!0);break;case"shopify_variant_id":this.experienceData?.productVariantCollection?.getProductVariantByShopifyVariantId(t)&&(i=!0);break;case"upc":this.experienceData?.productVariantCollection?.getProductVariantByUpc(t)&&(i=!0);break;case"asin":this.experienceData?.productVariantCollection?.getProductVariantByAsin(t)&&(i=!0);break;case"experience_id":break;case"product_variant_uuid":this.experienceData?.productVariantCollection?.getProductVariantByUuid(t)&&(i=!0);break}return i}async _clearAndLoadNewExperienceInScene(){this._onNewExperienceLoadStart(),this.__checkIfCurrentExperienceHasIdentifier(this.identifierType,this.identifier)===!1&&await this._buildExperienceData().catch(e=>(window.epigraph.logger.error({title:`Couldn't build experience data for "${this.identifierType}" - "${this.identifier}"`,details:e,contextOverride:this._loggerContext}),Promise.reject(e))),await this._resetSession(),await this._postExperienceDataInitialization(),this.parsedUrlParams.get(Wu.AR)&&!this.didARAutoLaunch&&(await this.launchAR(),this.didARAutoLaunch=!0),this._onNewExperienceLoadFinish()}async _onIdentifierOrTypeChange(){this.isAppReady&&(await this._resolveIdentifierAndType(),!(!this._identifier||!this._identifierType)&&(window.epigraph.logger.info({title:"IDENTIFIER CHANGED",details:`${this._identifierType} = ${this._identifier}`}),this._nexusAnalyticsPlugin&&(this._nexusAnalyticsPlugin.experienceID=this._identifier),this._ga4AnalyticsPlugin&&(this._ga4AnalyticsPlugin.experienceID=this._identifier),await this._clearAndLoadNewExperienceInScene().catch(e=>(window.epigraph.logger.error({title:"Error while clearing the session and loading a new experience.",details:e}),Promise.reject(e)))))}showCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.add("show")}hideCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.remove("show")}_onPlayInteractionPromptChange(){this.playInteractionPrompt?this.__onPlayInteractionPrompt():(this.hideCameraInteractionPromptIndicator(),this._cameraManager?.mainCameraControls?.stop&&this._cameraManager?.mainCameraControls?.stop())}connectedCallback(){super.connectedCallback(),this._loadTimeBegin=performance.now(),this.parsedUrlParams=Et.parseUrlForEpigraphParams(this.baseUrlOverride),this._setupAnalytics()}firstUpdated(){this.modalView&&(this.hide=!0),this._setup().then(()=>{this.featuresToEnable.viewer===!0&&(this._setupResizeObservers(),this.hideSplashScreen()),window.epigraph.logger.info({title:"All Initializations Complete",contextOverride:this._loggerContext}),this.isAppReady=!0,this._onIdentifierOrTypeChange()}).catch(e=>{window.epigraph.logger.error({title:"Error while setup",details:e})})}updated(e){(e.has("sku")||e.has("shopify_variant_id")||e.has("upc")||e.has("asin")||e.has("experience_id")||e.has("product_variant_uuid")||e.has("customVersionId"))&&this._onIdentifierOrTypeChange(),e.has("playInteractionPrompt")&&this._onPlayInteractionPromptChange(),e.has("_isActiveHotspot")&&(this._hasActiveHotspot?this._hideCustomViewInYourSpaceButton():this._showCustomViewInYourSpaceButton()),e.has("debug")&&this.eventsManager.debugChanged.fire({value:this.debug}),e.has("modalView")&&(this.hide=this.modalView)}_getSlottedElements(e){if(!this.customViewInYourSpaceButtonSlotElem)return[];const t=e.assignedElements();return[...t.length>0?t:e.children]}disconnectedCallback(){super.disconnectedCallback()}showFullScreenModal(){this.hide=!1}hideFullScreenModal(){this.hide=!0}render(){return xe`
|
|
9376
9376
|
${Et.getCustomStylesTemplate()}
|
|
9377
9377
|
|
|
9378
9378
|
<epg-button-icon
|