@epigraph/solutions 1.1.5 → 1.1.6

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.
@@ -18183,7 +18183,7 @@ void main() {
18183
18183
  </epg-toolset>
18184
18184
  `}_renderPoweredByEpigraphButton(){return this._experienceData?.channelSettings?.powered_by_epigraph?ae`
18185
18185
  <epg-tool-powered-by-epigraph
18186
- class="powered-by-epigraph-button ${this._hasActiveHotspot?"hide":""}"
18186
+ class="powered-by-epigraph-button ${this._shouldHideToolset()?"hide":""}"
18187
18187
  url-to-open=${this.epigraphWebsiteRedirectUrls.icon}
18188
18188
  size="medium"
18189
18189
  ></epg-tool-powered-by-epigraph>
@@ -18230,7 +18230,7 @@ void main() {
18230
18230
  <div class="transition-screen" id="transitionScreen">
18231
18231
  <epg-loader-circle class="epg-loader-circle" loader-size="35px"></epg-loader-circle>
18232
18232
  </div>
18233
- `}async _resetSession(){this._autoGeneratedProxyMesh?.scale.set(1,1,1),this._autoGeneratedProxyMesh?.position.set(0,0,0),this._autoGeneratedProxyMesh?.updateMatrixWorld(),await this.renderEngine.emptyScene()}__onHotspotChange(e){this._hasActiveHotspot=!1;let t;e.detail.oldHotspotId?t=this.hotspotsManager.hotspots.get(e.detail.oldHotspotId):t=this.hotspotsManager.hotspots.get(e.detail.hotspotId);const n=t?.animation,i=t?.assetId;if(!n||!i)return;const r=n.loop,a=n.exit;r&&this.stopAnimationByNameAndAssetId(r,i);let o;a?o=this.playAnimationByNameAndAssetId({animationName:a,assetId:i}):o=this.playAnimationByNameAndAssetId({animationName:n.entry,assetId:i,reverse:!0}),setTimeout(()=>{o?.targetAnimationAction.reset(),this._activeAnimations.delete(o?.animationName??"")},this._animationFadeDurationInMiliseconds)}_setupEventListeners(){window.epigraph.logger.info({title:"Setting up event listeners for this app."}),this.addEventListener(this.eventsManager.sceneBoundsChanged.name,()=>{this.variantSwitchMode==="default"&&this.cameraManager.fitCameraToSceneBounds()}),this.addEventListener(this.eventsManager.structureNodeAddedEvent.name,()=>{this._onSceneHierarchyUpdate()}),this.addEventListener(this.eventsManager.experienceUpdatedEvent.name,()=>{this.renderEngine.accumulativeShadows&&!this.renderEngine.accumulativeShadows.camera&&(this.renderEngine.accumulativeShadows.camera=this.cameraManager.getCameras().main),this.renderEngine.accumulativeShadows?.reset(),this.renderEngine.contactShadows&&this.renderEngine.contactShadows.updateSettings(this.productSettings.shadows.contactShadows),this.cameraManager.updateCameraSettings(this.productSettings.camera),(this.__isNewExperienceData||this.variantSwitchMode==="default")&&this.productSettings.camera.initial&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!0}).then(()=>{this.productSettings.camera.initial?.skipCameraFit||this.cameraManager.fitCameraToSceneBounds()})}),this.addEventListener(this.eventsManager.dimensionsPositionChanged.name,this.__onDimensionsPositionChanged),this.addEventListener(this.eventsManager.cameraControlsStart.name,(e=>{switch(e.detail.type){case"rotate":(this.sessionState==="default"||this.sessionState==="view")&&(this.style.cursor="grabbing");break;case"pan":(this.sessionState==="default"||this.sessionState==="view")&&(this.style.cursor="move"),this.showCameraAim();break}this.hotspotsManager&&this.hotspotsManager.activeHotspot&&this.sessionState==="default"&&this.hotspotsManager.closeActiveHotspot()})),this.addEventListener(this.eventsManager.inputEnd.name,()=>{(this.sessionState==="default"||this.sessionState==="view")&&(this.style.cursor="grab"),this.hideCameraAim()}),this.addEventListener(this.eventsManager.hotspotOpenEvent.name,()=>{this.hideDimensions(!0)}),this.addEventListener(this.eventsManager.assetLoadProgress.name,(e=>{this._loadingProgress=e.detail.progress})),this.addEventListener(this.eventsManager.hotspotOpenEvent.name,(e=>{this._hasActiveHotspot=!0,this._resolveAnimationsOnHotspotEntry(e.detail.hotspot)})),this.addEventListener(this.eventsManager.hotspotNextEvent.name,(e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot)})),this.addEventListener(this.eventsManager.hotspotPreviousEvent.name,(e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot)})),this.addEventListener(this.eventsManager.hotspotClosedEvent.name,this.__onHotspotChange.bind(this)),this.addEventListener(this.eventsManager.hotspotNextEvent.name,this.__onHotspotChange.bind(this)),this.addEventListener(this.eventsManager.hotspotPreviousEvent.name,this.__onHotspotChange.bind(this)),this.appCanvasContainerElemRef.onpointerdown=e=>{this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hideHelp(),this.eventsManager.inputStart.fire({event:e})},this.appCanvasContainerElemRef.onpointermove=e=>{this.eventsManager.inputMove.fire({event:e})},this.appCanvasContainerElemRef.onpointerup=e=>{this.eventsManager.inputEnd.fire({event:e})},this.appCanvasContainerElemRef.onpointerout=e=>{this.eventsManager.inputEnd.fire({event:e})},this.cameraManager.mainCameraControls.addEventListener("update",this._onCameraPositionUpdate.bind(this)),this.hotspotsManager?.addEventListener("pointerdown",()=>{this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hideHelp()})}_onCameraPositionUpdate(){this.hotspotsManager?.enabled&&this.hotspotsManager.recalculateHotspotPositions()}_setupAutoGeneratedProxyContainers(){const e=new ws,t=new Un({color:65280,opacity:.5,transparent:!0});this._autoGeneratedProxyMesh=new Ye(e,t)}get productSettings(){return this._productSettings}async _setup(){window.epigraph.logger.table({title:"Setting up..."}),this._eventsManager=new FW(this),this._sceneManager=new kV(this),this._sceneManager.initialize(),this._cameraManager=new Hf({appWcRef:this}),this._cameraManager.initialize();const e=this._sceneManager.sceneStructure.setupRootEntity().catch(t=>{this.onLoadFailed(T0.SCENE_LOAD_ERROR,t)});await this.setupRenderEngine(),await e,await this._cameraManager.setup({mainRenderer:this.renderEngine.mainRenderer,screenshotRenderer:this.renderEngine.screenshotRenderer,cameraSettings:this.productSettings.camera}),this._setupAutoGeneratedProxyContainers(),this._setupEventListeners()}_resolveAnimationsOnHotspotEntry(e){this.stopAllAnimations();const t=e.animation,n=e.assetId;if(!t||!n)return;this._activeAnimations.get(t.entry)||this.playAnimationByNameAndAssetId({animationName:t.entry,assetId:n,clampWhenFinished:!0}),setTimeout(()=>{this._activeAnimations.delete(t.entry),this._activeAnimations.get(t.loop)?.loop||this.playAnimationByNameAndAssetId({animationName:t.loop,assetId:n,loop:!0})},this._animationFadeDurationInMiliseconds)}_renderDimensionsManager(){let e=me;return this.featuresToEnable.dimensions&&(x5.setupWebComponent(),e=ae`
18233
+ `}async _resetSession(){this._autoGeneratedProxyMesh?.scale.set(1,1,1),this._autoGeneratedProxyMesh?.position.set(0,0,0),this._autoGeneratedProxyMesh?.updateMatrixWorld(),await this.renderEngine.emptyScene()}__onHotspotChange(e){let t;e.detail.oldHotspotId?t=this.hotspotsManager.hotspots.get(e.detail.oldHotspotId):t=this.hotspotsManager.hotspots.get(e.detail.hotspotId),this._hasActiveHotspot=this.hotspotsManager.activeHotspot!==void 0;const n=t?.animation,i=t?.assetId;if(!n||!i)return;const r=n.loop,a=n.exit;r&&this.stopAnimationByNameAndAssetId(r,i);let o;a?o=this.playAnimationByNameAndAssetId({animationName:a,assetId:i}):o=this.playAnimationByNameAndAssetId({animationName:n.entry,assetId:i,reverse:!0}),setTimeout(()=>{o?.targetAnimationAction.reset(),this._activeAnimations.delete(o?.animationName??"")},this._animationFadeDurationInMiliseconds)}_setupEventListeners(){window.epigraph.logger.info({title:"Setting up event listeners for this app."}),this.addEventListener(this.eventsManager.sceneBoundsChanged.name,()=>{this.variantSwitchMode==="default"&&this.cameraManager.fitCameraToSceneBounds()}),this.addEventListener(this.eventsManager.structureNodeAddedEvent.name,()=>{this._onSceneHierarchyUpdate()}),this.addEventListener(this.eventsManager.experienceUpdatedEvent.name,()=>{this.renderEngine.accumulativeShadows&&!this.renderEngine.accumulativeShadows.camera&&(this.renderEngine.accumulativeShadows.camera=this.cameraManager.getCameras().main),this.renderEngine.accumulativeShadows?.reset(),this.renderEngine.contactShadows&&this.renderEngine.contactShadows.updateSettings(this.productSettings.shadows.contactShadows),this.cameraManager.updateCameraSettings(this.productSettings.camera),(this.__isNewExperienceData||this.variantSwitchMode==="default")&&this.productSettings.camera.initial&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!0}).then(()=>{this.productSettings.camera.initial?.skipCameraFit||this.cameraManager.fitCameraToSceneBounds()})}),this.addEventListener(this.eventsManager.dimensionsPositionChanged.name,this.__onDimensionsPositionChanged),this.addEventListener(this.eventsManager.cameraControlsStart.name,(e=>{switch(e.detail.type){case"rotate":(this.sessionState==="default"||this.sessionState==="view")&&(this.style.cursor="grabbing");break;case"pan":(this.sessionState==="default"||this.sessionState==="view")&&(this.style.cursor="move"),this.showCameraAim();break}this.hotspotsManager&&this.hotspotsManager.activeHotspot&&this.sessionState==="default"&&this.hotspotsManager.closeActiveHotspot()})),this.addEventListener(this.eventsManager.inputEnd.name,()=>{(this.sessionState==="default"||this.sessionState==="view")&&(this.style.cursor="grab"),this.hideCameraAim()}),this.addEventListener(this.eventsManager.assetLoadProgress.name,(e=>{this._loadingProgress=e.detail.progress})),this.addEventListener(this.eventsManager.hotspotOpenEvent.name,(e=>{this._hasActiveHotspot=!0,this.hideDimensions(!0),this._resolveAnimationsOnHotspotEntry(e.detail.hotspot)})),this.addEventListener(this.eventsManager.hotspotNextEvent.name,(e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot)})),this.addEventListener(this.eventsManager.hotspotPreviousEvent.name,(e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot)})),this.addEventListener(this.eventsManager.hotspotClosedEvent.name,this.__onHotspotChange.bind(this)),this.addEventListener(this.eventsManager.hotspotNextEvent.name,this.__onHotspotChange.bind(this)),this.addEventListener(this.eventsManager.hotspotPreviousEvent.name,this.__onHotspotChange.bind(this)),this.appCanvasContainerElemRef.onpointerdown=e=>{this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hideHelp(),this.eventsManager.inputStart.fire({event:e})},this.appCanvasContainerElemRef.onpointermove=e=>{this.eventsManager.inputMove.fire({event:e})},this.appCanvasContainerElemRef.onpointerup=e=>{this.eventsManager.inputEnd.fire({event:e})},this.appCanvasContainerElemRef.onpointerout=e=>{this.eventsManager.inputEnd.fire({event:e})},this.cameraManager.mainCameraControls.addEventListener("update",this._onCameraPositionUpdate.bind(this)),this.hotspotsManager?.addEventListener("pointerdown",()=>{this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hideHelp()})}_onCameraPositionUpdate(){this.hotspotsManager?.enabled&&this.hotspotsManager.recalculateHotspotPositions()}_setupAutoGeneratedProxyContainers(){const e=new ws,t=new Un({color:65280,opacity:.5,transparent:!0});this._autoGeneratedProxyMesh=new Ye(e,t)}get productSettings(){return this._productSettings}async _setup(){window.epigraph.logger.table({title:"Setting up..."}),this._eventsManager=new FW(this),this._sceneManager=new kV(this),this._sceneManager.initialize(),this._cameraManager=new Hf({appWcRef:this}),this._cameraManager.initialize();const e=this._sceneManager.sceneStructure.setupRootEntity().catch(t=>{this.onLoadFailed(T0.SCENE_LOAD_ERROR,t)});await this.setupRenderEngine(),await e,await this._cameraManager.setup({mainRenderer:this.renderEngine.mainRenderer,screenshotRenderer:this.renderEngine.screenshotRenderer,cameraSettings:this.productSettings.camera}),this._setupAutoGeneratedProxyContainers(),this._setupEventListeners()}_resolveAnimationsOnHotspotEntry(e){this.stopAllAnimations();const t=e.animation,n=e.assetId;if(!t||!n)return;this._activeAnimations.get(t.entry)||this.playAnimationByNameAndAssetId({animationName:t.entry,assetId:n,clampWhenFinished:!0}),setTimeout(()=>{this._activeAnimations.delete(t.entry),this._activeAnimations.get(t.loop)?.loop||this.playAnimationByNameAndAssetId({animationName:t.loop,assetId:n,loop:!0})},this._animationFadeDurationInMiliseconds)}_renderDimensionsManager(){let e=me;return this.featuresToEnable.dimensions&&(x5.setupWebComponent(),e=ae`
18234
18234
  <dimensions-manager
18235
18235
  id="dimensionsManager"
18236
18236
  .appWcRef=${this}
@@ -18267,10 +18267,10 @@ void main() {
18267
18267
  ?debug=${this.debug}
18268
18268
  ></view-in-your-space-manager>
18269
18269
  `),e}_renderViewInYourSpaceButtonSlot(){return ae`
18270
- <div class="view-in-your-space-button ${this._hasActiveHotspot?"hide":""}">
18270
+ <div class="view-in-your-space-button ${this._shouldHideToolset()?"hide":""}">
18271
18271
  <slot name=${of.slotCustomViewInYourSpaceButton.name} @click=${this.launchAR}></slot>
18272
18272
  </div>
18273
- `}getAllHotspotsFromScene(){const e=[];return this.sceneManager.sceneStructure.traverse(t=>{if(t instanceof pl)for(const n of t.asset.hotspots)this.hotspotsManager.addHotspot(n,!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 hD({trackingID:this.gaMeasurementId,experienceID:"",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 cD({trackingID:this.gaMeasurementId,experienceID:"",solution:this.getWebComponentName(),verboseLogging:this._isDevEnv}),this._epigraphAnalytics.addEventPlugin(this._ga4AnalyticsPlugin)))}__onWebComponentResize(){if(!this.appCanvasContainerElemRef)return;const{width:e,height:t}=this.appCanvasContainerElemRef.getBoundingClientRect();e===0||t===0||(this.__canvasSize.width=e,this.__canvasSize.height=t,this.cameraManager&&(this.cameraManager.getCameras().main.aspect=this.aspectRatio,this.cameraManager.getCameras().main.updateProjectionMatrix(),this.cameraManager.getCameras().screenshot.aspect=this.aspectRatio,this.cameraManager.getCameras().screenshot.updateProjectionMatrix()),this.dimensionsManager&&!this.hotspotsManager?.activeHotspot&&this.cameraManager.fitCameraToSceneBounds(!1),this.renderEngine.mainRenderer.setSize(e,t),this.renderEngine.textRenderer.setSize(e,t),this.renderEngine.effectsComposer.setSize(e,t),this.isPortraitOrientation=e<700,this.postRenderFrameUpdateInEngine(this.renderEngine.getClockDelta()),this.eventsManager.webComponentResized.fire())}__onDimensionsPositionChanged(){this.renderEngine.updateDimensionLines(this.dimensionsManager.getCurrentDimensionsIndicatorState())}showSplashScreen(){this.splashScreenElem?.show()}hideSplashScreen(){this.splashScreenElem?.hide()}get isNewExperienceData(){return this.__isNewExperienceData}_setupVisibilityObserver(){new IntersectionObserver(()=>{this.isAppReady&&(window.epigraph.logger.info({title:"Component became visible, re-calculating scene hierarchy.",contextOverride:this._loggerContext}),this._onSceneHierarchyUpdate(),(this.__isNewExperienceData||this.variantSwitchMode==="default")&&this.productSettings.camera.initial&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!1}).then(()=>{this.productSettings.camera.initial?.skipCameraFit||this.cameraManager.fitCameraToSceneBounds()}))}).observe(this)}_setupResizeObservers(){new ResizeObserver(t=>{for(const n of t){const{width:i,height:r}=n.target.getBoundingClientRect(),a=i*.5,o=r*.5;if(a>230)this._isToolsetLargerThanTheLeftBottomQuadrant=!1;else{const l=this.toolsetElem?.getBoundingClientRect();if(!l)continue;const c=l.width>a,h=l.height>o;this._isToolsetLargerThanTheLeftBottomQuadrant=c||h}}}).observe(this)}async _postExperienceDataInitialization(){if(!this._identifier||!this._identifierType)return Promise.resolve(!0);if(this.productSettings.render.mode===ga.SPLAT&&this._renderEngine.sparkRenderer){const{preBlurAmount:i,blurAmount:r}=this.productSettings.render.splatMode;this._renderEngine.sparkRenderer.preBlurAmount=i,this._renderEngine.sparkRenderer.blurAmount=r}const e=this._experienceData.productVariantCollection.getProductVariantByIdentifierAndType(this._identifier,this._identifierType);if(!e)return Promise.reject(!1);const{envMap:t,envMapRotation:n}=this.productSettings.render;return await this.renderEngine.updateEnvMap(t,n),await this.spawnProductVariant(e)}async spawnProductVariant(e){if(!e.productParts)return Promise.reject(!1);const t=[];for(const n of e.productParts){const i=this._experienceData.getAssetCollection().getAssetByName(n.asset);i&&t.push(i)}await this.loadAllPartAssetSynchronously(t);for(const n of e.productParts)await this.spawnProductPart(n);return Promise.resolve(!0)}async loadAllPartAssetSynchronously(e){const t=[];for(const n of e)t.push(n.load());return Promise.all(t)}async spawnProductPart(e){if(!e.assetClass||!e.assetId)return Promise.resolve(!0);let t=this.sceneManager.sceneStructure.getEntityForAssetId(e.assetId);if(!t){const i=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!i||(t=await this.spawnAssetInScene(i),!t))return Promise.reject(!1)}const n=e.finish;return n?(await t.selectAssetFinish(n),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 VW({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 n=!1;switch(e){case"sku":this.experienceData?.productVariantCollection?.getProductVariantBySku(t)&&(n=!0);break;case"shopify_variant_id":this.experienceData?.productVariantCollection?.getProductVariantByShopifyVariantId(t)&&(n=!0);break;case"upc":this.experienceData?.productVariantCollection?.getProductVariantByUpc(t)&&(n=!0);break;case"asin":this.experienceData?.productVariantCollection?.getProductVariantByAsin(t)&&(n=!0);break;case"product_variant_uuid":this.experienceData?.productVariantCollection?.getProductVariantByUuid(t)&&(n=!0);break}return n}__guessesWhyTheExperienceFailed(){const e=[];return this._experienceData.getAssetCollection().hasAnyAssetWithSplat()&&this.productSettings.render.mode!==ga.SPLAT&&e.push("Render Splat provided in one of the assets. Try switching the render mode to Splat in Render Settings."),e}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().catch(e=>Promise.reject(e)),this.parsedUrlParams.get(id.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}),window.epigraph.logger.warn({title:"BEST GUESSES FOR FAILURE BELOW:",details:this.__guessesWhyTheExperienceFailed(),contextOverride:this._loggerContext}),Promise.reject(e)))))}showCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.add("show")}hideCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.remove("show")}_onPlayInteractionPromptChange(){this.playInteractionPrompt?this.__onPlayInteractionPrompt(this.getInteractionPromptRepeat()[0]):(this.hideCameraInteractionPromptIndicator(),this._cameraManager?.mainCameraControls?.stop&&this._cameraManager?.mainCameraControls?.stop())}connectedCallback(){super.connectedCallback(),this._loadTimeBegin=performance.now(),this.parsedUrlParams=ft.parseUrlForEpigraphParams(this.baseUrlOverride),this._setupAnalytics()}firstUpdated(){this.modalView&&(this.hide=!0),this._setup().then(()=>{this.featuresToEnable.viewer===!0&&this._setupResizeObservers(),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("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("showSettings")&&this.eventsManager.showSettingsChanged.fire({value:this.showSettings}),e.has("modalView")&&(this.hide=this.modalView),e.has("cameraBoundsMultiplier")&&this.cameraManager.fitCameraToSceneBounds()}_getSlottedElements(e){if(!this.customViewInYourSpaceButtonSlotElem)return[];const t=e.assignedElements();return[...t.length>0?t:e.children]}disconnectedCallback(){this._renderEngine?.destroy(),super.disconnectedCallback()}showFullScreenModal(){this.hide=!1}hideFullScreenModal(){this.hide=!0}render(){return ae`
18273
+ `}getAllHotspotsFromScene(){const e=[];return this.sceneManager.sceneStructure.traverse(t=>{if(t instanceof pl)for(const n of t.asset.hotspots)this.hotspotsManager.addHotspot(n,!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 hD({trackingID:this.gaMeasurementId,experienceID:"",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 cD({trackingID:this.gaMeasurementId,experienceID:"",solution:this.getWebComponentName(),verboseLogging:this._isDevEnv}),this._epigraphAnalytics.addEventPlugin(this._ga4AnalyticsPlugin)))}__onWebComponentResize(){if(!this.appCanvasContainerElemRef)return;const{width:e,height:t}=this.appCanvasContainerElemRef.getBoundingClientRect();e===0||t===0||(this.__canvasSize.width=e,this.__canvasSize.height=t,this.cameraManager&&(this.cameraManager.getCameras().main.aspect=this.aspectRatio,this.cameraManager.getCameras().main.updateProjectionMatrix(),this.cameraManager.getCameras().screenshot.aspect=this.aspectRatio,this.cameraManager.getCameras().screenshot.updateProjectionMatrix()),this.dimensionsManager&&!this.hotspotsManager?.activeHotspot&&this.cameraManager.fitCameraToSceneBounds(!1),this.renderEngine.mainRenderer.setSize(e,t),this.renderEngine.textRenderer.setSize(e,t),this.renderEngine.effectsComposer.setSize(e,t),this.isPortraitOrientation=e<700,this.postRenderFrameUpdateInEngine(this.renderEngine.getClockDelta()),this.eventsManager.webComponentResized.fire())}__onDimensionsPositionChanged(){this.renderEngine.updateDimensionLines(this.dimensionsManager.getCurrentDimensionsIndicatorState())}showSplashScreen(){this.splashScreenElem?.show()}hideSplashScreen(){this.splashScreenElem?.hide()}get isNewExperienceData(){return this.__isNewExperienceData}_setupVisibilityObserver(){new IntersectionObserver(()=>{this.isAppReady&&(window.epigraph.logger.info({title:"Component became visible, re-calculating scene hierarchy.",contextOverride:this._loggerContext}),this._onSceneHierarchyUpdate(),(this.__isNewExperienceData||this.variantSwitchMode==="default")&&this.productSettings.camera.initial&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!1}).then(()=>{this.productSettings.camera.initial?.skipCameraFit||this.cameraManager.fitCameraToSceneBounds()}))}).observe(this)}_setupResizeObservers(){new ResizeObserver(t=>{for(const n of t){const{width:i,height:r}=n.target.getBoundingClientRect(),a=i*.5,o=r*.5;if(a>230)this._isToolsetLargerThanTheLeftBottomQuadrant=!1;else{const l=this.toolsetElem?.getBoundingClientRect();if(!l)continue;const c=l.width>a,h=l.height>o;this._isToolsetLargerThanTheLeftBottomQuadrant=c||h}}}).observe(this)}async _postExperienceDataInitialization(){if(!this._identifier||!this._identifierType)return Promise.resolve(!0);if(this.productSettings.render.mode===ga.SPLAT&&this._renderEngine.sparkRenderer){const{preBlurAmount:i,blurAmount:r}=this.productSettings.render.splatMode;this._renderEngine.sparkRenderer.preBlurAmount=i,this._renderEngine.sparkRenderer.blurAmount=r}const e=this._experienceData.productVariantCollection.getProductVariantByIdentifierAndType(this._identifier,this._identifierType);if(!e)return Promise.reject(!1);const{envMap:t,envMapRotation:n}=this.productSettings.render;return await this.renderEngine.updateEnvMap(t,n),await this.spawnProductVariant(e)}async spawnProductVariant(e){if(!e.productParts)return Promise.reject(!1);const t=[];for(const n of e.productParts){const i=this._experienceData.getAssetCollection().getAssetByName(n.asset);i&&t.push(i)}await this.loadAllPartAssetSynchronously(t);for(const n of e.productParts)await this.spawnProductPart(n);return Promise.resolve(!0)}async loadAllPartAssetSynchronously(e){const t=[];for(const n of e)t.push(n.load());return Promise.all(t)}async spawnProductPart(e){if(!e.assetClass||!e.assetId)return Promise.resolve(!0);let t=this.sceneManager.sceneStructure.getEntityForAssetId(e.assetId);if(!t){const i=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!i||(t=await this.spawnAssetInScene(i),!t))return Promise.reject(!1)}const n=e.finish;return n?(await t.selectAssetFinish(n),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 VW({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 n=!1;switch(e){case"sku":this.experienceData?.productVariantCollection?.getProductVariantBySku(t)&&(n=!0);break;case"shopify_variant_id":this.experienceData?.productVariantCollection?.getProductVariantByShopifyVariantId(t)&&(n=!0);break;case"upc":this.experienceData?.productVariantCollection?.getProductVariantByUpc(t)&&(n=!0);break;case"asin":this.experienceData?.productVariantCollection?.getProductVariantByAsin(t)&&(n=!0);break;case"product_variant_uuid":this.experienceData?.productVariantCollection?.getProductVariantByUuid(t)&&(n=!0);break}return n}__guessesWhyTheExperienceFailed(){const e=[];return this._experienceData.getAssetCollection().hasAnyAssetWithSplat()&&this.productSettings.render.mode!==ga.SPLAT&&e.push("Render Splat provided in one of the assets. Try switching the render mode to Splat in Render Settings."),e}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().catch(e=>Promise.reject(e)),this.parsedUrlParams.get(id.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}),window.epigraph.logger.warn({title:"BEST GUESSES FOR FAILURE BELOW:",details:this.__guessesWhyTheExperienceFailed(),contextOverride:this._loggerContext}),Promise.reject(e)))))}showCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.add("show")}hideCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.remove("show")}_onPlayInteractionPromptChange(){this.playInteractionPrompt?this.__onPlayInteractionPrompt(this.getInteractionPromptRepeat()[0]):(this.hideCameraInteractionPromptIndicator(),this._cameraManager?.mainCameraControls?.stop&&this._cameraManager?.mainCameraControls?.stop())}connectedCallback(){super.connectedCallback(),this._loadTimeBegin=performance.now(),this.parsedUrlParams=ft.parseUrlForEpigraphParams(this.baseUrlOverride),this._setupAnalytics()}firstUpdated(){this.modalView&&(this.hide=!0),this._setup().then(()=>{this.featuresToEnable.viewer===!0&&this._setupResizeObservers(),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("product_variant_uuid")||e.has("customVersionId"))&&this._onIdentifierOrTypeChange(),e.has("playInteractionPrompt")&&this._onPlayInteractionPromptChange(),e.has("_hasActiveHotspot")&&(this._hasActiveHotspot?this._hideCustomViewInYourSpaceButton():this._showCustomViewInYourSpaceButton()),e.has("debug")&&this.eventsManager.debugChanged.fire({value:this.debug}),e.has("showSettings")&&this.eventsManager.showSettingsChanged.fire({value:this.showSettings}),e.has("modalView")&&(this.hide=this.modalView),e.has("cameraBoundsMultiplier")&&this.cameraManager.fitCameraToSceneBounds()}_getSlottedElements(e){if(!this.customViewInYourSpaceButtonSlotElem)return[];const t=e.assignedElements();return[...t.length>0?t:e.children]}disconnectedCallback(){this._renderEngine?.destroy(),super.disconnectedCallback()}showFullScreenModal(){this.hide=!1}hideFullScreenModal(){this.hide=!0}render(){return ae`
18274
18274
  ${ft.getCustomStylesTemplate()}
18275
18275
 
18276
18276
  <epg-button-icon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/solutions",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-solutions.js",
6
6
  "files": [