@epigraph/solutions 1.11.2 → 1.11.3

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.
@@ -9620,7 +9620,7 @@ Arguments: [`+R+"]"}},a.fz.prototype={k(r){return"Unsupported operation: "+this.
9620
9620
  ${this.__renderBody()}
9621
9621
  </div>
9622
9622
  </epg-modal>
9623
- `}};pd([le({attribute:!1})],th.prototype,"report");pd([bi()],th.prototype,"__activeTab");pd([bi()],th.prototype,"__gpuSnapshot");pd([bi()],th.prototype,"__validationProgress");pd([kt("#validationsModal")],th.prototype,"__modalRef");let p6=th;var g6=Object.defineProperty,ut=(n,e,t,i)=>{for(var s=void 0,l=n.length-1,h;l>=0;l--)(h=n[l])&&(s=h(e,t,s)||s);return s&&g6(e,t,s),s},kl=(n=>(n.NONE="",n.SKU="sku",n.SHOPIFY_VARIANT_ID="shopify_variant_id",n.ASIN="asin",n.UPC="upc",n.PRODUCT_VARIANT_UUID="product_variant_uuid",n))(kl||{});const lt=class au extends qR{constructor(){let e=ou.PRODUCTION;super("1.11.2",e),this.isMac=/Mac/i.test(navigator.userAgent),this.epigraphWebsiteRedirectUrls={icon:"https://www.epigraph.us",modal:"https://www.epigraph.us"},this.sessionState="default",this.isAppReady=!1,this.sku=zt.sku.defaultValue.toString(),this.shopify_variant_id=zt.shopifyVariantId.defaultValue.toString(),this.upc=zt.upc.defaultValue.toString(),this.asin=zt.asin.defaultValue.toString(),this.product_variant_uuid=zt.productVariantUuid.defaultValue.toString(),this.customVersionId="",this.gaMeasurementId="",this.disableZoom=!1,this.modalView=!1,this.hide=!1,this.isLoading=!0,this.apiMode="production",this.debug=!1,this.showSettings=!1,this.dimensionsUnit=zt.dimensionsUnit.defaultValue.toString(),this.dimensionsUnitSymbol=zt.dimensionsUnitSymbol.defaultValue.toString(),this.areDimensionsActive=!1,this.areHotspotsActive=!1,this.variantSwitchMode=zt.variantSwitchMode.defaultValue.toString(),this.areCommentsActive=!1,this.isHelpVisible=!1,this.baseUrlOverride=zt.baseUrlOverride.defaultValue.toString(),this.cameraBoundsMultiplier=1,this.isPortraitOrientation=!1,this.didARAutoLaunch=!1,this.transparentBackground=!1,this.splashScreenLogo=zt.splashScreenLogo.defaultValue.toString(),this.splashScreenText=zt.splashScreenText.defaultValue.toString(),this.hideUi=!1,this.playInteractionPrompt=!1,this.featuresToEnable={viewer:!0,hotspots:!0,dimensions:!0,viewInYourSpace:!0,sceneManager:!0,comments:!1,debugManager:!1,validationsManager:!1},this._hasActiveHotspot=!1,this._isToolsetLargerThanTheLeftBottomQuadrant=!1,this._loadingProgress=0,this._loadTimeBegin=performance.now(),this._loggerContext="EPIGRAPH THREED CODE",this._epigraphAnalytics=new n2(null,null),this._identifier="",this._identifierType="",this._isDevEnv=!1,this._isStagingEnv=!1,this._productSettings=new V8,this._boundingSphereCenter=new ee,this._loaders=new wu,this._activeAnimations=new Map,this._animationFadeDurationInMiliseconds=1e3,this._isSceneInteractedWith=!1,this.__isLoadingForTheFirstTime=!0,this.__glbBlobUrl="",this.__usdzBlobUrl="",this.__hasSceneChanged=!1,this.__canvasSize={width:0,height:0},this.__raycaster=new Gv,this.__pointer=new Re,this.__viewStateGrid=new H1(40,190,0,12829635),this.__interactionPlayCount=0}static{this.webComponentName="epigraph-threed-core"}static setupWebComponent(){window.customElements.get(au.webComponentName)||window.customElements.define(au.webComponentName,au)}static{this.styles=[gt`
9623
+ `}};pd([le({attribute:!1})],th.prototype,"report");pd([bi()],th.prototype,"__activeTab");pd([bi()],th.prototype,"__gpuSnapshot");pd([bi()],th.prototype,"__validationProgress");pd([kt("#validationsModal")],th.prototype,"__modalRef");let p6=th;var g6=Object.defineProperty,ut=(n,e,t,i)=>{for(var s=void 0,l=n.length-1,h;l>=0;l--)(h=n[l])&&(s=h(e,t,s)||s);return s&&g6(e,t,s),s},kl=(n=>(n.NONE="",n.SKU="sku",n.SHOPIFY_VARIANT_ID="shopify_variant_id",n.ASIN="asin",n.UPC="upc",n.PRODUCT_VARIANT_UUID="product_variant_uuid",n))(kl||{});const lt=class au extends qR{constructor(){let e=ou.PRODUCTION;super("1.11.3",e),this.isMac=/Mac/i.test(navigator.userAgent),this.epigraphWebsiteRedirectUrls={icon:"https://www.epigraph.us",modal:"https://www.epigraph.us"},this.sessionState="default",this.isAppReady=!1,this.sku=zt.sku.defaultValue.toString(),this.shopify_variant_id=zt.shopifyVariantId.defaultValue.toString(),this.upc=zt.upc.defaultValue.toString(),this.asin=zt.asin.defaultValue.toString(),this.product_variant_uuid=zt.productVariantUuid.defaultValue.toString(),this.customVersionId="",this.gaMeasurementId="",this.disableZoom=!1,this.modalView=!1,this.hide=!1,this.isLoading=!0,this.apiMode="production",this.debug=!1,this.showSettings=!1,this.dimensionsUnit=zt.dimensionsUnit.defaultValue.toString(),this.dimensionsUnitSymbol=zt.dimensionsUnitSymbol.defaultValue.toString(),this.areDimensionsActive=!1,this.areHotspotsActive=!1,this.variantSwitchMode=zt.variantSwitchMode.defaultValue.toString(),this.areCommentsActive=!1,this.isHelpVisible=!1,this.baseUrlOverride=zt.baseUrlOverride.defaultValue.toString(),this.cameraBoundsMultiplier=1,this.isPortraitOrientation=!1,this.didARAutoLaunch=!1,this.transparentBackground=!1,this.splashScreenLogo=zt.splashScreenLogo.defaultValue.toString(),this.splashScreenText=zt.splashScreenText.defaultValue.toString(),this.hideUi=!1,this.playInteractionPrompt=!1,this.featuresToEnable={viewer:!0,hotspots:!0,dimensions:!0,viewInYourSpace:!0,sceneManager:!0,comments:!1,debugManager:!1,validationsManager:!1},this._hasActiveHotspot=!1,this._isToolsetLargerThanTheLeftBottomQuadrant=!1,this._loadingProgress=0,this._loadTimeBegin=performance.now(),this._loggerContext="EPIGRAPH THREED CODE",this._epigraphAnalytics=new n2(null,null),this._identifier="",this._identifierType="",this._isDevEnv=!1,this._isStagingEnv=!1,this._productSettings=new V8,this._boundingSphereCenter=new ee,this._loaders=new wu,this._activeAnimations=new Map,this._animationFadeDurationInMiliseconds=1e3,this._isSceneInteractedWith=!1,this.__isLoadingForTheFirstTime=!0,this.__glbBlobUrl="",this.__usdzBlobUrl="",this.__hasSceneChanged=!1,this.__canvasSize={width:0,height:0},this.__raycaster=new Gv,this.__pointer=new Re,this.__viewStateGrid=new H1(40,190,0,12829635),this.__interactionPlayCount=0}static{this.webComponentName="epigraph-threed-core"}static setupWebComponent(){window.customElements.get(au.webComponentName)||window.customElements.define(au.webComponentName,au)}static{this.styles=[gt`
9624
9624
  :host {
9625
9625
  all: initial;
9626
9626
  display: flex;
@@ -10592,7 +10592,7 @@ Arguments: [`+R+"]"}},a.fz.prototype={k(r){return"Unsupported operation: "+this.
10592
10592
  <div class="view-in-your-space-button ${this._shouldHideToolset()?"hide":""}">
10593
10593
  <slot name=${ap.slotCustomViewInYourSpaceButton.name} @click=${this.launchAR}></slot>
10594
10594
  </div>
10595
- `}getAllHotspotsFromScene(){const e=[];return this.sceneManager.sceneStructure.traverse(t=>{if(t instanceof Co)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",contextOverride:this._loggerContext}),this.featuresToEnable.hotspots===!0&&this.hotspotsManager&&(this.hotspotsManager.removeAllHotspots(),this.getAllHotspotsFromScene(),this.updateHotspotsOrder(Array.from(this.hotspotsManager.hotspots.keys())))}__setupNexusAnalyticsPlugin(){const e=this._experienceData?.data?.product_data?.product?.id;e&&(this._nexusSolutionsAnalyticsPlugin||(this._nexusSolutionsAnalyticsPlugin=new JR({productId:e,identifier:this._identifier,identifierType:this._identifierType,experienceType:this._experienceData.data.session_details.type_check,renderMode:this.productSettings.render.mode,sessionId:window.epigraph.epigraphSessionId,xPath:this.xPath,solution:this.getWebComponentName(),verboseLogging:this._isDevEnv,baseUrl:Vt.resolveNexusEndpoint(this.apiMode)}),this._epigraphAnalytics.addEventPlugin(this._nexusSolutionsAnalyticsPlugin)),this._nexusSolutionsAnalyticsPlugin.setProductId(e),this._nexusSolutionsAnalyticsPlugin.setExperienceType(this._experienceData.data.session_details.type_check),this._nexusSolutionsAnalyticsPlugin.setRenderMode(this.productSettings.render.mode),this._nexusSolutionsAnalyticsPlugin.setIdentifier(this._identifier),this._nexusSolutionsAnalyticsPlugin.setIdentifierType(this._identifierType))}__setupGa4AnalyticsPlugin(){this.gaMeasurementId&&(this._ga4AnalyticsPlugin||(this._ga4AnalyticsPlugin=new KR({trackingID:this.gaMeasurementId,experienceID:this._identifier,solution:this.getWebComponentName(),verboseLogging:this._isDevEnv}),this._epigraphAnalytics.addEventPlugin(this._ga4AnalyticsPlugin)),this._ga4AnalyticsPlugin.setTrackingID(this.gaMeasurementId),this._ga4AnalyticsPlugin.setExperienceID(this._identifier),this._ga4AnalyticsPlugin.setSolution(this.getWebComponentName()))}_setupAnalyticsPlugins(){this._isDevEnv||this._isStagingEnv||(this.__setupNexusAnalyticsPlugin(),this.__setupGa4AnalyticsPlugin())}__onWebComponentResize(){if(!this.appCanvasContainerElemRef)return;const{width:e,height:t}=this.appCanvasContainerElemRef.getBoundingClientRect();if(e===0||t===0)return;this.__canvasSize.width=e,this.__canvasSize.height=t;const i=this.cameraManager?.getCameras()?.main;i&&(i.aspect=this.aspectRatio,i.updateProjectionMatrix()),this.dimensionsManager&&!this.hotspotsManager?.activeHotspot&&this.cameraManager.fitCameraToSceneBounds(!1),this.renderEngine.mainRenderer.setSize(e,t),this.renderEngine.effectsComposer.setSize(e,t),this.isPortraitOrientation=e<700;const s=e*.5,l=t*.5;if(s>230)this._isToolsetLargerThanTheLeftBottomQuadrant=!1;else{const h=this.toolsetElem?.getBoundingClientRect();if(h){const u=h.width>s,f=h.height>l;this._isToolsetLargerThanTheLeftBottomQuadrant=u||f}}this.postRenderFrameUpdateInEngine(this.renderEngine.getClockDelta()),this.eventsManager.webComponentResized.fire()}__onDimensionsPositionChanged(){this.renderEngine.updateDimensionLines(this.dimensionsManager.getCurrentDimensionsIndicatorState())}showSplashScreen(){this.splashScreenElem?.show()}hideSplashScreen(){this.splashScreenElem?.hide()}showTransitionScreen(){this.transitionScreenElem.classList.add("show")}hideTransitionScreen(){this.transitionScreenElem.classList.remove("show")}get isLoadingForTheFirstTime(){return this.__isLoadingForTheFirstTime}async _postExperienceDataInitialization(){const e=this._experienceData.productVariantCollection.getProductVariantByIdentifierAndType(this._identifier,this._identifierType);if(!e)return Promise.reject(!1);const{envMap:t,envMapRotation:i}=this.productSettings.render;await this.renderEngine.updateEnvMap(t,i);const s=await this.spawnProductVariant(e);return requestAnimationFrame(()=>this._cameraManager.updateCameraSettings(this.productSettings.camera)),s}async spawnProductVariant(e){if(!e.productParts)return Promise.reject(!1);const t=[];for(const i of e.productParts){const s=this._experienceData.getAssetCollection().getAssetByName(i.asset);s&&t.push(s)}await this.loadAllPartAssetSynchronously(t).catch(i=>(window.epigraph.logger.error({title:"Error loading one or more product part assets.",details:i,contextOverride:this._loggerContext}),Promise.reject(i)));for(const i of e.productParts)await this.__spawnProductPart(i).catch(s=>(window.epigraph.logger.error({title:`Error spawning product part "${i.asset}" (finish: ${i.finish}).`,details:s,contextOverride:this._loggerContext}),Promise.reject(s)));return Promise.resolve(!0)}async loadAllPartAssetSynchronously(e){const t=[];for(const i of e)t.push(i.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 s=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!s)return window.epigraph.logger.error({title:`Asset "${e.asset}" not found in asset collection.`,contextOverride:this._loggerContext}),Promise.reject(!1);if(t=await this.spawnAssetInScene(s).catch(l=>(window.epigraph.logger.error({title:`Error while spawning asset "${e.asset}" in scene.`,details:l,contextOverride:this._loggerContext}),Promise.reject(!1))),!t)return window.epigraph.logger.error({title:`Failed to spawn asset "${e.asset}" in scene. No valid connections found for this asset.`,contextOverride:this._loggerContext}),Promise.reject(!1)}const i=e.finish;return i?(await t.selectAssetFinish(i),Promise.resolve(!0)):Promise.resolve(!1)}__showViewStateGrid(){this.renderEngine.scene.add(this.__viewStateGrid)}__hideViewStateGrid(){this.renderEngine.scene.remove(this.__viewStateGrid)}__getIntersectionsWithScene(e,t){const i=this.renderEngine.mainRenderer.domElement.getBoundingClientRect();return this.__pointer.x=(e-i.left)/i.width*2-1,this.__pointer.y=-((t-i.top)/i.height)*2+1,this.__raycaster.setFromCamera(this.__pointer,this.cameraManager.getCameras().main),this.__raycaster.intersectObjects(this.renderEngine.sceneHierarchy.sceneStructure.rootEntity.children,!0)}async __onPlayInteractionPrompt(e=2){if(!(e<=0)){this.__interactionPlayCount++,this.showCameraInteractionPromptIndicator(),await Vt.wait(800),this.cameraInteractionPromptIndicatorElemRef.style.animationIterationCount=String(e);for(let t=0;t<e;t++)this.cameraInteractionPromptIndicatorElemRef.classList.add("play-wiggle-animation"),await this.cameraManager.wiggleCamera();this.cameraInteractionPromptIndicatorElemRef.classList.remove("play-wiggle-animation"),this.hideCameraInteractionPromptIndicator(),this.shouldContinuePlayingInteractionPrompt()&&setTimeout(()=>{this.__onPlayInteractionPrompt(this.getInteractionPromptRepeat()[0])},3e3)}}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 Q8({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)}__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"product_variant_uuid":this.experienceData?.productVariantCollection?.getProductVariantByUuid(t)&&(i=!0);break}return i}_guessesWhyTheExperienceFailed(){const e=[];return this._experienceData.getAssetCollection().hasAnyAssetWithSplat()&&!this.isSplatSession&&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();const e=this.__checkIfCurrentExperienceHasIdentifier(this.identifierType,this.identifier);e===!1&&await this._buildExperienceData().catch(t=>(window.epigraph.logger.error({title:`Couldn't build experience data for "${this.identifierType}" - "${this.identifier}"`,details:t,contextOverride:this._loggerContext}),Promise.reject(t))),this._setupAnalyticsPlugins(),this._sendAnalyticsEventsOnModuleLoadStart(),await this._resetSession(),await this._postExperienceDataInitialization().catch(t=>Promise.reject(t)),this.parsedUrlParams.get(lu.AR)&&!this.didARAutoLaunch&&(await this.launchAR(),this.didARAutoLaunch=!0),await this._onNewExperienceLoadFinish(e)}async _onIdentifierOrTypeChange(){if(this.isAppReady){if(await this._resolveIdentifierAndType(),!this._identifier||!this._identifierType)return Promise.reject("No valid Identifier Provided! Please provide on of the following: sku, shopify-variant-id, upc, asin, product-variant-uuid");window.epigraph.logger.info({title:"IDENTIFIER CHANGED",details:`${this._identifierType} = ${this._identifier}`,contextOverride:this._loggerContext}),await this._clearAndLoadNewExperienceInScene().catch(e=>(window.epigraph.logger.error({title:"Error while clearing the session and loading a new experience.",details:e,contextOverride:this._loggerContext}),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=Vt.parseUrlForEpigraphParams(this.baseUrlOverride)}firstUpdated(){this.modalView&&(this.hide=!0),this._setup().then(()=>{window.epigraph.logger.info({title:"All Initializations Complete",contextOverride:this._loggerContext}),this.isAppReady=!0,this._onIdentifierOrTypeChange().catch(e=>{this.onLoadFailed(hu.EXPERIENCE_CONFIG_ERROR,e)})}).catch(e=>{window.epigraph.logger.error({title:"Error while setup",details:e,contextOverride:this._loggerContext}),this.onLoadFailed(hu.INITIAL_SCENE_LOAD_ERROR,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("gaMeasurementId")&&this.isAppReady&&this._setupAnalyticsPlugins(),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?.dispose(),super.disconnectedCallback()}showFullScreenModal(){this.hide=!1}hideFullScreenModal(){this.hide=!0}render(){return de`
10595
+ `}getAllHotspotsFromScene(){const e=[];return this.sceneManager.sceneStructure.traverse(t=>{if(t instanceof Co)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",contextOverride:this._loggerContext}),this.featuresToEnable.hotspots===!0&&this.hotspotsManager&&(this.hotspotsManager.removeAllHotspots(),this.getAllHotspotsFromScene(),this.updateHotspotsOrder(Array.from(this.hotspotsManager.hotspots.keys())))}__setupNexusAnalyticsPlugin(){const e=this._experienceData?.data?.product_data?.product?.id;e&&(this._nexusSolutionsAnalyticsPlugin||(this._nexusSolutionsAnalyticsPlugin=new JR({productId:e,identifier:this._identifier,identifierType:this._identifierType,experienceType:this._experienceData.data.session_details.type_check,renderMode:this.productSettings.render.mode,sessionId:window.epigraph.epigraphSessionId,xPath:this.xPath,solution:this.getWebComponentName(),verboseLogging:this._isDevEnv,baseUrl:Vt.resolveNexusEndpoint(this.apiMode)}),this._epigraphAnalytics.addEventPlugin(this._nexusSolutionsAnalyticsPlugin)),this._nexusSolutionsAnalyticsPlugin.setProductId(e),this._nexusSolutionsAnalyticsPlugin.setExperienceType(this._experienceData.data.session_details.type_check),this._nexusSolutionsAnalyticsPlugin.setRenderMode(this.productSettings.render.mode),this._nexusSolutionsAnalyticsPlugin.setIdentifier(this._identifier),this._nexusSolutionsAnalyticsPlugin.setIdentifierType(this._identifierType))}__setupGa4AnalyticsPlugin(){this.gaMeasurementId&&(this._ga4AnalyticsPlugin||(this._ga4AnalyticsPlugin=new KR({trackingID:this.gaMeasurementId,experienceID:this._identifier,solution:this.getWebComponentName(),verboseLogging:this._isDevEnv}),this._epigraphAnalytics.addEventPlugin(this._ga4AnalyticsPlugin)),this._ga4AnalyticsPlugin.setTrackingID(this.gaMeasurementId),this._ga4AnalyticsPlugin.setExperienceID(this._identifier),this._ga4AnalyticsPlugin.setSolution(this.getWebComponentName()))}_setupAnalyticsPlugins(){this._isDevEnv||this._isStagingEnv||(this.__setupNexusAnalyticsPlugin(),this.__setupGa4AnalyticsPlugin())}__onWebComponentResize(){if(!this.appCanvasContainerElemRef)return;const{width:e,height:t}=this.appCanvasContainerElemRef.getBoundingClientRect();if(e===0||t===0)return;this.__canvasSize.width=e,this.__canvasSize.height=t;const i=this.cameraManager?.getCameras()?.main;if(i){i.aspect=this.aspectRatio,i.updateProjectionMatrix();const h=this.productSettings?.camera?.focalLength;h&&i.setFocalLength(h)}this.dimensionsManager&&!this.hotspotsManager?.activeHotspot&&this.cameraManager.fitCameraToSceneBounds(!1),this.renderEngine.mainRenderer.setSize(e,t),this.renderEngine.effectsComposer.setSize(e,t),this.isPortraitOrientation=e<700;const s=e*.5,l=t*.5;if(s>230)this._isToolsetLargerThanTheLeftBottomQuadrant=!1;else{const h=this.toolsetElem?.getBoundingClientRect();if(h){const u=h.width>s,f=h.height>l;this._isToolsetLargerThanTheLeftBottomQuadrant=u||f}}this.postRenderFrameUpdateInEngine(this.renderEngine.getClockDelta()),this.eventsManager.webComponentResized.fire()}__onDimensionsPositionChanged(){this.renderEngine.updateDimensionLines(this.dimensionsManager.getCurrentDimensionsIndicatorState())}showSplashScreen(){this.splashScreenElem?.show()}hideSplashScreen(){this.splashScreenElem?.hide()}showTransitionScreen(){this.transitionScreenElem.classList.add("show")}hideTransitionScreen(){this.transitionScreenElem.classList.remove("show")}get isLoadingForTheFirstTime(){return this.__isLoadingForTheFirstTime}async _postExperienceDataInitialization(){const e=this._experienceData.productVariantCollection.getProductVariantByIdentifierAndType(this._identifier,this._identifierType);if(!e)return Promise.reject(!1);const{envMap:t,envMapRotation:i}=this.productSettings.render;await this.renderEngine.updateEnvMap(t,i);const s=await this.spawnProductVariant(e);return requestAnimationFrame(()=>this._cameraManager.updateCameraSettings(this.productSettings.camera)),s}async spawnProductVariant(e){if(!e.productParts)return Promise.reject(!1);const t=[];for(const i of e.productParts){const s=this._experienceData.getAssetCollection().getAssetByName(i.asset);s&&t.push(s)}await this.loadAllPartAssetSynchronously(t).catch(i=>(window.epigraph.logger.error({title:"Error loading one or more product part assets.",details:i,contextOverride:this._loggerContext}),Promise.reject(i)));for(const i of e.productParts)await this.__spawnProductPart(i).catch(s=>(window.epigraph.logger.error({title:`Error spawning product part "${i.asset}" (finish: ${i.finish}).`,details:s,contextOverride:this._loggerContext}),Promise.reject(s)));return Promise.resolve(!0)}async loadAllPartAssetSynchronously(e){const t=[];for(const i of e)t.push(i.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 s=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!s)return window.epigraph.logger.error({title:`Asset "${e.asset}" not found in asset collection.`,contextOverride:this._loggerContext}),Promise.reject(!1);if(t=await this.spawnAssetInScene(s).catch(l=>(window.epigraph.logger.error({title:`Error while spawning asset "${e.asset}" in scene.`,details:l,contextOverride:this._loggerContext}),Promise.reject(!1))),!t)return window.epigraph.logger.error({title:`Failed to spawn asset "${e.asset}" in scene. No valid connections found for this asset.`,contextOverride:this._loggerContext}),Promise.reject(!1)}const i=e.finish;return i?(await t.selectAssetFinish(i),Promise.resolve(!0)):Promise.resolve(!1)}__showViewStateGrid(){this.renderEngine.scene.add(this.__viewStateGrid)}__hideViewStateGrid(){this.renderEngine.scene.remove(this.__viewStateGrid)}__getIntersectionsWithScene(e,t){const i=this.renderEngine.mainRenderer.domElement.getBoundingClientRect();return this.__pointer.x=(e-i.left)/i.width*2-1,this.__pointer.y=-((t-i.top)/i.height)*2+1,this.__raycaster.setFromCamera(this.__pointer,this.cameraManager.getCameras().main),this.__raycaster.intersectObjects(this.renderEngine.sceneHierarchy.sceneStructure.rootEntity.children,!0)}async __onPlayInteractionPrompt(e=2){if(!(e<=0)){this.__interactionPlayCount++,this.showCameraInteractionPromptIndicator(),await Vt.wait(800),this.cameraInteractionPromptIndicatorElemRef.style.animationIterationCount=String(e);for(let t=0;t<e;t++)this.cameraInteractionPromptIndicatorElemRef.classList.add("play-wiggle-animation"),await this.cameraManager.wiggleCamera();this.cameraInteractionPromptIndicatorElemRef.classList.remove("play-wiggle-animation"),this.hideCameraInteractionPromptIndicator(),this.shouldContinuePlayingInteractionPrompt()&&setTimeout(()=>{this.__onPlayInteractionPrompt(this.getInteractionPromptRepeat()[0])},3e3)}}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 Q8({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)}__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"product_variant_uuid":this.experienceData?.productVariantCollection?.getProductVariantByUuid(t)&&(i=!0);break}return i}_guessesWhyTheExperienceFailed(){const e=[];return this._experienceData.getAssetCollection().hasAnyAssetWithSplat()&&!this.isSplatSession&&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();const e=this.__checkIfCurrentExperienceHasIdentifier(this.identifierType,this.identifier);e===!1&&await this._buildExperienceData().catch(t=>(window.epigraph.logger.error({title:`Couldn't build experience data for "${this.identifierType}" - "${this.identifier}"`,details:t,contextOverride:this._loggerContext}),Promise.reject(t))),this._setupAnalyticsPlugins(),this._sendAnalyticsEventsOnModuleLoadStart(),await this._resetSession(),await this._postExperienceDataInitialization().catch(t=>Promise.reject(t)),this.parsedUrlParams.get(lu.AR)&&!this.didARAutoLaunch&&(await this.launchAR(),this.didARAutoLaunch=!0),await this._onNewExperienceLoadFinish(e)}async _onIdentifierOrTypeChange(){if(this.isAppReady){if(await this._resolveIdentifierAndType(),!this._identifier||!this._identifierType)return Promise.reject("No valid Identifier Provided! Please provide on of the following: sku, shopify-variant-id, upc, asin, product-variant-uuid");window.epigraph.logger.info({title:"IDENTIFIER CHANGED",details:`${this._identifierType} = ${this._identifier}`,contextOverride:this._loggerContext}),await this._clearAndLoadNewExperienceInScene().catch(e=>(window.epigraph.logger.error({title:"Error while clearing the session and loading a new experience.",details:e,contextOverride:this._loggerContext}),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=Vt.parseUrlForEpigraphParams(this.baseUrlOverride)}firstUpdated(){this.modalView&&(this.hide=!0),this._setup().then(()=>{window.epigraph.logger.info({title:"All Initializations Complete",contextOverride:this._loggerContext}),this.isAppReady=!0,this._onIdentifierOrTypeChange().catch(e=>{this.onLoadFailed(hu.EXPERIENCE_CONFIG_ERROR,e)})}).catch(e=>{window.epigraph.logger.error({title:"Error while setup",details:e,contextOverride:this._loggerContext}),this.onLoadFailed(hu.INITIAL_SCENE_LOAD_ERROR,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("gaMeasurementId")&&this.isAppReady&&this._setupAnalyticsPlugins(),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?.dispose(),super.disconnectedCallback()}showFullScreenModal(){this.hide=!1}hideFullScreenModal(){this.hide=!0}render(){return de`
10596
10596
  ${Vt.getCustomStylesTemplate()}
10597
10597
 
10598
10598
  <epg-button-icon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/solutions",
3
- "version": "1.11.2",
3
+ "version": "1.11.3",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-solutions.js",
6
6
  "files": [