@epigraph/solutions 1.0.1-alpha → 1.0.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8525,6 +8525,10 @@ void main() {
8525
8525
  left: 0;
8526
8526
  right: 0;
8527
8527
  bottom: 0;
8528
+
8529
+ * {
8530
+ user-select: none;
8531
+ }
8528
8532
  }
8529
8533
 
8530
8534
  .toolset {
@@ -8731,7 +8735,7 @@ void main() {
8731
8735
  <div class="view-in-your-space-button ${this._hasActiveHotspot?"hide":""}">
8732
8736
  <slot name=${c0.slotCustomViewInYourSpaceButton.name} @click=${this.launchAR}></slot>
8733
8737
  </div>
8734
- `}getAllHotspotsFromScene(){const e=[];return this.sceneManager.sceneStructure.traverse(t=>{if(t instanceof Va)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._nexusAnalyticsPlugin=new EM({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),sessionId:window.epigraph.epigraphSessionId,xPath:this.xPath,verboseLogging:!1,sendToStaging:!1}),this._epigraphAnalytics.addEventPlugin(this._nexusAnalyticsPlugin),this.gaMeasurementId&&(this._ga4AnalyticsPlugin=new wM({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),verboseLogging:!1}),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:a,height:l}=i.target.getBoundingClientRect(),h=a*.5,d=l*.5;if(h>230)this._isToolsetLargerThanTheLeftBottomQuadrant=!1;else{const p=this.toolsetElem?.getBoundingClientRect();if(!p)continue;const m=p.width>h,A=p.height>d;this._isToolsetLargerThanTheLeftBottomQuadrant=m||A}}}).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 a=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!a||(await a.load(),t=await this.spawnAssetInScene(a),!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 BH({nexusApiResultPayload:e.payload,appWcRef:this}),await this._experienceData.initialize()}async _clearAndLoadNewExperienceInScene(){this._onNewExperienceLoadStart(),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(lh.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){const t=e.assignedElements();return[...t.length>0?t:e.children]}disconnectedCallback(){super.disconnectedCallback()}showFullScreenModal(){this.hide=!1}hideFullScreenModal(){this.hide=!0}render(){return Ee`
8738
+ `}getAllHotspotsFromScene(){const e=[];return this.sceneManager.sceneStructure.traverse(t=>{if(t instanceof Va)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._nexusAnalyticsPlugin=new EM({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),sessionId:window.epigraph.epigraphSessionId,xPath:this.xPath,verboseLogging:!1,sendToStaging:!1}),this._epigraphAnalytics.addEventPlugin(this._nexusAnalyticsPlugin),this.gaMeasurementId&&(this._ga4AnalyticsPlugin=new wM({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),verboseLogging:!1}),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:a,height:l}=i.target.getBoundingClientRect(),h=a*.5,d=l*.5;if(h>230)this._isToolsetLargerThanTheLeftBottomQuadrant=!1;else{const p=this.toolsetElem?.getBoundingClientRect();if(!p)continue;const m=p.width>h,A=p.height>d;this._isToolsetLargerThanTheLeftBottomQuadrant=m||A}}}).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 a=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!a||(await a.load(),t=await this.spawnAssetInScene(a),!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 BH({nexusApiResultPayload:e.payload,appWcRef:this}),await this._experienceData.initialize()}__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(lh.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){const t=e.assignedElements();return[...t.length>0?t:e.children]}disconnectedCallback(){super.disconnectedCallback()}showFullScreenModal(){this.hide=!1}hideFullScreenModal(){this.hide=!0}render(){return Ee`
8735
8739
  ${Et.getCustomStylesTemplate()}
8736
8740
 
8737
8741
  <epg-button-icon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/solutions",
3
- "version": "1.0.1-alpha",
3
+ "version": "1.0.1-alpha.1",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-solutions.js",
6
6
  "files": [