@epigraph/configurator 1.7.0 → 1.7.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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  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 OFe=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null;OFe&&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 rre=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,LFe=!!(window.webkit&&window.webkit.messageHandlers);(()=>{if(rre){if(LFe)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 PFe={}.VITE_APP_AR_PAGE_BASE_URL;class IR{static instanceSingleton=void 0;#e=!1;#i;#t;#n;#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.#n=e,this.#t=t,this.#n.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.#n}getResolvedAssetUrl(e){return YPe(e)}initializeAnalytics(e=void 0){e!==void 0&&(this.epigraphAnalytics=new gFe,this.epigraphAnalytics.addEventPlugin(new mFe(e,!1)))}get isReady(){return this.#e}get preloadProgress(){return this.#i}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({},yFe);t.label=`Project ID: ${this.#l}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener("coreApi:failed",e=>{let t=Object.assign({},AFe);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({},MFe);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({},CFe);n.label=`Item Removed: ${t}`,this.sendAnalyticsEvent(n)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Enter,e=>{let t=Object.assign({},NFe);t.label=`Hotspot Enter: ${e.data.hotspotAbsID}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Exit,e=>{let t=Object.assign({},DFe);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({},EFe);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 oFe(),this.#h=!1,this.#c)}async getSceneAsUsdzUrl(){return this.#h===!1?this.#u:(URL.revokeObjectURL(this.#u),this.#u=void 0,this.#u=await sFe(),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 GPe(a);this.#o=await s.text()}const t=e===!0?PFe: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({},X$);return i.label=`Shared URL: ${n}`,this.sendAnalyticsEvent(i),n.href}closeContextMenu(){Yt.getState().selectedItemData&&Yt.getState().actions.deselectItem()}updatePreloadProgress(e){const t=this.#i;this.#i=e;const n=new CustomEvent("preload:update",{detail:{progress:this.#i}});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(){oi.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({},SFe);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({},q$);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({},q$);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({},xFe);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({},wFe);e.label="AR Requested",this.sendAnalyticsEvent(e),this.#n.epigraphViewInYourSpaceRef._onViewInYourSpaceButtonClicked()}async shareScene(){const e=await this.generateShareableLink();let t=Object.assign({},X$);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({},TFe);e.label="Scene Restarted",this.sendAnalyticsEvent(e)}areDimensionsVisible(){return lt.getState().showDimensions}getActiveHotspot(){return oi.getState().activeHotspotData}reviewCartShown(){let e=Object.assign({},bFe);e.label="Review Cart shown",this.sendAnalyticsEvent(e)}reviewCartHidden(){let e=Object.assign({},_Fe);e.label="Review Cart hidden",this.sendAnalyticsEvent(e)}showDimensions(){lt.setState({showDimensions:!0});let e=Object.assign({},RFe);e.label="Dimensions shown",this.sendAnalyticsEvent(e)}hideDimensions(){lt.setState({showDimensions:!1});let e=Object.assign({},IFe);e.label="Dimensions hidden",this.sendAnalyticsEvent(e)}areHotspotsVisible(){return oi.getState().hotspotsVisibility}areHotspotsTemporarilyVisible(){return oi.getState().hotspotsTempVisibility}showAllHotspots(e=!1){oi.getState().actions.switchHotspotsVisibility(!0,e)}hideAllHotspots(e=!1){oi.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){oi.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 rre}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";#i=!1;#t=void 0;#n=void 0;initialConfigId="";clientAccessKey="";gaCode="";builderMode=!1;projectId="";api=null;constructor(){super(),this.attachShadow({mode:"open"}),yPe(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.#n||(this.#n=document.querySelector(`#${this.configuratorWcId}`)),!!this.#n)switch(e){case"view-in-your-space-elem-id":this.#t=this.#n.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.#i===!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({},vFe);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.#i=!0,this.#n=document.querySelector(`#${this.configuratorWcId}`);let n=new URL(window.location).searchParams;n.has("epgsharedconfigid")&&(this.initialConfigId=n.get("epgsharedconfigid")),VU(this.shadowRoot).render(ee(Ake,{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="viewInYourSpaceTemplate";q6.innerHTML=`
9162
+ */const OFe=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null;OFe&&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 rre=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,LFe=!!(window.webkit&&window.webkit.messageHandlers);(()=>{if(rre){if(LFe)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 PFe="https://configurator.myepigraph.com/";class IR{static instanceSingleton=void 0;#e=!1;#i;#t;#n;#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.#n=e,this.#t=t,this.#n.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.#n}getResolvedAssetUrl(e){return YPe(e)}initializeAnalytics(e=void 0){e!==void 0&&(this.epigraphAnalytics=new gFe,this.epigraphAnalytics.addEventPlugin(new mFe(e,!1)))}get isReady(){return this.#e}get preloadProgress(){return this.#i}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({},yFe);t.label=`Project ID: ${this.#l}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener("coreApi:failed",e=>{let t=Object.assign({},AFe);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({},MFe);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({},CFe);n.label=`Item Removed: ${t}`,this.sendAnalyticsEvent(n)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Enter,e=>{let t=Object.assign({},NFe);t.label=`Hotspot Enter: ${e.data.hotspotAbsID}`,this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Exit,e=>{let t=Object.assign({},DFe);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({},EFe);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 oFe(),this.#h=!1,this.#c)}async getSceneAsUsdzUrl(){return this.#h===!1?this.#u:(URL.revokeObjectURL(this.#u),this.#u=void 0,this.#u=await sFe(),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 GPe(a);this.#o=await s.text()}const t=e===!0?PFe: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({},X$);return i.label=`Shared URL: ${n}`,this.sendAnalyticsEvent(i),n.href}closeContextMenu(){Yt.getState().selectedItemData&&Yt.getState().actions.deselectItem()}updatePreloadProgress(e){const t=this.#i;this.#i=e;const n=new CustomEvent("preload:update",{detail:{progress:this.#i}});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(){oi.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({},SFe);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({},q$);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({},q$);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({},xFe);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({},wFe);e.label="AR Requested",this.sendAnalyticsEvent(e),this.#n.epigraphViewInYourSpaceRef._onViewInYourSpaceButtonClicked()}async shareScene(){const e=await this.generateShareableLink();let t=Object.assign({},X$);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({},TFe);e.label="Scene Restarted",this.sendAnalyticsEvent(e)}areDimensionsVisible(){return lt.getState().showDimensions}getActiveHotspot(){return oi.getState().activeHotspotData}reviewCartShown(){let e=Object.assign({},bFe);e.label="Review Cart shown",this.sendAnalyticsEvent(e)}reviewCartHidden(){let e=Object.assign({},_Fe);e.label="Review Cart hidden",this.sendAnalyticsEvent(e)}showDimensions(){lt.setState({showDimensions:!0});let e=Object.assign({},RFe);e.label="Dimensions shown",this.sendAnalyticsEvent(e)}hideDimensions(){lt.setState({showDimensions:!1});let e=Object.assign({},IFe);e.label="Dimensions hidden",this.sendAnalyticsEvent(e)}areHotspotsVisible(){return oi.getState().hotspotsVisibility}areHotspotsTemporarilyVisible(){return oi.getState().hotspotsTempVisibility}showAllHotspots(e=!1){oi.getState().actions.switchHotspotsVisibility(!0,e)}hideAllHotspots(e=!1){oi.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){oi.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 rre}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";#i=!1;#t=void 0;#n=void 0;initialConfigId="";clientAccessKey="";gaCode="";builderMode=!1;projectId="";api=null;constructor(){super(),this.attachShadow({mode:"open"}),yPe(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.#n||(this.#n=document.querySelector(`#${this.configuratorWcId}`)),!!this.#n)switch(e){case"view-in-your-space-elem-id":this.#t=this.#n.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.#i===!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({},vFe);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.#i=!0,this.#n=document.querySelector(`#${this.configuratorWcId}`);let n=new URL(window.location).searchParams;n.has("epgsharedconfigid")&&(this.initialConfigId=n.get("epgsharedconfigid")),VU(this.shadowRoot).render(ee(Ake,{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="viewInYourSpaceTemplate";q6.innerHTML=`
9163
9163
  <style>
9164
9164
  model-viewer
9165
9165
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/configurator",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Epigraph Configurator web component.",
5
5
  "keywords": [],
6
6
  "main": "./dist/index.js",