@epigraph/configurator 1.7.6-alpha → 1.7.7-alpha

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9159,7 +9159,7 @@ ${i.join(`
9159
9159
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9160
9160
  * See the License for the specific language governing permissions and
9161
9161
  * limitations under the License.
9162
- */const LFe=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null;LFe&&self.XRSession.prototype.requestHitTestSource!=null;(()=>{const r=navigator.userAgent||navigator.vendor||self.opera;let e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(r)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(r.substr(0,4)))&&(e=!0),e})();const are=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,PFe=!!(window.webkit&&window.webkit.messageHandlers);(()=>{if(are){if(PFe)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const r=document.createElement("a");return!!(r.relList&&r.relList.supports&&r.relList.supports("ar"))}}else return!1})();const UFe="https://configurator.myepigraph.com/";class IR{static instanceSingleton=void 0;#e=!1;#n;#t;#i;#r=!0;#s;#l;#a=!0;#o;#h=!0;#c="";#u="";#f=null;epigraphAnalytics=null;EVENTS={UI:{PreloadScreen_Show:"preload:show",PreloadScreen_Hide:"preload:hide",ContextMenu_InfoBtnClicked:"infoButtonClicked_ContextMenu",ContextMenu_Show:"contextMenu:show",ContextMenu_Hide:"contextMenu:hide",UtilityMenu_Show:"utilityMenu:show",UtilityMenu_Hide:"utilityMenu:hide",ShareButton_Show:"shareButton:show",ShareButton_Hide:"shareButton:hide",ViewInYourSpaceButton_Show:"viewInYourSpace:show",ViewInYourSpaceButton_Hide:"viewInYourSpace:hide",ResetButton_Show:"resetBtn:show",ResetButton_Hide:"resetBtn:hide",DimensionsButton_Show:"dimensionsBtn:show",DimensionsButton_Hide:"dimensionsBtn:hide"},SCENE:{Item_Added:"item:added",Item_Removed:"item:removed",Items_Updated:"items:updated",FittingSkuIds_Updated:"fittingSkuIds:updated",CartItems_Updated:"cartItems:updated",Hotspot_Enter:"hotspot:enter",Hotspot_Exit:"hotspot:exit",SavedConfiguration_Loaded:"loaded-saved-configuration",MaterialOverrides_Exists:"materialOverrideExists",Cart_Checkout:"cart:checkout",Cart_OutOfStock:"cart:outOfStock",Cart_StatusUpdated:"cart:statusUpdated",ReplaceableCategory_Updated:"replaceableCategory:updated",GlobalVariant_Updated:"globalVariant:updated",CategoryData_Updated:"categoryData:updated",GlobalGeometryVariant_Updated:"globalGeometryVariant:updated",Ghost_Loaded:"ghost:loaded",Model_Loaded:"model:loaded",Model_Removed:"model:removed",Scene_Cleared:"scene:cleared",Inventory_Updated:"inventory:updated",DraggingOnDrop_CollsionDetected:"draggingOnDrop:collisionDetected",ActionButton_Clicked:"actionButton:clicked",CartMessage_Update:"cartMessage:updated"},CONFIGURATION:{OnClickItem:"onClickItem",CameraDetails_Update:"cameraDetails:Update"}};constructor(e,t=null){if(IR.instanceSingleton!==void 0)return IR.instanceSingleton;if(e.identifier!=="wc-epigraph-configurator-core")return Vt.error({title:"Invalid identifier on the 'wc-epigraph-configurator-core'. Unable to initialise the ConfiguratorCoreAPI class."}),null;IR.instanceSingleton=this,Object.freeze(this.CORE_EVENTS),this.#i=e,this.#t=t,this.#i.addEventListener(this.EVENTS.SCENE.CartItems_Updated,()=>{this.#o=void 0,this.#a=!0,this.#h=!0}),this.setupAnalyticsEventListeners(),this.#e=!0}set clientAccessKey(e){this.#s=e}set canUpdateInventory(e){this.#r=e}get lastSharedConfigurationID(){return this.#o}set lastSharedConfigurationID(e){this.#o=e}set projectId(e){this.#l=e}get coreWCRef(){return this.#i}getResolvedAssetUrl(e){return qPe(e)}initializeAnalytics(e=void 0){e!==void 0&&(this.epigraphAnalytics=new vFe,this.epigraphAnalytics.addEventPlugin(new gFe(e,!1)))}get isReady(){return this.#e}get preloadProgress(){return this.#n}get categoryData(){return Ln.getState().categoryData}get productData(){return Ln.getState().productData}get lookData(){return Ln.getState().lookData}get sceneSettings(){return lt.getState().sceneSettings}get assetsData(){return Ln.getState().assetsData}get isMobile(){return lt.getState().isMobile}getDeviceState(){return lt.getState().actions.getDeviceState()}get hasSceneChanged(){return this.#a}set hasSceneChanged(e){this.#a=e}enableCart(){lt.getState().actions.enableCart()}disableCart(){lt.getState().actions.disableCart()}fireEvent(e,t){let n=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0});n.data=t,this.coreWCRef?this.coreWCRef.dispatchEvent(n):Vt.warn({title:"core web component not found!"})}setupAnalyticsEventListeners(){this.coreWCRef.addEventListener("coreApi:ready",e=>{let t=Object.assign({},AFe);t.label=`Project ID: ${this.#l}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener("coreApi:failed",e=>{let t=Object.assign({},bFe);t.label=`Project ID: ${this.#l}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Added,e=>{Vt.info({title:"Add Item",details:e});const t=e.data.itemData.guid,a=rn.getState().attachmentSystem.currentStructure.getNodeByGUID(t).currentVariant,s=`${e.data.itemData.skuID}(${a})`;let o=Object.assign({},RFe);o.label=`Item Added: ${s}`,this.sendAnalyticsEvent(o)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Removed,e=>{if(Vt.info({title:"Remove Item"}),e.data.itemData==null)return;const t=e.data.itemData.skuID;let n=Object.assign({},MFe);n.label=`Item Removed: ${t}`,this.sendAnalyticsEvent(n)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Enter,e=>{let t=Object.assign({},DFe);t.label=`Hotspot Enter: ${e.data.hotspotAbsID}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Exit,e=>{let t=Object.assign({},OFe);t.label=`Hotspot Exit: ${e.data.domID}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Cart_Checkout,e=>{let t="Items: ";e.data.cartItems.forEach((i,a,s)=>{t+=`${i.count}@${i.skuID}(${i.currentVariant})`,a!==s.length-1&&(t+="<>")});let n=Object.assign({},SFe);n.label=t,this.sendAnalyticsEvent(n)})}setEmptySceneText(e){const t=lt.getState().sceneSettings;t.emptySceneText=e,lt.setState({sceneSettings:{...t}})}getSpawningRequirementForSkuID(e){return rn.getState().attachmentSystem.currentStructure.getSpawningRequirementForSkuID(e)}getCartItems(){return rn.getState().attachmentSystem.getCartItems()}checkout(e=!1){const t=rn.getState().attachmentSystem;this.#f=this.getSceneStructure();const n=t.getCartItems();return Vt.warn({title:"CONFIGURATOR CHECKED OUT: "}),Vt.table(n),e===!0||n.cartItems.find(i=>i.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,n),st.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,n),n}async reloadCheckedoutScene(){if(!this.#f){Vt.info({title:"No data found since last checkout"});return}await this.loadSceneFromConfiguration(this.#f)}getCurrentItemsInReplaceableCategory(){return rn.getState().attachmentSystem.currentStructure.getCurrentItemsInReplaceableCategory()}async getSceneAsGlbUrl(){return this.#h===!1?this.#c:(URL.revokeObjectURL(this.#c),this.#c=void 0,this.#c=await lFe(),this.#h=!1,this.#c)}async getSceneAsUsdzUrl(){return this.#h===!1?this.#u:(URL.revokeObjectURL(this.#u),this.#u=void 0,this.#u=await oFe(),this.#h=!1,this.#u)}async generateShareableLink(e=!1){if(!this.#a&&this.#o)Vt.info({title:"Reusing the cached configuration ID that was last saved..."});else{Vt.info({title:"Generating a new configuration ID..."});let a=rn.getState().actions.export();const s=await HPe(a);this.#o=await s.text()}const t=e===!0?UFe:window.location.href;let n=new URL(t);e===!0&&n.searchParams.set("launchInAR",!0),n.searchParams.set("projectId",this.#l),n.searchParams.set("epgsharedconfigid",this.#o),this.#a=!1;let i=Object.assign({},$$);return i.label=`Shared URL: ${n}`,this.sendAnalyticsEvent(i),n.href}closeContextMenu(){Yt.getState().selectedItemData&&Yt.getState().actions.deselectItem()}updatePreloadProgress(e){const t=this.#n;this.#n=e;const n=new CustomEvent("preload:update",{detail:{progress:this.#n}});window.dispatchEvent(n),typeof this.#t=="function"&&this.#t(t,e)}alert({alertMsg:e,alertTime:t,alertType:n,alertLabel:i,persistant:a=!1}){lt.getState().actions.sendAlert({alertMsg:e,alertTime:t,alertType:n,alertLabel:i,persistant:a})}removePersistantAlert(){lt.setState({persistantAlertData:null})}clickHotspot(e){let t=this.coreWCRef.shadowRoot.getElementById(e);t&&t.click()}exitHotspot(){si.getState().actions.exitHotspot(!1)}async spawnGhostsForSkuID(e,t=!1,n){if(Yt.getState().busy)return null;await or.getState().actions.spawnGhostsForSkuID(e,t,n)}removeAllGhosts(){if(Yt.getState().busy)return null;or.getState().actions.clearAllGhosts()}printSceneHierarchy(e=!1){const t=lt.getState().sceneRef;(function n(i){const a=`${i.name} < ${i.type} >`;e===!0?console.groupCollapsed(a):console.group(a),i.children.forEach(n),console.groupEnd()})(t)}getSceneItems(){const e=Yt.getState().itemsSpawned;if(typeof e!="object"){Vt.error({title:"There was an error while fetching the scene item count."});return}return e}getSceneItemCount(){let e;const t=Yt.getState().itemsSpawned;return typeof t!="object"&&Vt.error({title:"There was an error while fetching the scene item count."}),e=Object.keys(t).length,e}async spawnItemBySkuID(e,t=!1){return Yt.getState().busy?null:(t===!0&&await this.spawnGhostsForSkuID(e,!1,1),await Yt.getState().actions.addItemBySkuID(e))}async replaceItemsByGuid(e){let t={...e},n=!1;const i=rn.getState().attachmentSystem.currentStructure;let a=this.getSceneStructure();return Object.keys(e).map(s=>{a.structure.map(o=>{if(o.guid==s){let l=!1;const u=i.getNodeByGUID(s);u&&(l=u.isReplaceableWithSkuId(e[s].skuId)),t[s].success=l,l&&(o.skuID=e[s].skuId,n=!0)}})}),n&&await this.loadSceneFromConfiguration(a),t}async replaceItemsBySkuId(e,t=[]){let n={...e},i=!1;const a=rn.getState().attachmentSystem.currentStructure;let s=this.getSceneStructure();return s.structure.map(o=>{t.includes(o.guid)!==!0&&Object.keys(e).map(l=>{if(o.skuID==l){let u=!1;const f=a.getNodeByGUID(o.guid);f&&(u=f.isReplaceableWithSkuId(e[l].skuId)),n[l].success=u,u&&(o.skuID=e[l].skuId,i=!0)}})}),i&&await this.loadSceneFromConfiguration(s),n}async removeItemByGUID(e,t=!1){const i=rn.getState().attachmentSystem.currentStructure.getNodeByGUID(e);t===!1&&i.canSwapRoot===!0&&i.swapRoot(),await Yt.getState().actions.removeItemByGUID(e)}rotateItemByGUID(e){rn.getState().attachmentSystem.currentStructure.rotateNode(e)}rotateSelectedItem(){const e=Yt.getState().selectedItemData;if(!e){Vt.info("No current item selected to rotate");return}const t=e.itemData.guid;return rn.getState().attachmentSystem.currentStructure.rotateNode(t),e}removeItemBySkuID(e,t=!0){this.removeSelectedItem()}async removeSelectedItem(){const e=Yt.getState().selectedItemData;if(!e){Vt.info({title:"No current item selected to delete"});return}const t=e.itemData.guid;return Yt.getState().actions.deselectItem(),await this.removeItemByGUID(t),Vt.info({title:`Removed Item: ${t}`}),e}refocus(){lt.getState().actions.triggerAutoFocus()}focusOnGhosts(){if(or.getState().ghostParentRef===null){Vt.warn({title:"Ghost Parent Reference not found"});return}or.getState().ghostParentRef.children.length<=0?lt.getState().actions.triggerAutoFocus():lt.getState().actions.triggerAutoFocus(or.getState().ghostParentRef)}exitSelectedItem(){Yt.getState().actions.deselectItem()}getSelectedItemData(){return Yt.getState().selectedItemData}canSelectedItemRotate(){const e=rn.getState().attachmentSystem.currentStructure;let t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).canRotate:!1}canSelectedItemDrag(){const e=rn.getState().attachmentSystem.currentStructure,t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).canDrag:!1}doesGuidItemHaveAnAttachedDependency(e){let t=!0;const i=rn.getState().attachmentSystem.currentStructure.getNodeByGUID(e),a=i.isEndNode;return t=!a,a||i.canSwapRoot&&i.whichNodesAreAttachedToUs().length==1&&(t=!1),t}doesSelectedItemHasAttachedDependency(){const e=this.getSelectedItemData();return e?this.doesGuidItemHaveAnAttachedDependency(e.itemData.guid):!1}isSelectedItemAnEndNode(){const e=rn.getState().attachmentSystem.currentStructure,t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).isEndNode:!1}getCurrentSceneEnvMap(){return Qx.getState().envMapUrl}async switchGlobalGeometryVariant(e,t){if(!e){Vt.WARN({title:"Geometry Category: '"+e+"' not valid!"});return}Yt.getState().selectedItemData&&Yt.getState().actions.deselectItem(),await rn.getState().attachmentSystem.switchGlobalGeometryVariant(e,t),await hc(1);let n=Object.assign({},xFe);n.label=`Variant: ${t} `,this.sendAnalyticsEvent(n)}async switchGlobalVariant(e,t=""){if(!e){Vt.WARN({title:"Look Category: '"+e+"' not valid!"});return}Yt.getState().selectedItemData&&Yt.getState().actions.deselectItem(),Vt.info({title:`Changing Global Variant: Category: ${e} Id: ${t}`}),await rn.getState().attachmentSystem.switchGlobalVariant(e,t),await hc(1);let n=Object.assign({},X$);n.label=`Variant: ${t}`,this.sendAnalyticsEvent(n)}async overrideSelectedItemMaterial(e=""){return Yt.getState().selectedItemData?(await Yt.getState().actions.switchToVariant(Yt.getState().selectedItemData.itemData,e,!0),!0):!1}async overrideItemMaterialByGuid(e,t){const n=Yt.getState().itemsSpawned[e];if(!n)return Vt.warn({title:"Item with guid: "+e+" doesn't exist"}),!1;await Yt.getState().actions.switchToVariant(n.itemData,t,!0);let i=Object.assign({},X$);return i.label=`Variant: ${t}`,this.sendAnalyticsEvent(i),!0}getSelectedItemColors(){let e=[];if(this.getSelectedItemData()==null)return e;let n=this.getSelectedItemData().itemData.looks;if(n){let i=Ln.getState().lookData;n.map(a=>{i.hasOwnProperty(a)&&e.push(i[a])})}return e}getCanvasSize(){return lt.getState().canvasSize}async removeAllVariantOverrides(){Yt.getState().selectedItemData&&Yt.getState().actions.deselectItem(),await rn.getState().attachmentSystem.removeAllVariantOverrides()}switchCursor(e){lt&&lt.getState().actions.switchCursor(e)}getSceneStructure(){return rn.getState().actions.export()}async loadSceneFromConfiguration(e){await rn.getState().actions.loadStructure(e),this.sendAnalyticsEvent(preconfigLoadEvent)}async loadSceneFromConfigurationID(e){const t=await rn.getState().actions.loadSavedStructureFromConfigID(e);if(!t)return null;rn.setState({defaultConfig:t});let n=Object.assign({},TFe);n.label=`Preconfig ID: ${e}`,await this.loadSceneFromConfiguration(t)}viewInYourSpace(){Vt.info({title:"View in your space called from the Core API"});let e=Object.assign({},CFe);e.label="AR Requested",this.sendAnalyticsEvent(e),this.#i.epigraphViewInYourSpaceRef._onViewInYourSpaceButtonClicked()}async shareScene(){const e=await this.generateShareableLink();let t=Object.assign({},$$);return t.label=`Shared URL: ${e}`,this.sendAnalyticsEvent(t),e}async clearScene(){await rn.getState().attachmentSystem.clear()}async restartScene(){Vt.info({title:"Restarting Scene."}),await rn.getState().attachmentSystem.restart();let e=Object.assign({},wFe);e.label="Scene Restarted",this.sendAnalyticsEvent(e)}areDimensionsVisible(){return lt.getState().showDimensions}getActiveHotspot(){return si.getState().activeHotspotData}reviewCartShown(){let e=Object.assign({},_Fe);e.label="Review Cart shown",this.sendAnalyticsEvent(e)}reviewCartHidden(){let e=Object.assign({},EFe);e.label="Review Cart hidden",this.sendAnalyticsEvent(e)}showDimensions(){lt.setState({showDimensions:!0});let e=Object.assign({},IFe);e.label="Dimensions shown",this.sendAnalyticsEvent(e)}hideDimensions(){lt.setState({showDimensions:!1});let e=Object.assign({},NFe);e.label="Dimensions hidden",this.sendAnalyticsEvent(e)}areHotspotsVisible(){return si.getState().hotspotsVisibility}areHotspotsTemporarilyVisible(){return si.getState().hotspotsTempVisibility}showAllHotspots(e=!1){si.getState().actions.switchHotspotsVisibility(!0,e)}hideAllHotspots(e=!1){si.getState().actions.switchHotspotsVisibility(!1,e)}getFittingSkuIds(){return rn.getState().attachmentSystem.getFittingSKUIDs()}selectItemWithGUID(e){const t=Yt.getState().itemsSpawned,n=rn.getState().attachmentSystem.currentStructure.getNodeByGUID(e);Yt.getState().actions.setSelectedItemData({...t[e],overrideVariant:n.overrideVariant,currentVariant:n.currentVariant,offsetX:0,offsetY:0})}async getCurrentCameraDetails(){return new Promise((e,t)=>{st.coreWCRef.addEventListener(st.EVENTS.CONFIGURATION.CameraDetails_Update,n=>{e(n.data)},{once:!0}),Ar.getState().actions.triggerFetchingCamera()})}moveCamera(e,t,n,i,a){si.setState({isAnyHotspotActive:!0}),Ar.setState({manualControl:!0,sourcePos:e,destPos:t,interpolationFactor:n,duration:i}),a&&Ar.setState({focusPointPosition:a})}setEnvLightMap(e){Qx.setState({envMapUrl:e})}updateInventoryForAllProducts(e){return this.#r===!1?(Vt.warn({title:"Inventory has been already updated once!"}),null):(Hd.getState().actions.updateInventoryForAllProducts(e),this.#r=!1,this.getInventoryInfo())}getInventoryInfo(){return Hd.getState().actions.getInventoryInfo()}updatePricingForAllProducts(e){Ln.getState().actions.updatePricingForAllProducts(e);const n=rn.getState().attachmentSystem.getCartItems();n&&st.fireEvent(st.EVENTS.SCENE.CartItems_Updated,n)}updatePricingForProduct(e,t,n){Ln.getState().actions.updatePricingForProduct(e,t,n);const a=rn.getState().attachmentSystem.getCartItems();a&&st.fireEvent(st.EVENTS.SCENE.CartItems_Updated,a)}getCurrentPricingInfo(){return Ln.getState().actions.getCurrentPricingInfo()}async itemDragStart(e){if(Yt.getState().busy)return null;lt.setState({hoveredGhostIndex:-1}),await this.removeAllGhosts(),lt.setState({itemDraggedSkuID:e}),await this.spawnGhostsForSkuID(e,!1)}async itemDragEnd(){if(Yt.getState().busy)return null;const e=lt.getState().hoveredGhostIndex;e!==-1?await Yt.getState().actions.addItemBySkuID(lt.getState().itemDraggedSkuID,e):await this.removeAllGhosts(),lt.setState({itemDraggedSkuID:null,hoveredGhostIndex:-1})}async forceSpawnItem(e,t){const n=Ln.getState().productData,i=rn.getState().attachmentSystem;if(!i)return;const a=i.currentStructure;if(!a)return;let s=a.getNodeByGUID(t);s?(s._skuID=e,s.generatePlugsForNode(e)):(s=new cR(e,{guid:t,isEndNode:!0,overrideVariant:null,plugs:n[e].plugs}),a.addNode(s),a.connectPlugs({incomingPlug:new gH({name:"haha",acceptedPlugTypes:[],connectsToPlugTypes:[]},s),receiverPlug:a.rootNode.plugs[0]}));const o=await Yt.getState().actions.addItemWithTransform({position:new ye(0,0,0),rotation:new Qi().identity()},e,t);return await hc(1),o}async downloadCurrentViewAsImage(e,t="png"){if(!e){Vt.warn({title:`Couldn't take screenshot for ${e}. Missing imageName parameter`});return}if(!t){Vt.warn({title:`Couldn't take screenshot for ${t}. Missing imageExtension parameter`});return}await hc(1);const n=await this.getCurrentViewAsImageUrl();await hc(1);let i;return n.success===!0&&(Vt.info({title:"Downloading the screenshot"}),i=document.createElement("a"),i.setAttribute("download",`${e}.${t}`),i.setAttribute("href",n.imageData),i.click(),Vt.info({title:"Screenshot download complete"})),i}async getCurrentViewAsImageUrl(){await hc(1);const e=await lt.getState().actions.requestNewScreenshot();return await hc(1),e}setCameraFocusPointPosition(e){Ar.setState({focusPointPosition:e})}triggerFetchingCamera(){Ar.getState().actions.triggerFetchingCamera()}async completeItemDrop(){await lt.getState().actions.completeDropItem()}revertItemDrop(){lt.getState().actions.revertDropItem()}getCameraFocusPointPosition(){return Ar.getState().focusPointPosition}sendAnalyticsPageViewedEvent(){}sendAnalyticsEvent(e){this.epigraphAnalytics!==null&&this.epigraphAnalytics.sendEvent(e)}isIosDevice(){return are}actionButtonClicked(e){this.fireEvent(this.EVENTS.SCENE.ActionButton_Clicked,{data:e.actionButton.data,skuID:e.skuID,count:e.count,price:e.price,countAvailable:e.countAvailable,countUnavailable:e.countUnavailable,currentVariant:e.currentVariant})}setCartMessage(e){this.fireEvent(this.EVENTS.SCENE.CartMessage_Update,{cartMessage:e})}}class BFe extends HTMLElement{#e="wc-epigraph-configurator-core";#n=!1;#t=void 0;#i=void 0;initialConfigId="";clientAccessKey="";gaCode="";builderMode=!1;projectId="";api=null;constructor(){super(),this.attachShadow({mode:"open"}),APe(new IR(this)),this.api=st}get identifier(){return this.#e}static get observedAttributes(){}get epigraphViewInYourSpaceRef(){return this.#t}#r(){this.hasAttribute("configurator-wc-id")&&(this.configuratorWcId=this.getAttribute("configurator-wc-id")),this.hasAttribute("initial-config-id")&&(this.initialConfigId=this.getAttribute("initial-config-id")),this.hasAttribute("client-access-key")&&(this.clientAccessKey=this.getAttribute("client-access-key")),this.hasAttribute("ga-code")&&(this.gaCode=this.getAttribute("ga-code")),this.hasAttribute("builder-mode")&&(this.builderMode=!0),Vt.group("Collected Web Component Attributes"),Vt.table({initialConfigId:this.initialConfigId,clientAccessKey:this.clientAccessKey,builderMode:this.builderMode}),Vt.groupEnd()}static get observedAttributes(){return["view-in-your-space-elem-id"]}attributeChangedCallback(e,t,n){if(this.#i||(this.#i=document.querySelector(`#${this.configuratorWcId}`)),!!this.#i)switch(e){case"view-in-your-space-elem-id":this.#t=this.#i.shadowRoot.querySelector(`#${n}`),Vt.warn({title:"ViewInYourSpace is now accessible from the core: "});break}}async#s(e){return new Promise(function(t,n){let i=new XMLHttpRequest;i.withCredentials=!1,i.open("GET","https://api.seeitinyourspace.com/auth/"+e),i.setRequestHeader("Content-Type","application/json"),i.onreadystatechange=function(){if(this.readyState===4){const a=JSON.parse(this.responseText);Vt.warn({title:a}),t(a)}},i.onerror=function(){n({status:this.status,statusText:i.statusText})},i.send()})}async connectedCallback(){if(this.#n===!0)return;this.#r();const e=await this.#s(this.clientAccessKey);this.validationPassed=e.passed,this.projectId=e.projectID,this.api.projectId=this.projectId,st.initializeAnalytics(this.gaCode);let t=Object.assign({},yFe);if(t.label=`Project ID: ${this.projectId}`,st.sendAnalyticsEvent(t),this.validationPassed==="false"){Vt.error({title:"Request from an invalidated source: "+window.location.href}),st.fireEvent("coreApi:failed");return}Vt.info({title:"VALIDATION SUCCESSFUL!"}),this.#n=!0,this.#i=document.querySelector(`#${this.configuratorWcId}`);let n=new URL(window.location).searchParams;n.has("epgsharedconfigid")&&(this.initialConfigId=n.get("epgsharedconfigid")),VU(this.shadowRoot).render(te(bke,{projectId:this.projectId,clientAccessKey:this.clientAccessKey,initialConfigId:this.initialConfigId,builderMode:this.builderMode,disableCart:this.hasAttribute("disable-cart")},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator-dev-env/epigraph-configurator-core/src/index.js",lineNumber:206,columnNumber:7},this))}disconnectedCallback(){st.fireEvent("coreApi:shutDown")}}const q6=document.createElement("template");q6.id="fullScreenModalTemplate";q6.innerHTML=`
9162
+ */const LFe=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null;LFe&&self.XRSession.prototype.requestHitTestSource!=null;(()=>{const r=navigator.userAgent||navigator.vendor||self.opera;let e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(r)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(r.substr(0,4)))&&(e=!0),e})();const are=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,PFe=!!(window.webkit&&window.webkit.messageHandlers);(()=>{if(are){if(PFe)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const r=document.createElement("a");return!!(r.relList&&r.relList.supports&&r.relList.supports("ar"))}}else return!1})();class IR{static instanceSingleton=void 0;#e=!1;#n;#t;#i;#r=!0;#s;#l;#a=!0;#o;#h=!0;#c="";#u="";#f=null;epigraphAnalytics=null;EVENTS={UI:{PreloadScreen_Show:"preload:show",PreloadScreen_Hide:"preload:hide",ContextMenu_InfoBtnClicked:"infoButtonClicked_ContextMenu",ContextMenu_Show:"contextMenu:show",ContextMenu_Hide:"contextMenu:hide",UtilityMenu_Show:"utilityMenu:show",UtilityMenu_Hide:"utilityMenu:hide",ShareButton_Show:"shareButton:show",ShareButton_Hide:"shareButton:hide",ViewInYourSpaceButton_Show:"viewInYourSpace:show",ViewInYourSpaceButton_Hide:"viewInYourSpace:hide",ResetButton_Show:"resetBtn:show",ResetButton_Hide:"resetBtn:hide",DimensionsButton_Show:"dimensionsBtn:show",DimensionsButton_Hide:"dimensionsBtn:hide"},SCENE:{Item_Added:"item:added",Item_Removed:"item:removed",Items_Updated:"items:updated",FittingSkuIds_Updated:"fittingSkuIds:updated",CartItems_Updated:"cartItems:updated",Hotspot_Enter:"hotspot:enter",Hotspot_Exit:"hotspot:exit",SavedConfiguration_Loaded:"loaded-saved-configuration",MaterialOverrides_Exists:"materialOverrideExists",Cart_Checkout:"cart:checkout",Cart_OutOfStock:"cart:outOfStock",Cart_StatusUpdated:"cart:statusUpdated",ReplaceableCategory_Updated:"replaceableCategory:updated",GlobalVariant_Updated:"globalVariant:updated",CategoryData_Updated:"categoryData:updated",GlobalGeometryVariant_Updated:"globalGeometryVariant:updated",Ghost_Loaded:"ghost:loaded",Model_Loaded:"model:loaded",Model_Removed:"model:removed",Scene_Cleared:"scene:cleared",Inventory_Updated:"inventory:updated",DraggingOnDrop_CollsionDetected:"draggingOnDrop:collisionDetected",ActionButton_Clicked:"actionButton:clicked",CartMessage_Update:"cartMessage:updated"},CONFIGURATION:{OnClickItem:"onClickItem",CameraDetails_Update:"cameraDetails:Update"}};constructor(e,t=null){if(IR.instanceSingleton!==void 0)return IR.instanceSingleton;if(e.identifier!=="wc-epigraph-configurator-core")return Vt.error({title:"Invalid identifier on the 'wc-epigraph-configurator-core'. Unable to initialise the ConfiguratorCoreAPI class."}),null;IR.instanceSingleton=this,Object.freeze(this.CORE_EVENTS),this.#i=e,this.#t=t,this.#i.addEventListener(this.EVENTS.SCENE.CartItems_Updated,()=>{this.#o=void 0,this.#a=!0,this.#h=!0}),this.setupAnalyticsEventListeners(),this.#e=!0}set clientAccessKey(e){this.#s=e}set canUpdateInventory(e){this.#r=e}get lastSharedConfigurationID(){return this.#o}set lastSharedConfigurationID(e){this.#o=e}set projectId(e){this.#l=e}get coreWCRef(){return this.#i}getResolvedAssetUrl(e){return qPe(e)}initializeAnalytics(e=void 0){e!==void 0&&(this.epigraphAnalytics=new vFe,this.epigraphAnalytics.addEventPlugin(new gFe(e,!1)))}get isReady(){return this.#e}get preloadProgress(){return this.#n}get categoryData(){return Ln.getState().categoryData}get productData(){return Ln.getState().productData}get lookData(){return Ln.getState().lookData}get sceneSettings(){return lt.getState().sceneSettings}get assetsData(){return Ln.getState().assetsData}get isMobile(){return lt.getState().isMobile}getDeviceState(){return lt.getState().actions.getDeviceState()}get hasSceneChanged(){return this.#a}set hasSceneChanged(e){this.#a=e}enableCart(){lt.getState().actions.enableCart()}disableCart(){lt.getState().actions.disableCart()}fireEvent(e,t){let n=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0});n.data=t,this.coreWCRef?this.coreWCRef.dispatchEvent(n):Vt.warn({title:"core web component not found!"})}setupAnalyticsEventListeners(){this.coreWCRef.addEventListener("coreApi:ready",e=>{let t=Object.assign({},AFe);t.label=`Project ID: ${this.#l}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener("coreApi:failed",e=>{let t=Object.assign({},bFe);t.label=`Project ID: ${this.#l}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Added,e=>{Vt.info({title:"Add Item",details:e});const t=e.data.itemData.guid,a=rn.getState().attachmentSystem.currentStructure.getNodeByGUID(t).currentVariant,s=`${e.data.itemData.skuID}(${a})`;let o=Object.assign({},RFe);o.label=`Item Added: ${s}`,this.sendAnalyticsEvent(o)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Removed,e=>{if(Vt.info({title:"Remove Item"}),e.data.itemData==null)return;const t=e.data.itemData.skuID;let n=Object.assign({},MFe);n.label=`Item Removed: ${t}`,this.sendAnalyticsEvent(n)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Enter,e=>{let t=Object.assign({},DFe);t.label=`Hotspot Enter: ${e.data.hotspotAbsID}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Exit,e=>{let t=Object.assign({},OFe);t.label=`Hotspot Exit: ${e.data.domID}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Cart_Checkout,e=>{let t="Items: ";e.data.cartItems.forEach((i,a,s)=>{t+=`${i.count}@${i.skuID}(${i.currentVariant})`,a!==s.length-1&&(t+="<>")});let n=Object.assign({},SFe);n.label=t,this.sendAnalyticsEvent(n)})}setEmptySceneText(e){const t=lt.getState().sceneSettings;t.emptySceneText=e,lt.setState({sceneSettings:{...t}})}getSpawningRequirementForSkuID(e){return rn.getState().attachmentSystem.currentStructure.getSpawningRequirementForSkuID(e)}getCartItems(){return rn.getState().attachmentSystem.getCartItems()}checkout(e=!1){const t=rn.getState().attachmentSystem;this.#f=this.getSceneStructure();const n=t.getCartItems();return Vt.warn({title:"CONFIGURATOR CHECKED OUT: "}),Vt.table(n),e===!0||n.cartItems.find(i=>i.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,n),st.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,n),n}async reloadCheckedoutScene(){if(!this.#f){Vt.info({title:"No data found since last checkout"});return}await this.loadSceneFromConfiguration(this.#f)}getCurrentItemsInReplaceableCategory(){return rn.getState().attachmentSystem.currentStructure.getCurrentItemsInReplaceableCategory()}async getSceneAsGlbUrl(){return this.#h===!1?this.#c:(URL.revokeObjectURL(this.#c),this.#c=void 0,this.#c=await lFe(),this.#h=!1,this.#c)}async getSceneAsUsdzUrl(){return this.#h===!1?this.#u:(URL.revokeObjectURL(this.#u),this.#u=void 0,this.#u=await oFe(),this.#h=!1,this.#u)}async generateShareableLink(e=!1){if(!this.#a&&this.#o)Vt.info({title:"Reusing the cached configuration ID that was last saved..."});else{Vt.info({title:"Generating a new configuration ID..."});let a=rn.getState().actions.export();const s=await HPe(a);this.#o=await s.text()}const t=window.location.href;let n=new URL(t);e===!0&&n.searchParams.set("launchInAR",!0),n.searchParams.set("projectId",this.#l),n.searchParams.set("epgsharedconfigid",this.#o),this.#a=!1;let i=Object.assign({},$$);return i.label=`Shared URL: ${n}`,this.sendAnalyticsEvent(i),n.href}closeContextMenu(){Yt.getState().selectedItemData&&Yt.getState().actions.deselectItem()}updatePreloadProgress(e){const t=this.#n;this.#n=e;const n=new CustomEvent("preload:update",{detail:{progress:this.#n}});window.dispatchEvent(n),typeof this.#t=="function"&&this.#t(t,e)}alert({alertMsg:e,alertTime:t,alertType:n,alertLabel:i,persistant:a=!1}){lt.getState().actions.sendAlert({alertMsg:e,alertTime:t,alertType:n,alertLabel:i,persistant:a})}removePersistantAlert(){lt.setState({persistantAlertData:null})}clickHotspot(e){let t=this.coreWCRef.shadowRoot.getElementById(e);t&&t.click()}exitHotspot(){si.getState().actions.exitHotspot(!1)}async spawnGhostsForSkuID(e,t=!1,n){if(Yt.getState().busy)return null;await or.getState().actions.spawnGhostsForSkuID(e,t,n)}removeAllGhosts(){if(Yt.getState().busy)return null;or.getState().actions.clearAllGhosts()}printSceneHierarchy(e=!1){const t=lt.getState().sceneRef;(function n(i){const a=`${i.name} < ${i.type} >`;e===!0?console.groupCollapsed(a):console.group(a),i.children.forEach(n),console.groupEnd()})(t)}getSceneItems(){const e=Yt.getState().itemsSpawned;if(typeof e!="object"){Vt.error({title:"There was an error while fetching the scene item count."});return}return e}getSceneItemCount(){let e;const t=Yt.getState().itemsSpawned;return typeof t!="object"&&Vt.error({title:"There was an error while fetching the scene item count."}),e=Object.keys(t).length,e}async spawnItemBySkuID(e,t=!1){return Yt.getState().busy?null:(t===!0&&await this.spawnGhostsForSkuID(e,!1,1),await Yt.getState().actions.addItemBySkuID(e))}async replaceItemsByGuid(e){let t={...e},n=!1;const i=rn.getState().attachmentSystem.currentStructure;let a=this.getSceneStructure();return Object.keys(e).map(s=>{a.structure.map(o=>{if(o.guid==s){let l=!1;const u=i.getNodeByGUID(s);u&&(l=u.isReplaceableWithSkuId(e[s].skuId)),t[s].success=l,l&&(o.skuID=e[s].skuId,n=!0)}})}),n&&await this.loadSceneFromConfiguration(a),t}async replaceItemsBySkuId(e,t=[]){let n={...e},i=!1;const a=rn.getState().attachmentSystem.currentStructure;let s=this.getSceneStructure();return s.structure.map(o=>{t.includes(o.guid)!==!0&&Object.keys(e).map(l=>{if(o.skuID==l){let u=!1;const f=a.getNodeByGUID(o.guid);f&&(u=f.isReplaceableWithSkuId(e[l].skuId)),n[l].success=u,u&&(o.skuID=e[l].skuId,i=!0)}})}),i&&await this.loadSceneFromConfiguration(s),n}async removeItemByGUID(e,t=!1){const i=rn.getState().attachmentSystem.currentStructure.getNodeByGUID(e);t===!1&&i.canSwapRoot===!0&&i.swapRoot(),await Yt.getState().actions.removeItemByGUID(e)}rotateItemByGUID(e){rn.getState().attachmentSystem.currentStructure.rotateNode(e)}rotateSelectedItem(){const e=Yt.getState().selectedItemData;if(!e){Vt.info("No current item selected to rotate");return}const t=e.itemData.guid;return rn.getState().attachmentSystem.currentStructure.rotateNode(t),e}removeItemBySkuID(e,t=!0){this.removeSelectedItem()}async removeSelectedItem(){const e=Yt.getState().selectedItemData;if(!e){Vt.info({title:"No current item selected to delete"});return}const t=e.itemData.guid;return Yt.getState().actions.deselectItem(),await this.removeItemByGUID(t),Vt.info({title:`Removed Item: ${t}`}),e}refocus(){lt.getState().actions.triggerAutoFocus()}focusOnGhosts(){if(or.getState().ghostParentRef===null){Vt.warn({title:"Ghost Parent Reference not found"});return}or.getState().ghostParentRef.children.length<=0?lt.getState().actions.triggerAutoFocus():lt.getState().actions.triggerAutoFocus(or.getState().ghostParentRef)}exitSelectedItem(){Yt.getState().actions.deselectItem()}getSelectedItemData(){return Yt.getState().selectedItemData}canSelectedItemRotate(){const e=rn.getState().attachmentSystem.currentStructure;let t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).canRotate:!1}canSelectedItemDrag(){const e=rn.getState().attachmentSystem.currentStructure,t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).canDrag:!1}doesGuidItemHaveAnAttachedDependency(e){let t=!0;const i=rn.getState().attachmentSystem.currentStructure.getNodeByGUID(e),a=i.isEndNode;return t=!a,a||i.canSwapRoot&&i.whichNodesAreAttachedToUs().length==1&&(t=!1),t}doesSelectedItemHasAttachedDependency(){const e=this.getSelectedItemData();return e?this.doesGuidItemHaveAnAttachedDependency(e.itemData.guid):!1}isSelectedItemAnEndNode(){const e=rn.getState().attachmentSystem.currentStructure,t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).isEndNode:!1}getCurrentSceneEnvMap(){return Qx.getState().envMapUrl}async switchGlobalGeometryVariant(e,t){if(!e){Vt.WARN({title:"Geometry Category: '"+e+"' not valid!"});return}Yt.getState().selectedItemData&&Yt.getState().actions.deselectItem(),await rn.getState().attachmentSystem.switchGlobalGeometryVariant(e,t),await hc(1);let n=Object.assign({},xFe);n.label=`Variant: ${t} `,this.sendAnalyticsEvent(n)}async switchGlobalVariant(e,t=""){if(!e){Vt.WARN({title:"Look Category: '"+e+"' not valid!"});return}Yt.getState().selectedItemData&&Yt.getState().actions.deselectItem(),Vt.info({title:`Changing Global Variant: Category: ${e} Id: ${t}`}),await rn.getState().attachmentSystem.switchGlobalVariant(e,t),await hc(1);let n=Object.assign({},X$);n.label=`Variant: ${t}`,this.sendAnalyticsEvent(n)}async overrideSelectedItemMaterial(e=""){return Yt.getState().selectedItemData?(await Yt.getState().actions.switchToVariant(Yt.getState().selectedItemData.itemData,e,!0),!0):!1}async overrideItemMaterialByGuid(e,t){const n=Yt.getState().itemsSpawned[e];if(!n)return Vt.warn({title:"Item with guid: "+e+" doesn't exist"}),!1;await Yt.getState().actions.switchToVariant(n.itemData,t,!0);let i=Object.assign({},X$);return i.label=`Variant: ${t}`,this.sendAnalyticsEvent(i),!0}getSelectedItemColors(){let e=[];if(this.getSelectedItemData()==null)return e;let n=this.getSelectedItemData().itemData.looks;if(n){let i=Ln.getState().lookData;n.map(a=>{i.hasOwnProperty(a)&&e.push(i[a])})}return e}getCanvasSize(){return lt.getState().canvasSize}async removeAllVariantOverrides(){Yt.getState().selectedItemData&&Yt.getState().actions.deselectItem(),await rn.getState().attachmentSystem.removeAllVariantOverrides()}switchCursor(e){lt&&lt.getState().actions.switchCursor(e)}getSceneStructure(){return rn.getState().actions.export()}async loadSceneFromConfiguration(e){await rn.getState().actions.loadStructure(e),this.sendAnalyticsEvent(preconfigLoadEvent)}async loadSceneFromConfigurationID(e){const t=await rn.getState().actions.loadSavedStructureFromConfigID(e);if(!t)return null;rn.setState({defaultConfig:t});let n=Object.assign({},TFe);n.label=`Preconfig ID: ${e}`,await this.loadSceneFromConfiguration(t)}viewInYourSpace(){Vt.info({title:"View in your space called from the Core API"});let e=Object.assign({},CFe);e.label="AR Requested",this.sendAnalyticsEvent(e),this.#i.epigraphViewInYourSpaceRef._onViewInYourSpaceButtonClicked()}async shareScene(){const e=await this.generateShareableLink();let t=Object.assign({},$$);return t.label=`Shared URL: ${e}`,this.sendAnalyticsEvent(t),e}async clearScene(){await rn.getState().attachmentSystem.clear()}async restartScene(){Vt.info({title:"Restarting Scene."}),await rn.getState().attachmentSystem.restart();let e=Object.assign({},wFe);e.label="Scene Restarted",this.sendAnalyticsEvent(e)}areDimensionsVisible(){return lt.getState().showDimensions}getActiveHotspot(){return si.getState().activeHotspotData}reviewCartShown(){let e=Object.assign({},_Fe);e.label="Review Cart shown",this.sendAnalyticsEvent(e)}reviewCartHidden(){let e=Object.assign({},EFe);e.label="Review Cart hidden",this.sendAnalyticsEvent(e)}showDimensions(){lt.setState({showDimensions:!0});let e=Object.assign({},IFe);e.label="Dimensions shown",this.sendAnalyticsEvent(e)}hideDimensions(){lt.setState({showDimensions:!1});let e=Object.assign({},NFe);e.label="Dimensions hidden",this.sendAnalyticsEvent(e)}areHotspotsVisible(){return si.getState().hotspotsVisibility}areHotspotsTemporarilyVisible(){return si.getState().hotspotsTempVisibility}showAllHotspots(e=!1){si.getState().actions.switchHotspotsVisibility(!0,e)}hideAllHotspots(e=!1){si.getState().actions.switchHotspotsVisibility(!1,e)}getFittingSkuIds(){return rn.getState().attachmentSystem.getFittingSKUIDs()}selectItemWithGUID(e){const t=Yt.getState().itemsSpawned,n=rn.getState().attachmentSystem.currentStructure.getNodeByGUID(e);Yt.getState().actions.setSelectedItemData({...t[e],overrideVariant:n.overrideVariant,currentVariant:n.currentVariant,offsetX:0,offsetY:0})}async getCurrentCameraDetails(){return new Promise((e,t)=>{st.coreWCRef.addEventListener(st.EVENTS.CONFIGURATION.CameraDetails_Update,n=>{e(n.data)},{once:!0}),Ar.getState().actions.triggerFetchingCamera()})}moveCamera(e,t,n,i,a){si.setState({isAnyHotspotActive:!0}),Ar.setState({manualControl:!0,sourcePos:e,destPos:t,interpolationFactor:n,duration:i}),a&&Ar.setState({focusPointPosition:a})}setEnvLightMap(e){Qx.setState({envMapUrl:e})}updateInventoryForAllProducts(e){return this.#r===!1?(Vt.warn({title:"Inventory has been already updated once!"}),null):(Hd.getState().actions.updateInventoryForAllProducts(e),this.#r=!1,this.getInventoryInfo())}getInventoryInfo(){return Hd.getState().actions.getInventoryInfo()}updatePricingForAllProducts(e){Ln.getState().actions.updatePricingForAllProducts(e);const n=rn.getState().attachmentSystem.getCartItems();n&&st.fireEvent(st.EVENTS.SCENE.CartItems_Updated,n)}updatePricingForProduct(e,t,n){Ln.getState().actions.updatePricingForProduct(e,t,n);const a=rn.getState().attachmentSystem.getCartItems();a&&st.fireEvent(st.EVENTS.SCENE.CartItems_Updated,a)}getCurrentPricingInfo(){return Ln.getState().actions.getCurrentPricingInfo()}async itemDragStart(e){if(Yt.getState().busy)return null;lt.setState({hoveredGhostIndex:-1}),await this.removeAllGhosts(),lt.setState({itemDraggedSkuID:e}),await this.spawnGhostsForSkuID(e,!1)}async itemDragEnd(){if(Yt.getState().busy)return null;const e=lt.getState().hoveredGhostIndex;e!==-1?await Yt.getState().actions.addItemBySkuID(lt.getState().itemDraggedSkuID,e):await this.removeAllGhosts(),lt.setState({itemDraggedSkuID:null,hoveredGhostIndex:-1})}async forceSpawnItem(e,t){const n=Ln.getState().productData,i=rn.getState().attachmentSystem;if(!i)return;const a=i.currentStructure;if(!a)return;let s=a.getNodeByGUID(t);s?(s._skuID=e,s.generatePlugsForNode(e)):(s=new cR(e,{guid:t,isEndNode:!0,overrideVariant:null,plugs:n[e].plugs}),a.addNode(s),a.connectPlugs({incomingPlug:new gH({name:"haha",acceptedPlugTypes:[],connectsToPlugTypes:[]},s),receiverPlug:a.rootNode.plugs[0]}));const o=await Yt.getState().actions.addItemWithTransform({position:new ye(0,0,0),rotation:new Qi().identity()},e,t);return await hc(1),o}async downloadCurrentViewAsImage(e,t="png"){if(!e){Vt.warn({title:`Couldn't take screenshot for ${e}. Missing imageName parameter`});return}if(!t){Vt.warn({title:`Couldn't take screenshot for ${t}. Missing imageExtension parameter`});return}await hc(1);const n=await this.getCurrentViewAsImageUrl();await hc(1);let i;return n.success===!0&&(Vt.info({title:"Downloading the screenshot"}),i=document.createElement("a"),i.setAttribute("download",`${e}.${t}`),i.setAttribute("href",n.imageData),i.click(),Vt.info({title:"Screenshot download complete"})),i}async getCurrentViewAsImageUrl(){await hc(1);const e=await lt.getState().actions.requestNewScreenshot();return await hc(1),e}setCameraFocusPointPosition(e){Ar.setState({focusPointPosition:e})}triggerFetchingCamera(){Ar.getState().actions.triggerFetchingCamera()}async completeItemDrop(){await lt.getState().actions.completeDropItem()}revertItemDrop(){lt.getState().actions.revertDropItem()}getCameraFocusPointPosition(){return Ar.getState().focusPointPosition}sendAnalyticsPageViewedEvent(){}sendAnalyticsEvent(e){this.epigraphAnalytics!==null&&this.epigraphAnalytics.sendEvent(e)}isIosDevice(){return are}actionButtonClicked(e){this.fireEvent(this.EVENTS.SCENE.ActionButton_Clicked,{data:e.actionButton.data,skuID:e.skuID,count:e.count,price:e.price,countAvailable:e.countAvailable,countUnavailable:e.countUnavailable,currentVariant:e.currentVariant})}setCartMessage(e){this.fireEvent(this.EVENTS.SCENE.CartMessage_Update,{cartMessage:e})}}class UFe extends HTMLElement{#e="wc-epigraph-configurator-core";#n=!1;#t=void 0;#i=void 0;initialConfigId="";clientAccessKey="";gaCode="";builderMode=!1;projectId="";api=null;constructor(){super(),this.attachShadow({mode:"open"}),APe(new IR(this)),this.api=st}get identifier(){return this.#e}static get observedAttributes(){}get epigraphViewInYourSpaceRef(){return this.#t}#r(){this.hasAttribute("configurator-wc-id")&&(this.configuratorWcId=this.getAttribute("configurator-wc-id")),this.hasAttribute("initial-config-id")&&(this.initialConfigId=this.getAttribute("initial-config-id")),this.hasAttribute("client-access-key")&&(this.clientAccessKey=this.getAttribute("client-access-key")),this.hasAttribute("ga-code")&&(this.gaCode=this.getAttribute("ga-code")),this.hasAttribute("builder-mode")&&(this.builderMode=!0),Vt.group("Collected Web Component Attributes"),Vt.table({initialConfigId:this.initialConfigId,clientAccessKey:this.clientAccessKey,builderMode:this.builderMode}),Vt.groupEnd()}static get observedAttributes(){return["view-in-your-space-elem-id"]}attributeChangedCallback(e,t,n){if(this.#i||(this.#i=document.querySelector(`#${this.configuratorWcId}`)),!!this.#i)switch(e){case"view-in-your-space-elem-id":this.#t=this.#i.shadowRoot.querySelector(`#${n}`),Vt.warn({title:"ViewInYourSpace is now accessible from the core: "});break}}async#s(e){return new Promise(function(t,n){let i=new XMLHttpRequest;i.withCredentials=!1,i.open("GET","https://api.seeitinyourspace.com/auth/"+e),i.setRequestHeader("Content-Type","application/json"),i.onreadystatechange=function(){if(this.readyState===4){const a=JSON.parse(this.responseText);Vt.warn({title:a}),t(a)}},i.onerror=function(){n({status:this.status,statusText:i.statusText})},i.send()})}async connectedCallback(){if(this.#n===!0)return;this.#r();const e=await this.#s(this.clientAccessKey);this.validationPassed=e.passed,this.projectId=e.projectID,this.api.projectId=this.projectId,st.initializeAnalytics(this.gaCode);let t=Object.assign({},yFe);if(t.label=`Project ID: ${this.projectId}`,st.sendAnalyticsEvent(t),this.validationPassed==="false"){Vt.error({title:"Request from an invalidated source: "+window.location.href}),st.fireEvent("coreApi:failed");return}Vt.info({title:"VALIDATION SUCCESSFUL!"}),this.#n=!0,this.#i=document.querySelector(`#${this.configuratorWcId}`);let n=new URL(window.location).searchParams;n.has("epgsharedconfigid")&&(this.initialConfigId=n.get("epgsharedconfigid")),VU(this.shadowRoot).render(te(bke,{projectId:this.projectId,clientAccessKey:this.clientAccessKey,initialConfigId:this.initialConfigId,builderMode:this.builderMode,disableCart:this.hasAttribute("disable-cart")},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator-dev-env/epigraph-configurator-core/src/index.js",lineNumber:206,columnNumber:7},this))}disconnectedCallback(){st.fireEvent("coreApi:shutDown")}}const q6=document.createElement("template");q6.id="fullScreenModalTemplate";q6.innerHTML=`
9163
9163
  <style>
9164
9164
  .full-screen-modal-container {
9165
9165
  width: 100%;
@@ -9217,7 +9217,7 @@ ${i.join(`
9217
9217
  </slot>
9218
9218
  </div>
9219
9219
  </div>
9220
- `;class kFe extends HTMLElement{#e=void 0;#n=void 0;constructor(){super(),this.attachShadow({mode:"open"}),this.#t()}#t(){this.shadowRoot.appendChild(q6.content.cloneNode(!0)),this.#e=this.shadowRoot.querySelector("#fullScreenDialogContainer"),this.#n=this.shadowRoot.querySelector(".close-button"),this.#n.addEventListener("click",()=>{this.hide()})}show(){this.#e.classList.add("show")}hide(){this.#e.classList.remove("show")}}window.customElements.get("full-screen-modal")===void 0&&window.customElements.define("full-screen-modal",kFe);const X6=document.createElement("template");X6.id="viewInYourSpaceTemplate";X6.innerHTML=`
9220
+ `;class BFe extends HTMLElement{#e=void 0;#n=void 0;constructor(){super(),this.attachShadow({mode:"open"}),this.#t()}#t(){this.shadowRoot.appendChild(q6.content.cloneNode(!0)),this.#e=this.shadowRoot.querySelector("#fullScreenDialogContainer"),this.#n=this.shadowRoot.querySelector(".close-button"),this.#n.addEventListener("click",()=>{this.hide()})}show(){this.#e.classList.add("show")}hide(){this.#e.classList.remove("show")}}window.customElements.get("full-screen-modal")===void 0&&window.customElements.define("full-screen-modal",BFe);const X6=document.createElement("template");X6.id="viewInYourSpaceTemplate";X6.innerHTML=`
9221
9221
  <style>
9222
9222
  model-viewer
9223
9223
  {
@@ -9777,8 +9777,8 @@ ${i.join(`
9777
9777
  </div>
9778
9778
  </div>
9779
9779
  </full-screen-modal>
9780
- `;class FFe extends HTMLElement{#e="";#n="";#t="";#i="https://help.spreadsheetconverter.com/wp-content/uploads/2013/07/car-loan-amortization-mobile-qrcode.png";#r=void 0;#s=!1;#l=void 0;#a=void 0;constructor(){super(),this._modelViewerScriptSource="https://cdn.jsdelivr.net/npm/@google/model-viewer@2.x.x/dist/model-viewer.min.js",this._modelViewer=null,this._qrModalContainer=null,this.attachShadow({mode:"open"}),this._setupLaunchArDrawer(),this._setupQRModal(),this._setupViewInYourSpaceButton()}connectedCallback(){this._modelViewer.addEventListener("load",e=>{this._onModelLoadSuccess(e)}),this._modelViewer.addEventListener("error",e=>{this._onModelLoadFailure(e)}),this._viewInYourSpaceButton.addEventListener("click",e=>{this._onViewInYourSpaceButtonClicked(e)})}set coreApi(e){this.#r=e}get coreApi(){return this.#r}static get observedAttributes(){return["asset-src","debug","hide-button","launch-in-ar","core-api"]}get canLaunchAR(){return this._modelViewer.canActivateAR}attributeChangedCallback(e,t,n){switch(e){case"asset-src":this.#e=n;break;case"hide-button":break;case"launch-in-ar":if(!this.hasAttribute("launch-in-ar"))break;break;case"core-api":this.#r=this.getAttribute("core-api");break}this.syncModelViewerAttributes()}disconnectedCallback(){}syncModelViewerAttributes(){this._modelViewer.setAttribute("src",this.#e),this._modelViewer.setAttribute("ios-src",this.#n),this._modelViewer.style.display="none"}_setupViewInYourSpaceButton(){window.customElements.get("model-viewer")===void 0&&this._importModelViewer(),this.shadowRoot.appendChild(X6.content.cloneNode(!0)),this._fetchUsefulElements(),this.syncModelViewerAttributes(),this._modelViewer.addEventListener("ar-status",e=>{e.detail.status==="session-started"?(this._modelViewer.style.display="block",this.#s=!0):(e.detail.status==="not-presenting"||e.detail.status==="failed")&&(this._modelViewer.style.display="none",this.#s=!1)})}_importModelViewer(){this._modelViewerScriptElem=document.createElement("script"),this._modelViewerScriptElem.setAttribute("type","module"),this._modelViewerScriptElem.setAttribute("src",this._modelViewerScriptSource),this._modelViewerScriptElem.setAttribute("id","modelViewerScript"),document.head.appendChild(this._modelViewerScriptElem)}_setupQRModal(){this.shadowRoot.appendChild($6.content.cloneNode(!0)),this._qrModalContainer=this.shadowRoot.getElementById("qrModalContainer"),this._qrCodeImage=this.shadowRoot.querySelector("#qrCodeImage"),this._arLink=this.shadowRoot.querySelector("#arLink"),this._qrLoader=this.shadowRoot.getElementById("qrLoader"),this.shadowRoot.getElementById("doneViewInYourSpaceBtn").addEventListener("click",()=>{this._hideQRModal()}),this.shadowRoot.getElementById("qrModalCloseButton").addEventListener("click",()=>{this._hideQRModal()})}_setupLaunchArDrawer(){this.shadowRoot.appendChild(K6.content.cloneNode(!0)),this.arDrawer=this.shadowRoot.getElementById("arDrawer"),this.#l=this.shadowRoot.getElementById("launchARModalContainer"),this.#a=this.shadowRoot.getElementById("launchARModalDrawer"),this._launchARButton=this.shadowRoot.getElementById("launchARButton"),this._modelDownloadLoader=this.shadowRoot.getElementById("modelDownloadLoader"),this._launchARButton.addEventListener("click",()=>{this.#s!==!0&&this._launchAR()})}_showModelDownloadingLoader(){this._modelDownloadLoader.classList.remove("loader-hide")}_hideModelDownloadingLoader(){this._modelDownloadLoader.classList.add("loader-hide")}_showARModal(){this._disableLaunchARButton(),this.arDrawer.show()}_hideARModal(){this.arDrawer.hide()}_fetchUsefulElements(){this._modelViewer=this.shadowRoot.querySelector("model-viewer"),this._viewInYourSpaceButton=this.shadowRoot.querySelector(".viewInYourSpaceButton")}_showQRModal(){this._qrModalContainer.classList.remove("qrModalHide")}_hideQRModal(){this._qrModalContainer.classList.add("qrModalHide")}_onModelLoadSuccess(){}_onModelLoadFailure(e){console.error(`[VIEW-IN-YOUR-SPACE ERROR]: Asset load Errors!!
9781
- Make sure that the URL provided for the asset to be loaded is correct.`),console.error("==============================================================="),console.error(e),console.error("===============================================================")}_onViewInYourSpaceButtonClicked(e){this.canLaunchAR?this._prepareToLaunchAR():this._launchQRModal()}async wait(e){return new Promise((t,n)=>{setTimeout(()=>{t(!0)},e)})}async _prepareToLaunchAR(e){this._showARModal(),await this.wait(1e3),this.#r.isIosDevice()?(this.#n=await this.#r.getSceneAsUsdzUrl(),this.#e="https://storage.googleapis.com/epigraph-configurator/configurator-lite/assets/common/3d-assets/proxies/null-product-proxy.glb"):this.#e=await this.#r.getSceneAsGlbUrl(),this.syncModelViewerAttributes(),this._enableLaunchARButton()}_enableLaunchARButton(){this._launchARButton.disabled=!1,this._hideModelDownloadingLoader()}_disableLaunchARButton(){this._launchARButton.disabled=!0,this._showModelDownloadingLoader()}_launchAR(){this._modelViewer.activateAR()}_showQRLoader(){this._qrLoader.classList.remove("loader-hide")}_hideQRLoader(){this._qrLoader.classList.add("loader-hide")}async _launchQRModal(){if(this._qrCodeImage.classList.add("img-hide"),this._qrCodeImage.setAttribute("src",""),this._showQRLoader(),this._showQRModal(),this.#i=await this._getShareableLinkAsQR(),!this.#i){console.error("[VIEW-IN-YOUR-SPACE:Error] Cannot launch QR modal with no qrSrc.");return}this._qrCodeImage.setAttribute("src",this.#i),this._qrCodeImage.classList.remove("img-hide"),this._hideQRLoader()}async getQRForURL(e){return new Promise(function(t,n){let i={qrdata:e};i=JSON.stringify(i);const a=new XMLHttpRequest;a.withCredentials=!1,a.open("PUT","https://api.seeitinyourspace.com/qr"),a.setRequestHeader("Content-Type","application/json"),a.onreadystatechange=function(){if(this.readyState===4){let s=this.responseText;try{t(s)}catch(o){n({status:o})}}},a.onerror=function(){n({status:this.status,statusText:a.statusText})},a.send(i)})}async _getShareableLinkAsQR(){return this.#t=await this.#r.generateShareableLink(!0),await this.getQRForURL(this.#t)}}const zFe={}.VITE_APP_EPIGRAPHLOGGER_SCRIPT_SRC,sre=document.createElement("template");sre.innerHTML=`
9780
+ `;class kFe extends HTMLElement{#e="";#n="";#t="";#i="https://help.spreadsheetconverter.com/wp-content/uploads/2013/07/car-loan-amortization-mobile-qrcode.png";#r=void 0;#s=!1;#l=void 0;#a=void 0;constructor(){super(),this._modelViewerScriptSource="https://cdn.jsdelivr.net/npm/@google/model-viewer@2.x.x/dist/model-viewer.min.js",this._modelViewer=null,this._qrModalContainer=null,this.attachShadow({mode:"open"}),this._setupLaunchArDrawer(),this._setupQRModal(),this._setupViewInYourSpaceButton()}connectedCallback(){this._modelViewer.addEventListener("load",e=>{this._onModelLoadSuccess(e)}),this._modelViewer.addEventListener("error",e=>{this._onModelLoadFailure(e)}),this._viewInYourSpaceButton.addEventListener("click",e=>{this._onViewInYourSpaceButtonClicked(e)})}set coreApi(e){this.#r=e}get coreApi(){return this.#r}static get observedAttributes(){return["asset-src","debug","hide-button","launch-in-ar","core-api"]}get canLaunchAR(){return this._modelViewer.canActivateAR}attributeChangedCallback(e,t,n){switch(e){case"asset-src":this.#e=n;break;case"hide-button":break;case"launch-in-ar":if(!this.hasAttribute("launch-in-ar"))break;break;case"core-api":this.#r=this.getAttribute("core-api");break}this.syncModelViewerAttributes()}disconnectedCallback(){}syncModelViewerAttributes(){this._modelViewer.setAttribute("src",this.#e),this._modelViewer.setAttribute("ios-src",this.#n),this._modelViewer.style.display="none"}_setupViewInYourSpaceButton(){window.customElements.get("model-viewer")===void 0&&this._importModelViewer(),this.shadowRoot.appendChild(X6.content.cloneNode(!0)),this._fetchUsefulElements(),this.syncModelViewerAttributes(),this._modelViewer.addEventListener("ar-status",e=>{e.detail.status==="session-started"?(this._modelViewer.style.display="block",this.#s=!0):(e.detail.status==="not-presenting"||e.detail.status==="failed")&&(this._modelViewer.style.display="none",this.#s=!1)})}_importModelViewer(){this._modelViewerScriptElem=document.createElement("script"),this._modelViewerScriptElem.setAttribute("type","module"),this._modelViewerScriptElem.setAttribute("src",this._modelViewerScriptSource),this._modelViewerScriptElem.setAttribute("id","modelViewerScript"),document.head.appendChild(this._modelViewerScriptElem)}_setupQRModal(){this.shadowRoot.appendChild($6.content.cloneNode(!0)),this._qrModalContainer=this.shadowRoot.getElementById("qrModalContainer"),this._qrCodeImage=this.shadowRoot.querySelector("#qrCodeImage"),this._arLink=this.shadowRoot.querySelector("#arLink"),this._qrLoader=this.shadowRoot.getElementById("qrLoader"),this.shadowRoot.getElementById("doneViewInYourSpaceBtn").addEventListener("click",()=>{this._hideQRModal()}),this.shadowRoot.getElementById("qrModalCloseButton").addEventListener("click",()=>{this._hideQRModal()})}_setupLaunchArDrawer(){this.shadowRoot.appendChild(K6.content.cloneNode(!0)),this.arDrawer=this.shadowRoot.getElementById("arDrawer"),this.#l=this.shadowRoot.getElementById("launchARModalContainer"),this.#a=this.shadowRoot.getElementById("launchARModalDrawer"),this._launchARButton=this.shadowRoot.getElementById("launchARButton"),this._modelDownloadLoader=this.shadowRoot.getElementById("modelDownloadLoader"),this._launchARButton.addEventListener("click",()=>{this.#s!==!0&&this._launchAR()})}_showModelDownloadingLoader(){this._modelDownloadLoader.classList.remove("loader-hide")}_hideModelDownloadingLoader(){this._modelDownloadLoader.classList.add("loader-hide")}_showARModal(){this._disableLaunchARButton(),this.arDrawer.show()}_hideARModal(){this.arDrawer.hide()}_fetchUsefulElements(){this._modelViewer=this.shadowRoot.querySelector("model-viewer"),this._viewInYourSpaceButton=this.shadowRoot.querySelector(".viewInYourSpaceButton")}_showQRModal(){this._qrModalContainer.classList.remove("qrModalHide")}_hideQRModal(){this._qrModalContainer.classList.add("qrModalHide")}_onModelLoadSuccess(){}_onModelLoadFailure(e){console.error(`[VIEW-IN-YOUR-SPACE ERROR]: Asset load Errors!!
9781
+ Make sure that the URL provided for the asset to be loaded is correct.`),console.error("==============================================================="),console.error(e),console.error("===============================================================")}_onViewInYourSpaceButtonClicked(e){this.canLaunchAR?this._prepareToLaunchAR():this._launchQRModal()}async wait(e){return new Promise((t,n)=>{setTimeout(()=>{t(!0)},e)})}async _prepareToLaunchAR(e){this._showARModal(),await this.wait(1e3),this.#r.isIosDevice()?(this.#n=await this.#r.getSceneAsUsdzUrl(),this.#e="https://storage.googleapis.com/epigraph-configurator/configurator-lite/assets/common/3d-assets/proxies/null-product-proxy.glb"):this.#e=await this.#r.getSceneAsGlbUrl(),this.syncModelViewerAttributes(),this._enableLaunchARButton()}_enableLaunchARButton(){this._launchARButton.disabled=!1,this._hideModelDownloadingLoader()}_disableLaunchARButton(){this._launchARButton.disabled=!0,this._showModelDownloadingLoader()}_launchAR(){this._modelViewer.activateAR()}_showQRLoader(){this._qrLoader.classList.remove("loader-hide")}_hideQRLoader(){this._qrLoader.classList.add("loader-hide")}async _launchQRModal(){if(this._qrCodeImage.classList.add("img-hide"),this._qrCodeImage.setAttribute("src",""),this._showQRLoader(),this._showQRModal(),this.#i=await this._getShareableLinkAsQR(),!this.#i){console.error("[VIEW-IN-YOUR-SPACE:Error] Cannot launch QR modal with no qrSrc.");return}this._qrCodeImage.setAttribute("src",this.#i),this._qrCodeImage.classList.remove("img-hide"),this._hideQRLoader()}async getQRForURL(e){return new Promise(function(t,n){let i={qrdata:e};i=JSON.stringify(i);const a=new XMLHttpRequest;a.withCredentials=!1,a.open("PUT","https://api.seeitinyourspace.com/qr"),a.setRequestHeader("Content-Type","application/json"),a.onreadystatechange=function(){if(this.readyState===4){let s=this.responseText;try{t(s)}catch(o){n({status:o})}}},a.onerror=function(){n({status:this.status,statusText:a.statusText})},a.send(i)})}async _getShareableLinkAsQR(){return this.#t=await this.#r.generateShareableLink(!0),await this.getQRForURL(this.#t)}}const FFe={}.VITE_APP_EPIGRAPHLOGGER_SCRIPT_SRC,sre=document.createElement("template");sre.innerHTML=`
9782
9782
  <style>
9783
9783
  .preload-main-container{
9784
9784
  width: 100%;
@@ -9924,4 +9924,4 @@ ${i.join(`
9924
9924
  There was a problem while trying to initialise the configurator.
9925
9925
  </div>
9926
9926
  </div>
9927
- `;class GFe extends HTMLElement{#e=void 0;clientAccessKey=null;validationPassed=!1;projectID="";configID="default";gaCode="";#n=!1;#t=void 0;api={core:null,ui:null};constructor(){super(),this.api.ui=this,this.attachShadow({mode:"open"}),this.#i(),this.#r()}#i(){this.preloadDiv=document.createElement("div"),this.preloadDiv.id="preloadMainContainer",this.preloadDiv.classList.add("preload-main-container"),this.preloadDiv.classList.add("showPreload"),this.preloadDiv.appendChild(sre.content.cloneNode(!0)),this.preloadDiv.appendChild(ore.content.cloneNode(!0)),this.shadowRoot.appendChild(this.preloadDiv)}#r(){this.hiccupUi=document.createElement("div"),this.hiccupUi.id="hiccupMainContainer",this.hiccupUi.classList.add("hiccup-ui-main-container"),this.hiccupUi.appendChild(lre.content.cloneNode(!0)),this.hiccupUi.appendChild(cre.content.cloneNode(!0)),this.shadowRoot.appendChild(this.hiccupUi)}#s(){window.customElements.define("epigraph-configurator-core",BFe)}#l(){window.customElements.define("view-in-your-space",FFe)}#a(){this._epigraphLoggerScriptElem=document.createElement("script"),this._epigraphLoggerScriptElem.setAttribute("src",zFe),this._epigraphLoggerScriptElem.setAttribute("id","epigraphLoggerScript"),document.head.appendChild(this._epigraphLoggerScriptElem),this._epigraphLoggerScriptElem.addEventListener("load",()=>{})}get configuratorWcId(){return this.#e}#o(){this.hasAttribute("id")?this.#e=this.getAttribute("id"):(this.setAttribute("id","epigraphConfiguratorWc"),this.#e=this.getAttribute("id")),this.hasAttribute("ga-code")&&(this.gaCode=this.getAttribute("ga-code")),this.clientAccessKey=this.getAttribute("client-access-key"),this.initialConfigId=this.getAttribute("initial-config-id"),this.initialConfigId||(this.initialConfigId="default")}async connectedCallback(){if(this.#n===!0){console.warn("Tried to remount configurator. Blocking the process.");return}this.#o(),this.#s(),console.log("Imported core"),this.#l(),console.log("Imported VIYS"),this.style.maxWidth="1440px",this.style.maxHeight="800px",this.style.overflow="hidden",this.style.width="100%",this.style.height="100%",this.style.position="relative",this.style.visibility="visible",this.style.display="flex";const e=document.createElement("div");e.id="configuratorContainer",e.style.width="100%",e.style.height="100%",e.style.userSelect="none",e.style.overflow="hidden",this.shadowRoot.appendChild(e),VU(e).render(te(YOe,{disableUI:this.hasAttribute("disable-ui"),launchInAR:this.hasAttribute("launch-in-ar"),disableCart:this.hasAttribute("disable-cart"),gaCode:this.gaCode,configuratorWcRef:this},"Configurator-App",!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator-dev-env/epigraph-configurator/src/index.js",lineNumber:357,columnNumber:7},this)),this.#n=!0}showPreloadScreen(){this.preloadDiv.classList.remove("no-pointer-events"),this.preloadDiv.classList.add("showPreload")}async hidePreloadScreen(){this.preloadDiv.classList.remove("showPreload"),await dX(1e3),this.preloadDiv.classList.add("no-pointer-events")}showHiccupScreen(){this.hiccupUi.classList.remove("no-pointer-events"),this.hiccupUi.classList.add("show-hiccup")}async hideHiccupScreen(){this.hiccupUi.classList.remove("show-hiccup"),await dX(1e3),this.hiccupUi.classList.add("no-pointer-events")}}window.customElements.define("epigraph-configurator",GFe);
9927
+ `;class zFe extends HTMLElement{#e=void 0;clientAccessKey=null;validationPassed=!1;projectID="";configID="default";gaCode="";#n=!1;#t=void 0;api={core:null,ui:null};constructor(){super(),this.api.ui=this,this.attachShadow({mode:"open"}),this.#i(),this.#r()}#i(){this.preloadDiv=document.createElement("div"),this.preloadDiv.id="preloadMainContainer",this.preloadDiv.classList.add("preload-main-container"),this.preloadDiv.classList.add("showPreload"),this.preloadDiv.appendChild(sre.content.cloneNode(!0)),this.preloadDiv.appendChild(ore.content.cloneNode(!0)),this.shadowRoot.appendChild(this.preloadDiv)}#r(){this.hiccupUi=document.createElement("div"),this.hiccupUi.id="hiccupMainContainer",this.hiccupUi.classList.add("hiccup-ui-main-container"),this.hiccupUi.appendChild(lre.content.cloneNode(!0)),this.hiccupUi.appendChild(cre.content.cloneNode(!0)),this.shadowRoot.appendChild(this.hiccupUi)}#s(){window.customElements.define("epigraph-configurator-core",UFe)}#l(){window.customElements.define("view-in-your-space",kFe)}#a(){this._epigraphLoggerScriptElem=document.createElement("script"),this._epigraphLoggerScriptElem.setAttribute("src",FFe),this._epigraphLoggerScriptElem.setAttribute("id","epigraphLoggerScript"),document.head.appendChild(this._epigraphLoggerScriptElem),this._epigraphLoggerScriptElem.addEventListener("load",()=>{})}get configuratorWcId(){return this.#e}#o(){this.hasAttribute("id")?this.#e=this.getAttribute("id"):(this.setAttribute("id","epigraphConfiguratorWc"),this.#e=this.getAttribute("id")),this.hasAttribute("ga-code")&&(this.gaCode=this.getAttribute("ga-code")),this.clientAccessKey=this.getAttribute("client-access-key"),this.initialConfigId=this.getAttribute("initial-config-id"),this.initialConfigId||(this.initialConfigId="default")}async connectedCallback(){if(this.#n===!0){console.warn("Tried to remount configurator. Blocking the process.");return}this.#o(),this.#s(),console.log("Imported core"),this.#l(),console.log("Imported VIYS"),this.style.maxWidth="1440px",this.style.maxHeight="800px",this.style.overflow="hidden",this.style.width="100%",this.style.height="100%",this.style.position="relative",this.style.visibility="visible",this.style.display="flex";const e=document.createElement("div");e.id="configuratorContainer",e.style.width="100%",e.style.height="100%",e.style.userSelect="none",e.style.overflow="hidden",this.shadowRoot.appendChild(e),VU(e).render(te(YOe,{disableUI:this.hasAttribute("disable-ui"),launchInAR:this.hasAttribute("launch-in-ar"),disableCart:this.hasAttribute("disable-cart"),gaCode:this.gaCode,configuratorWcRef:this},"Configurator-App",!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator-dev-env/epigraph-configurator/src/index.js",lineNumber:357,columnNumber:7},this)),this.#n=!0}showPreloadScreen(){this.preloadDiv.classList.remove("no-pointer-events"),this.preloadDiv.classList.add("showPreload")}async hidePreloadScreen(){this.preloadDiv.classList.remove("showPreload"),await dX(1e3),this.preloadDiv.classList.add("no-pointer-events")}showHiccupScreen(){this.hiccupUi.classList.remove("no-pointer-events"),this.hiccupUi.classList.add("show-hiccup")}async hideHiccupScreen(){this.hiccupUi.classList.remove("show-hiccup"),await dX(1e3),this.hiccupUi.classList.add("no-pointer-events")}}window.customElements.define("epigraph-configurator",zFe);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/configurator",
3
- "version": "1.7.6-alpha",
3
+ "version": "1.7.7-alpha",
4
4
  "description": "Epigraph Configurator web component.",
5
5
  "keywords": [],
6
6
  "main": "./dist/index.js",