PageSourceSearch

https://www.blgcloud.fr/dist/modules/Checkout-Shipping-js-deliveryTimes-deliveryTimes-js.js

js blgcloud.fr collected 2026-10-01 16:29:36 UTC 3,055 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1910],{68021(t,i,e){e.r(i),e.d(i,{DeliveryTimesManager:()=>s});class s{constructor(t){this._apiClient=t._apiClient,this._shippingGroups=t._shippingGroups,this._moduleConfig=t.config,this._modulejsData=t._data.jsData,this._DOMElement=t._root.find(".js-delivery-times-block")}get apiClient(){return this._apiClient}get shippingGroups(){return this._shippingGroups}get config(){return this._moduleConfig}get jsData(){return this._modulejsData}get DOMElement(){return this._DOMElement}async refresh(t){this._shippingGroups=t._shippingGroups,this._modulejsData=t._data.jsData,await this.manageDeliveryTimes()}async manageDeliveryTimes(){if(!this._allGroupsOnSite())return void this._displayAndDispatchEvent();if(!this._allSameSite())return void this._displayAndDispatchEvent();const t=this._getCorrespondingWarehouse();if(!t)return void this._displayAndDispatchEvent();const[i,e]=await Promise.all([this._checkPartsStock(t),this._checkEquipmentsStock(t)]);this._displayAndDispatchEvent(i,e)}_dispatchDeliveryTimesEvent(t,i){const e=new CustomEvent("deliveryTimesInfos",{detail:{state:t&&i}});document.querySelector(".js-delivery-times-block").dispatchEvent(e)}_allGroupsOnSite(){return this.shippingGroups.every(t=>"onSite"===t.deliveryMean)}_allSameSite(){let t=!0;for(let i=0;i<=this.shippingGroups.length;i++)if(this.shippingGroups[i+1]&&this.shippingGroups[i].currentSite.id!==this.shippingGroups[i+1].currentSite.id){t=!1;break}return t}_getCorrespondingWarehouse(){const t=this.shippingGroups[0].currentSite.tags?.find(t=>this.config.deliveryTimesInfos.warehouseTags.includes(t.tag.name))?.tag.name;return this.jsData.warehouses?.find(i=>i.owner.tags.some(i=>i.tag.name===t))}async _checkPartsStock(t){const i=this.shippingGroups.find(t=>"__parts"===t.key);if(!i)return!0;const e=i.allRelatedQuoteLines,s=await this._apiClient.listObjects("article/partStock",{filter:{part:{id:{$in:e.map(t=>t.article?.id)}},warehouse:{id:t.id}},field:["part","quantity","warehouse.owner"]});let n=!0;for(const t of e){const i=t.quantity;if((s.find(i=>i.part["@id"]===t.article?.id)?.quantity||0)<i){n=!1;break}}return n}async _checkEquipmentsStock(t){const i=this.shippingGroups.filter(t=>"__parts"!==t.key);if(!i.length)return!0;const e=i.flatMap(t=>t.allRelatedQuoteLines.map(t=>t.article?.id)),s=t.owner.id,n=await this.apiClient.listObjects("article/part",{filter:{id:{$in:e}},filteredJoin:{stocks:{baseJoin:"equipments",filter:{internalTag:"normal",$and:[{$or:[{context:{name:"new"}},{$and:[{context:{name:"inPreparation"}},{acquisitionStatus:"new"}]}]},{$or:[{location:{id:s}},{location:{$isNull:!0},owner:{id:s}}]}]},count:!0}},field:["id"]});let a=!0;for(const t of i.flatMap(t=>t.allRelatedQuoteLines)){const i=t.quantity;if((n.find(i=>i.id===t.article?.id)?.stocks||0)<i){a=!1;break}}return a}_displayAndDispatchEvent(t=!1,i=!1){this.DOMElement.toggleClass("hidden",!t||!i),this._dispatchDeliveryTimesEvent(t,i)}}}}]);
2//# sourceMappingURL=Checkout-Shipping-js-deliveryTimes-deliveryTimes-js.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.