mealz-components 2.2.0 → 2.3.0
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.
- package/dist/accordion/accordion.css +1 -1
- package/dist/assets/{OperatorSubscriber-B37s2U6v.js → OperatorSubscriber-DF1TYu__.js} +1 -1
- package/dist/assets/accordion-la5mVBfL.js +19 -0
- package/dist/assets/{async-guWcMFmJ.js → async-D5WN8Wfc.js} +1 -1
- package/dist/assets/{combineLatest-qLpwa5de.js → combineLatest-BN0_WcEG.js} +1 -1
- package/dist/assets/{debounceTime-cu8WlLF0.js → debounceTime-D7R6Z3Am.js} +1 -1
- package/dist/assets/delay-wUm-cx7a.js +1 -0
- package/dist/assets/{distinctUntilChanged-DmoT2we5.js → distinctUntilChanged-VvZTmHoN.js} +1 -1
- package/dist/assets/empty-Bs9kqCuA.js +1 -0
- package/dist/assets/{executeSchedule-Dqc6shOu.js → executeSchedule-C0acKsif.js} +1 -1
- package/dist/assets/{filter-BjN-BbQD.js → filter-DQ4vwAGj.js} +1 -1
- package/dist/assets/{from-CEPL7XsE.js → from-BTlWkhKh.js} +1 -1
- package/dist/assets/{innerFrom-D8hyVDmo.js → innerFrom-FMZwm2mb.js} +1 -1
- package/dist/assets/{map-D6X2syNu.js → map-DHslluWD.js} +1 -1
- package/dist/assets/mapOneOrManyArgs-Bdu6mo6S.js +1 -0
- package/dist/assets/merge-tdU3EgEI.js +1 -0
- package/dist/assets/mergeAll-DTkL1sF8.js +1 -0
- package/dist/assets/{mergeMap-CX64J-ac.js → mergeMap-g-JGW99j.js} +1 -1
- package/dist/assets/{no-shadow-element-D4NOg0uW.js → no-shadow-element-Dz9jgDtr.js} +7 -7
- package/dist/assets/{of-CzgrATec.js → of-hd4MpK5g.js} +1 -1
- package/dist/assets/{price-DdIbni0N.js → price-CHipCs2z.js} +1 -1
- package/dist/assets/{product-card-CcuyZyd6.js → product-card-c_0I2Lp_.js} +14 -14
- package/dist/assets/{promotion-badge-TYkTBrOQ.js → promotion-badge-CzwsPJJq.js} +3 -3
- package/dist/assets/{property-BXNy7Yd-.js → property-Bx8Yvr4_.js} +1 -1
- package/dist/assets/skip-BuAl4dWz.js +1 -0
- package/dist/assets/{skipWhile-B_4e7jSH.js → skipWhile-BzDgmir5.js} +1 -1
- package/dist/assets/{state-b8IyfZUU.js → state-C5zM4-Pq.js} +1 -1
- package/dist/assets/{switchMap-BYsewftM.js → switchMap-6Z80ObHE.js} +1 -1
- package/dist/assets/{take-ujVMxFwY.js → take-ByPtGQky.js} +1 -1
- package/dist/assets/{tap-DwBV-qFl.js → tap-K_D6lo97.js} +1 -1
- package/dist/assets/{timer-D3X0vtFO.js → timer-C3uKg-qK.js} +1 -1
- package/dist/assets/{unsafe-html-C8GMyVYZ.js → unsafe-html-Bv_ydUHb.js} +1 -1
- package/dist/assets/{viewport-listener-BRwa66-G.js → viewport-listener-DrFhSZNW.js} +1 -1
- package/dist/basket-transfer-modal/basket-transfer-modal.min.js +12 -13
- package/dist/catalog/basket-preview/basket-preview-product/basket-preview-product.css +1 -1
- package/dist/catalog/basket-preview/basket-preview.css +1 -1
- package/dist/catalog/basket-preview/basket-preview.min.js +48 -43
- package/dist/catalog/catalog-category/catalog-category.min.js +1 -1
- package/dist/catalog/catalog-favorites/catalog-favorites.min.js +1 -1
- package/dist/catalog/catalog-history/catalog-history.min.js +1 -1
- package/dist/catalog/catalog-home/catalog-home.min.js +1 -1
- package/dist/catalog/catalog-list/catalog-list.min.js +1 -1
- package/dist/catalog/catalog-load-more.min.js +1 -1
- package/dist/catalog/catalog-tabs/catalog-tabs.min.js +1 -1
- package/dist/catalog/catalog-toolbar/catalog-toolbar.min.js +1 -1
- package/dist/catalog/my-meals-button/my-meals-button.min.js +1 -1
- package/dist/counter/counter.min.js +1 -1
- package/dist/drawer/drawer.min.js +1 -1
- package/dist/drawer-view-swapper/drawer-view-swapper.css +1 -1
- package/dist/drawer-view-swapper/drawer-view-swapper.min.js +24 -20
- package/dist/history-drawer/history-drawer.min.js +1 -1
- package/dist/history-order/history-order.min.js +1 -1
- package/dist/history-order-expanded/history-order-expanded.min.js +1 -1
- package/dist/last-order-badge/last-order-badge.min.js +2 -2
- package/dist/last-order-modal/last-order-modal.min.js +1 -1
- package/dist/like-button/like-button.min.js +1 -1
- package/dist/modal/modal.min.js +1 -1
- package/dist/no-supplier-add-to-cart-cta/no-supplier-add-to-cart-cta.css +1 -0
- package/dist/no-supplier-add-to-cart-cta/no-supplier-add-to-cart-cta.min.js +7 -0
- package/dist/onboarding/onboarding.min.js +2 -2
- package/dist/order-again/order-again.min.js +1 -1
- package/dist/planner/helpers/open-onboarding-modal.min.js +1 -1
- package/dist/planner/planner-abandon-modal/planner-abandon-modal.min.js +1 -1
- package/dist/planner/planner-budget-edit-modal/planner-budget-edit-modal.css +1 -1
- package/dist/planner/planner-budget-edit-modal/planner-budget-edit-modal.min.js +6 -6
- package/dist/planner/planner-budget-gauge/planner-budget-gauge.css +1 -1
- package/dist/planner/planner-budget-gauge/planner-budget-gauge.min.js +1 -1
- package/dist/planner/planner-catalog/planner-catalog.min.js +2 -2
- package/dist/planner/planner-current-menu/planner-current-menu.min.js +1 -1
- package/dist/planner/planner-current-menu-modal/planner-current-menu-modal.min.js +1 -1
- package/dist/planner/planner-dashboard/planner-dashboard.min.js +1 -1
- package/dist/planner/planner-form/planner-form.min.js +1 -1
- package/dist/planner/planner-menu-option/planner-menu-option.min.js +1 -1
- package/dist/planner/planner-onboarding/planner-onboarding.min.js +1 -1
- package/dist/planner/planner-onboarding-modal/planner-onboarding-modal.min.js +6 -6
- package/dist/planner/planner-open-catalog-modal/planner-open-catalog-modal.min.js +1 -1
- package/dist/planner/planner-recipe-card/planner-recipe-card.min.js +1 -1
- package/dist/planner/planner-recipe-list/planner-recipe-list.min.js +1 -1
- package/dist/planner/planner-recipe-suggestion/planner-recipe-suggestion.min.js +1 -1
- package/dist/planner/planner-welcome-modal/planner-welcome-modal.min.js +2 -2
- package/dist/planner/to-basket-loader/to-basket-loader.min.js +2 -2
- package/dist/planner-entry/planner-entry.min.js +1 -1
- package/dist/preferences/preferences.min.js +21 -39
- package/dist/price/price.min.js +1 -1
- package/dist/product-addition/product-addition.css +1 -1
- package/dist/recipe-card/recipe-card.min.js +1 -1
- package/dist/recipe-card-cta/recipe-card-cta.min.js +1 -1
- package/dist/recipe-details/recipe-details.min.js +49 -41
- package/dist/recipe-pricing/recipe-pricing.min.js +1 -1
- package/dist/replace-item/replace-item-card/replace-item-card.min.js +5 -5
- package/dist/replace-item/replace-item.min.js +2 -2
- package/dist/replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js +1 -1
- package/dist/replace-item-planner/replace-item-planner.min.js +1 -1
- package/dist/select/select.min.js +1 -1
- package/dist/slider-tabs/slider-tabs.min.js +2 -2
- package/dist/store-indicator/store-indicator.min.js +1 -1
- package/dist/store-locator/store-locator.css +1 -1
- package/dist/store-locator/store-locator.min.js +97 -0
- package/dist/store-locator-drawer/store-locator-drawer.min.js +4 -37
- package/dist/store-locator.css +290 -0
- package/dist/supplier-selector/supplier-selector.css +1 -0
- package/dist/supplier-selector/supplier-selector.min.js +53 -0
- package/dist/supplier-selector.css +99 -0
- package/package.json +1 -1
- package/dist/add-to-cart-cta/add-to-cart-cta.css +0 -1
- package/dist/add-to-cart-cta/add-to-cart-cta.min.js +0 -7
- package/dist/assets/delay-DX2Gy1PY.js +0 -1
- package/dist/assets/empty-DhPhHznc.js +0 -1
- package/dist/assets/mapOneOrManyArgs-UKKoFfIU.js +0 -1
- package/dist/assets/merge-Cw-bwf6Z.js +0 -1
- package/dist/assets/mergeAll-9jcORGP2.js +0 -1
- package/dist/assets/store-locator-CQ_XQBby.js +0 -95
- package/dist/no-supplier-onboarding/no-supplier-onboarding.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";import{_ as re,n as D,p as X,
|
|
1
|
+
import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";import{_ as re,n as D,p as X,b as ne,c as le,q as oe,N as m,D as c,k as a}from"../assets/no-shadow-element-Dz9jgDtr.js";import{t as g}from"../assets/custom-element-BhZVzxrc.js";import{n as p}from"../assets/property-Bx8Yvr4_.js";import{P as ce}from"../assets/price-CHipCs2z.js";import{m as l}from"../assets/mealz-sdk-E_fNZM-c.js";import{m as Z}from"../assets/merge-tdU3EgEI.js";import{m as h}from"../assets/map-DHslluWD.js";import{t as K}from"../assets/take-ByPtGQky.js";import{c as ee}from"../assets/capitalize-DUAqYmp4.js";import"../counter/counter.min.js";import{G as te}from"../assets/product-card-c_0I2Lp_.js";import"../price/price.min.js";import"../assets/promotion-badge-CzwsPJJq.js";import"../assets/accordion-la5mVBfL.js";import"../store-indicator/store-indicator.min.js";import"../last-order-badge/last-order-badge.min.js";import"../order-again/order-again.min.js";import"../like-button/like-button.min.js";import{L as de}from"../last-order-modal/last-order-modal.min.js";import{a as pe}from"../assets/unsafe-html-Bv_ydUHb.js";import{M as ue}from"../planner/planner-onboarding/planner-onboarding.min.js";import{o as se,c as he}from"../assets/OperatorSubscriber-DF1TYu__.js";import{i as V}from"../assets/innerFrom-FMZwm2mb.js";import{f as Q}from"../assets/filter-DQ4vwAGj.js";import{t as z}from"../assets/tap-K_D6lo97.js";import{s as Y}from"../assets/switchMap-6Z80ObHE.js";import{c as J}from"../assets/combineLatest-BN0_WcEG.js";import{d as me}from"../assets/async-D5WN8Wfc.js";import"../assets/viewport-listener-DrFhSZNW.js";import"../assets/debounceTime-D7R6Z3Am.js";import"../assets/skipWhile-BzDgmir5.js";import"../assets/mergeAll-DTkL1sF8.js";import"../assets/mergeMap-g-JGW99j.js";import"../assets/executeSchedule-C0acKsif.js";import"../assets/empty-Bs9kqCuA.js";import"../assets/from-BTlWkhKh.js";import"../assets/delay-wUm-cx7a.js";import"../assets/timer-C3uKg-qK.js";import"../store-locator/store-locator.min.js";import"../assets/state-C5zM4-Pq.js";import"../assets/query-BApjzB0v.js";import"../onboarding/onboarding.min.js";import"../onboarding/events.min.js";import"../onboarding/analytics/onboarding-analytics.min.js";import"../assets/mapOneOrManyArgs-Bdu6mo6S.js";var ge=function(e){re(t,e);function t(i,r,s){i===void 0&&(i=1/0),r===void 0&&(r=1/0),s===void 0&&(s=me);var n=e.call(this)||this;return n._bufferSize=i,n._windowTime=r,n._timestampProvider=s,n._buffer=[],n._infiniteTimeWindow=!0,n._infiniteTimeWindow=r===1/0,n._bufferSize=Math.max(1,i),n._windowTime=Math.max(1,r),n}return t.prototype.next=function(i){var r=this,s=r.isStopped,n=r._buffer,o=r._infiniteTimeWindow,d=r._timestampProvider,v=r._windowTime;s||(n.push(i),!o&&n.push(d.now()+v)),this._trimBuffer(),e.prototype.next.call(this,i)},t.prototype._subscribe=function(i){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(i),s=this,n=s._infiniteTimeWindow,o=s._buffer,d=o.slice(),v=0;v<d.length&&!i.closed;v+=n?1:2)i.next(d[v]);return this._checkFinalizedStatuses(i),r},t.prototype._trimBuffer=function(){var i=this,r=i._bufferSize,s=i._timestampProvider,n=i._buffer,o=i._infiniteTimeWindow,d=(o?1:2)*r;if(r<1/0&&d<n.length&&n.splice(0,n.length-d),!o){for(var v=s.now(),k=0,u=1;u<n.length&&n[u]<=v;u+=2)k=u;k&&n.splice(0,k+1)}},t}(D);function ve(e){e===void 0&&(e={});var t=e.connector,i=t===void 0?function(){return new D}:t,r=e.resetOnError,s=r===void 0?!0:r,n=e.resetOnComplete,o=n===void 0?!0:n,d=e.resetOnRefCountZero,v=d===void 0?!0:d;return function(k){var u,f,I,T=0,S=!1,C=!1,x=function(){f==null||f.unsubscribe(),f=void 0},B=function(){x(),u=I=void 0,S=C=!1},ae=function(){var P=u;B(),P==null||P.unsubscribe()};return se(function(P,W){T++,!C&&!S&&x();var R=I=I??i();W.add(function(){T--,T===0&&!C&&!S&&(f=U(ae,v))}),R.subscribe(W),!u&&T>0&&(u=new X({next:function(O){return R.next(O)},error:function(O){C=!0,x(),f=U(B,s,O),R.error(O)},complete:function(){S=!0,x(),f=U(B,o),R.complete()}}),V(P).subscribe(u))})(k)}}function U(e,t){for(var i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];if(t===!0){e();return}if(t!==!1){var s=new X({next:function(){s.unsubscribe(),e()}});return V(t.apply(void 0,ne([],le(i)))).subscribe(s)}}function be(e,t,i){var r,s=!1;return r=e,ve({connector:function(){return new ge(r,t,i)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:s})}function w(e){return se(function(t,i){V(e).subscribe(he(i,function(){return i.complete()},oe)),!i.closed&&t.subscribe(i)})}var _e=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,y=(e,t,i,r)=>{for(var s=r>1?void 0:r?fe(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=(r?o(t,i,s):o(s))||s);return r&&s&&_e(t,i,s),s};let b=class extends m{constructor(){super(),this.noPosDisplay=!1,this.noSupplier=!1,this.recipeId="",this.plannerMode=!1,this.guests=0,this.recipe=null,this.analyticsPath="",this.subscriptions=[],this.remainingBasketEntries=[],this.recipePrice={remaining:0,inBasket:0,total:0,totalPerGuest:0},this.priceService=ce.getInstance(),this.allIngredientsToBasketLoading=!1,this.ingredientToBasketLoading=!1,this.updateIngredientFromBasketLoading=!1,this.productsLoading=!1,this.inMenu=!1,this.menuUpdateLoading=!1,this.styleURL=new URL("./recipe-details/details-footer/details-footer.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.priceService.initFormatter(),this.analyticsPath=`/recipes/${this.recipeId}/shopping`,this.subscriptions.push(Z(l.recipes.remainingBasketEntries$.pipe(h(e=>{this.remainingBasketEntries=e})),l.recipes.recipePrice$.pipe(h(e=>{const t=e.remaining+e.inBasket;this.recipePrice={...e,total:t,totalPerGuest:0}})),l.recipes.allIngredientsToBasketLoading$.pipe(h(e=>{this.allIngredientsToBasketLoading=e})),l.recipes.ingredientToBasketLoading$.pipe(h(e=>{this.ingredientToBasketLoading=e})),l.recipes.updateIngredientFromBasketLoading$.pipe(h(e=>{this.updateIngredientFromBasketLoading=e})),l.recipes.productsLoading$.pipe(h(e=>{this.productsLoading=e})),l.planner.plannerRecipePrice$.pipe(h(e=>{this.recipePrice.totalPerGuest=this.guests>0?e/this.guests:e}))).subscribe(()=>this.requestUpdate())),this.subscribeIsRecipeInMenu()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.isRecipeInMenuSub&&(this.isRecipeInMenuSub.unsubscribe(),this.isRecipeInMenuSub=void 0)}updated(e){super.updated(e),e.has("recipeId")&&this.subscribeIsRecipeInMenu()}subscribeIsRecipeInMenu(){this.recipeId&&(this.isRecipeInMenuSub&&this.isRecipeInMenuSub.unsubscribe(),this.isRecipeInMenuSub=l.planner.isRecipeInMenu$(this.recipeId).pipe(h(e=>{this.inMenu=e})).subscribe(()=>this.requestUpdate()))}closeRecipeDetails(e=!1){l.recipes.displayedRecipe$.next(null),e&&l.basket.basketPreviewState$.next({isOpen:!0,activeTabIndex:l.basket.basketPreviewState$.getValue().activeTabIndex})}continueShopping(){this.closeRecipeDetails(),this.sendContinueEvent()}addToMenu(){var i,r;this.menuUpdateLoading=!0,this.requestUpdate();const e=document.querySelector("mealz-planner-recipe-suggestion");e&&(e.recipeId=this.recipeId);const t=document.querySelector("mealz-planner-current-menu");if(!t){const s=(r=(i=l.recipes)==null?void 0:i.productsPlannerByCategory$)==null?void 0:r.value,n=(s==null?void 0:s.toPickProducts)||[];l.planner.addRecipeToMenu(this.recipeId,this.guests,!!l.pos.currentPos().value,n).pipe(K(1)).subscribe(()=>{this.inMenu=!0;const o=document.querySelector("mealz-planner-recipe-list");o==null||o.addRecipeCardToList(this.recipeId),this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()});return}t.addRecipe(this.recipeId,this.guests).subscribe(()=>{this.inMenu=!0,e==null||e.addAndSelectNewSuggestion(this.recipe||void 0),this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()})}removeFromMenu(){this.menuUpdateLoading=!0,this.requestUpdate();const e=document.querySelector("mealz-planner-recipe-suggestion");if(!e){l.planner.removeRecipeFromMenu(this.recipeId).pipe(K(1)).subscribe(()=>{this.inMenu=!1,this.menuUpdateLoading=!1,this.requestUpdate()});return}e.removeRecipe(this.recipeId).subscribe(()=>{this.inMenu=!1,this.menuUpdateLoading=!1,this.requestUpdate()})}addAllIngredients(){l.recipes.addAllIngredientsToBasket({originPath:this.analyticsPath,props:{}}),this.sendAddAllEvent(),this.recipePrice.inBasket===0&&this.sendAddRecipeEvent()}render(){if(this.noPosDisplay&&!this.plannerMode)return c;const e=this.remainingBasketEntries.length>0&&!this.plannerMode,t=this.plannerMode&&this.noPosDisplay,i=this.plannerMode&&!this.inMenu;return a`
|
|
2
2
|
<div class="mealz-recipe-details__footer">
|
|
3
3
|
${this.productsLoading&&!this.plannerMode?c:a`
|
|
4
4
|
<!-- ADD TO BASKET CTA -->
|
|
@@ -91,7 +91,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
91
91
|
${this.plannerMode?"par personne":"dans votre panier"}
|
|
92
92
|
</span>
|
|
93
93
|
</div>
|
|
94
|
-
`}sendAddAllEvent(){
|
|
94
|
+
`}sendAddAllEvent(){l.analytics.sendEvent("entry.add-all",this.analyticsPath,{recipe_id:this.recipeId,entry_count:this.remainingBasketEntries.length})}sendAddRecipeEvent(){l.analytics.sendEvent("recipe.add",this.analyticsPath,{recipe_id:this.recipeId})}sendContinueEvent(){l.analytics.sendEvent("recipe.continue",this.analyticsPath,{recipe_id:this.recipeId})}};y([p({type:Boolean})],b.prototype,"noPosDisplay",2);y([p({type:Boolean})],b.prototype,"noSupplier",2);y([p({type:String})],b.prototype,"recipeId",2);y([p({type:Boolean})],b.prototype,"plannerMode",2);y([p({type:Number})],b.prototype,"guests",2);y([p({attribute:!1})],b.prototype,"recipe",2);b=y([g("mealz-details-footer")],b);customElements.get("mealz-details-footer")||customElements.define("mealz-details-footer",b);var ze=Object.getOwnPropertyDescriptor,ye=(e,t,i,r)=>{for(var s=r>1?void 0:r?ze(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=o(s)||s);return s};let M=class extends m{constructor(){super(),this.tags=[],this.displayTags=!1,this.subscriptions=[],this.styleURL=new URL("./recipe-details/details-infos/details-infos.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(l.recipes.displayedRecipe$.subscribe(e=>{e&&(this.recipe=e.recipe,this.tags=e.recipe.relationships.tags.data.map(t=>t.attributes.name),this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}toggleTags(){this.displayTags=!this.displayTags,this.requestUpdate()}noTimePlaceholder(){return a`<span class="mealz-recipe-details-infos__no-time-placeholder">0 min</span>`}noDataPlaceholder(){return a`<span class="mealz-recipe-details-infos__no-data-placeholder">-</span>`}getRecipeDifficultyIntoClassName(){switch(this.recipe.attributes.difficulty){case 1:return"easy";case 2:return"medium";case 3:return"hard";default:return"no-difficulty-defined"}}getRecipeDifficultyIntoText(){switch(this.recipe.attributes.difficulty){case 1:return a`<span class="mealz-ds-text">Facile</span>`;case 2:return a`<span class="mealz-ds-text">Moyen</span>`;case 3:return a`<span class="mealz-ds-text">Difficile</span>`;default:return c}}renderPreparationTime(){return a`
|
|
95
95
|
<!-- PREPARATION TIME -->
|
|
96
96
|
<div
|
|
97
97
|
class="
|
|
@@ -157,7 +157,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
157
157
|
${this.renderRecipeDifficulty()}
|
|
158
158
|
${this.renderMoreTags()}
|
|
159
159
|
</div>
|
|
160
|
-
`}};
|
|
160
|
+
`}};M=ye([g("mealz-details-infos")],M);customElements.get("mealz-details-infos")||customElements.define("mealz-details-infos",M);var $e=Object.getOwnPropertyDescriptor,ke=(e,t,i,r)=>{for(var s=r>1?void 0:r?$e(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=o(s)||s);return s};let N=class extends m{constructor(){super(),this.steps=[],this.subscriptions=[],this.styleURL=new URL("./recipe-details/details-steps/details-steps.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(l.recipes.displayedRecipe$.subscribe(e=>{e&&(this.steps=e.recipe.relationships["recipe-steps"].data.sort((t,i)=>t.attributes["step-number"]-i.attributes["step-number"]).map(t=>t.attributes.description),this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){return a`
|
|
161
161
|
<div class="mealz-details-steps">
|
|
162
162
|
<!-- HEADER -->
|
|
163
163
|
<div class="mealz-ds-text weight-xxl mealz-details-steps__header">
|
|
@@ -180,7 +180,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
180
180
|
`)}
|
|
181
181
|
</div>
|
|
182
182
|
</div>
|
|
183
|
-
`}};
|
|
183
|
+
`}};N=ke([g("mealz-details-steps")],N);customElements.get("mealz-details-steps")||customElements.define("mealz-details-steps",N);var Ie=Object.getOwnPropertyDescriptor,Pe=(e,t,i,r)=>{for(var s=r>1?void 0:r?Ie(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=o(s)||s);return s};let q=class extends m{constructor(){super(),this.ingredients=[],this.subscriptions=[],this.styleURL=new URL("./recipe-details/details-ingredients/details-ingredients.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(l.recipes.displayedRecipe$.subscribe(e=>{e&&(this.ingredients=e.recipe.relationships.ingredients.data,this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){var e,t;return a`
|
|
184
184
|
<div class="mealz-details-ingredients">
|
|
185
185
|
<!-- HEADER -->
|
|
186
186
|
<div class="mealz-ds-text weight-xxl mealz-details-ingredients__header">
|
|
@@ -209,10 +209,10 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
209
209
|
`)}
|
|
210
210
|
</div>
|
|
211
211
|
</div>
|
|
212
|
-
`}ingredientPicture(e){return e.picture||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}};
|
|
212
|
+
`}ingredientPicture(e){return e.picture||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}};q=Pe([g("mealz-details-ingredients")],q);customElements.get("mealz-details-ingredients")||customElements.define("mealz-details-ingredients",q);var Ee=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,$=(e,t,i,r)=>{for(var s=r>1?void 0:r?Te(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=(r?o(t,i,s):o(s))||s);return r&&s&&Ee(t,i,s),s};const A=["unavailable"],Se=["ticked","unselected"];let _=class extends m{constructor(){super(),this.isSponsored=!1,this.subscriptions=[],this.guestObserverService=te.getInstance(),this.modifiedIngQty=0,this.analyticsPath="/meals-planner/current",this.styleURL=new URL("./product-card/product-card-planner.css",this.getBaseURL())}get status(){var e;return(e=this.product)==null?void 0:e.status}set status(e){this.product.status=e,this.requestUpdate()}get productImage(){var e;return((e=this.product.item)==null?void 0:e.attributes.image)||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}get ingredientPicture(){return this.product.ingredient.picture||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}updated(){var e,t;this.product&&(this.isSponsored=((t=(e=this.product.item)==null?void 0:e.attributes)==null?void 0:t.sponsored)===!0)}connectedCallback(){super.connectedCallback(),this.listenGuestsChange(),this.calculateQty()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}listenGuestsChange(){this.subscriptions.push(this.guestObserverService.guests$.subscribe(e=>{this.currentGuests=e,this.calculateQty()}))}calculateQty(){const e=this.product.ingredient.attributes.quantity/this.initialGuests;this.modifiedIngQty=Number((e*this.currentGuests).toFixed(2)),this.requestUpdate()}openReplaceItemView(){l.planner.openReplaceItemView(this.product),this.replaceItemViewEvent()}onCheckboxChange(e){e.target.checked?(this.status="ticked",l.planner.selectProduct(+this.product.item.id,this.product.ingredient.relationships.definition.data.id),this.addItemEvent()):(this.status="unselected",l.planner.unselectProduct(+this.product.item.id,this.product.ingredient.relationships.definition.data.id),this.deleteItemEvent()),this.requestUpdate()}render(){return a`
|
|
213
213
|
<div class="mealz-product-card-planner
|
|
214
214
|
${this.status==="ticked"?"added":""}
|
|
215
|
-
${
|
|
215
|
+
${A.includes(this.status)||this.oftenIgnored?"disabled":""}
|
|
216
216
|
${this.status==="unavailable"?"unavailable":""}"
|
|
217
217
|
>
|
|
218
218
|
${this.renderHeader()}
|
|
@@ -220,7 +220,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
220
220
|
${this.oftenIgnored?"disabled":""}
|
|
221
221
|
${this.status==="unavailable"?"unavailable":""}"
|
|
222
222
|
>
|
|
223
|
-
${
|
|
223
|
+
${Se.includes(this.status)&&!this.oftenIgnored?this.renderEnabledProductCard():this.renderDisabledOrUnavailableProduct()}
|
|
224
224
|
</div>
|
|
225
225
|
</div>
|
|
226
226
|
`}renderEnabledProductCard(){return a`
|
|
@@ -267,7 +267,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
267
267
|
class="
|
|
268
268
|
mealz-product-card-planner__header-name
|
|
269
269
|
mealz-ds-text weight-xl
|
|
270
|
-
${
|
|
270
|
+
${A.includes(this.status)||this.oftenIgnored?"mealz-product-card-planner__disabled-text":""}"
|
|
271
271
|
>
|
|
272
272
|
${ee(this.product.ingredient.attributes.name)}
|
|
273
273
|
</span>
|
|
@@ -275,7 +275,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
275
275
|
class="
|
|
276
276
|
mealz-product-card-planner__header-quantity
|
|
277
277
|
mealz-ds-text size-s weight-l
|
|
278
|
-
${
|
|
278
|
+
${A.includes(this.status)||this.oftenIgnored?"mealz-product-card-planner__disabled-text":""}"
|
|
279
279
|
>
|
|
280
280
|
<span>${this.modifiedIngQty?this.modifiedIngQty:this.product.ingredient.attributes.quantity}</span>
|
|
281
281
|
<span>${this.product.ingredient.attributes.unit}</span>
|
|
@@ -318,7 +318,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
318
318
|
<span>Remplacer</span>
|
|
319
319
|
</button>
|
|
320
320
|
`:""}
|
|
321
|
-
`}addItemEvent(){
|
|
321
|
+
`}addItemEvent(){l.analytics.sendEvent("planner.item.add",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}deleteItemEvent(){l.analytics.sendEvent("planner.item.delete",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}replaceItemViewEvent(){l.analytics.sendEvent("planner.item.replace",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}};$([p({type:Object})],_.prototype,"product",2);$([p({type:String})],_.prototype,"recipeId",2);$([p({type:Number})],_.prototype,"initialGuests",2);$([p({type:Number})],_.prototype,"currentGuests",2);$([p({type:Boolean})],_.prototype,"oftenIgnored",2);_=$([g("mealz-product-card-planner")],_);customElements.get("mealz-product-card-planner")||customElements.define("mealz-product-card-planner",_);var Ce=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,ie=(e,t,i,r)=>{for(var s=r>1?void 0:r?xe(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=(r?o(t,i,s):o(s))||s);return r&&s&&Ce(t,i,s),s};let L=class extends m{constructor(){super(),this.styleURL=new URL("./legal-notice/legal-notice.css",this.getBaseURL())}get containsAlcohol(){var t;return(((t=this.tags)==null?void 0:t.data)||[]).some(i=>i.id==="ingredient_category_alcool")}render(){return this.containsAlcohol?a`
|
|
322
322
|
<div class="mealz-products-picker__legal-notices">
|
|
323
323
|
<span class="mealz-ds-text weight-xxl mealz-products-picker__legal-notices-header">Mentions légales</span>
|
|
324
324
|
<div class="mealz-products-picker__legal-notices-content">
|
|
@@ -330,7 +330,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
330
330
|
</span>
|
|
331
331
|
</div>
|
|
332
332
|
</div>
|
|
333
|
-
`:c}};ie([p()],
|
|
333
|
+
`:c}};ie([p()],L.prototype,"tags",2);L=ie([g("mealz-legal-notice")],L);customElements.get("mealz-legal-notice")||customElements.define("mealz-legal-notice",L);var Re=Object.getOwnPropertyDescriptor,Oe=(e,t,i,r)=>{for(var s=r>1?void 0:r?Re(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=o(s)||s);return s};let G=class extends m{constructor(){super(),this.styleURL=[new URL("./product-card/product-card-skeleton/product-card-skeleton.css",this.getBaseURL()),new URL("./product-card/product-card.css",this.getBaseURL())]}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){return a`
|
|
334
334
|
<!-- PRODUCT CARD -->
|
|
335
335
|
<div class="mealz-product-card skeleton">
|
|
336
336
|
<!-- HEADER -->
|
|
@@ -373,7 +373,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
373
373
|
</div>
|
|
374
374
|
</div>
|
|
375
375
|
</div>
|
|
376
|
-
`}};
|
|
376
|
+
`}};G=Oe([g("mealz-products-card-skeleton")],G);customElements.get("mealz-products-card-skeleton")||customElements.define("mealz-products-card-skeleton",G);var we=Object.defineProperty,De=Object.getOwnPropertyDescriptor,H=(e,t,i,r)=>{for(var s=r>1?void 0:r?De(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=(r?o(t,i,s):o(s))||s);return r&&s&&we(t,i,s),s};let E=class extends m{constructor(){super(),this.inBasket=!1,this.plannerMode=!1,this.numberUnavailableProducts=0,this.subscriptions=[],this.noSupplier=l.supplier.isNoSupplier(),this.hasEmittedReady=!1,this.styleURL=new URL("./products-picker/products-picker.css",this.getBaseURL())}get totalProducts(){return this.recipe.relationships.ingredients.data.length}connectedCallback(){super.connectedCallback(),this.resetProducts(),this.listenToProducts(),this.subscriptions.push(l.recipes.displayedRecipe$.subscribe(e=>{e&&(this.recipe=e.recipe,this.analyticsPath=`/recipes/${this.recipe.id}/shopping`,this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.resetProducts(),this.subscriptions.forEach(e=>e.unsubscribe())}resetProducts(){this.productsByCategory={toPickProducts:[],oftenIgnoredProducts:[]},this.numberUnavailableProducts=0,this.requestUpdate()}listenToProducts(){const e=this.plannerMode?l.recipes.productsPlannerByCategory$:l.recipes.productsByCategory$;this.subscriptions.push(e.subscribe(t=>{this.productsByCategory=t,this.plannerMode?this.numberUnavailableProducts=[...t.oftenIgnoredProducts,...t.toPickProducts].filter(i=>i.status==="unavailable").length:this.numberUnavailableProducts=[...t.oftenIgnoredProducts,...t.toPickProducts].filter(i=>i.basketEntry.status==="out_of_stock").length,this.requestUpdate(),this.notifyReadyIfRendered()}))}async notifyReadyIfRendered(){if(this.hasEmittedReady)return;if(await this.updateComplete,this.querySelector(".mealz-product-card-planner__checkbox")||this.querySelector(".mealz-product-card__checkbox")){this.hasEmittedReady=!0;const t=new CustomEvent("products-picker-ready",{bubbles:!0,composed:!0});this.dispatchEvent(t)}}scrollToFirstUnavailable(){const e=document.querySelector(this.plannerMode?".mealz-products-picker":".mealz-products-picker__container");if(e){const t=e.querySelector(this.plannerMode?".mealz-product-card-planner.unavailable":".mealz-product-card__container.out_of_stock");t&&t.scrollIntoView({behavior:"smooth",block:"center"})}}isAlreadyOnCatalogPage(){return window.location.href.includes(l.router.getCatalogUrl())}closeRecipeModal(){}currentPath(){return""}guestsChange(e){const t=new CustomEvent("guestChange",{bubbles:!0,composed:!0,detail:{value:e.detail.value}});this.dispatchEvent(t)}render(){var e,t,i;return a`
|
|
377
377
|
<div class="mealz-products-picker">
|
|
378
378
|
${this.inBasket&&this.plannerMode?a`
|
|
379
379
|
<div class="mealz-products-picker__overlay">
|
|
@@ -388,7 +388,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
388
388
|
${this.renderHeader()}
|
|
389
389
|
<div class="mealz-products-picker__list">
|
|
390
390
|
<!-- TO PICK PRODUCTS -->
|
|
391
|
-
${((e=this.productsByCategory)==null?void 0:e.toPickProducts.length)>0?this.productsByCategory.toPickProducts.map(r=>{var s,n,
|
|
391
|
+
${((e=this.productsByCategory)==null?void 0:e.toPickProducts.length)>0?this.productsByCategory.toPickProducts.map(r=>{var s,n,o,d;return this.plannerMode?a`
|
|
392
392
|
<mealz-product-card-planner
|
|
393
393
|
.product="${r}"
|
|
394
394
|
.recipeId="${this.recipe.id}"
|
|
@@ -400,7 +400,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
400
400
|
<mealz-product-card
|
|
401
401
|
.product="${r}"
|
|
402
402
|
.recipeId="${this.recipe.id}"
|
|
403
|
-
.initialGuests="${((
|
|
403
|
+
.initialGuests="${((o=this.recipe)==null?void 0:o.attributes["number-of-guests"])||4}"
|
|
404
404
|
.currentGuests="${this.recipe.modifiedGuests||((d=this.recipe)==null?void 0:d.attributes["number-of-guests"])||4}"
|
|
405
405
|
></mealz-product-card>
|
|
406
406
|
`}):Array(this.totalProducts).fill(a`
|
|
@@ -410,30 +410,38 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
410
410
|
<!-- OFTEN IGNORED PRODUCTS -->
|
|
411
411
|
<div class="mealz-products-picker__secondary-list">
|
|
412
412
|
${((i=(t=this.productsByCategory)==null?void 0:t.oftenIgnoredProducts)==null?void 0:i.length)>0?a`
|
|
413
|
-
<
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
413
|
+
<mealz-accordion
|
|
414
|
+
.noStyling=${!0}
|
|
415
|
+
.titleSlot=${a`
|
|
416
|
+
<span class="mealz-ds-text weight-xl">
|
|
417
|
+
Déjà dans le placard
|
|
418
|
+
</span>
|
|
419
|
+
`}
|
|
420
|
+
.contentSlot=${a`
|
|
421
|
+
<div class="mealz-products-picker__list">
|
|
422
|
+
${this.productsByCategory.oftenIgnoredProducts.map(r=>{var s,n,o,d;return this.plannerMode?a`
|
|
423
|
+
<mealz-product-card-planner
|
|
424
|
+
.product=${r}
|
|
425
|
+
.recipeId=${this.recipe.id}
|
|
426
|
+
.oftenIgnored=${!0}
|
|
427
|
+
.initialGuests=${((s=this.recipe)==null?void 0:s.attributes["number-of-guests"])||4}
|
|
428
|
+
.currentGuests=${this.recipe.modifiedGuests||((n=this.recipe)==null?void 0:n.attributes["number-of-guests"])||4}
|
|
429
|
+
></mealz-product-card-planner>
|
|
430
|
+
`:a`
|
|
431
|
+
<mealz-product-card
|
|
432
|
+
.product=${r}
|
|
433
|
+
.recipeId=${this.recipe.id}
|
|
434
|
+
.initialGuests=${((o=this.recipe)==null?void 0:o.attributes["number-of-guests"])||4}
|
|
435
|
+
.currentGuests=${this.recipe.modifiedGuests||((d=this.recipe)==null?void 0:d.attributes["number-of-guests"])||4}
|
|
436
|
+
></mealz-product-card>
|
|
437
|
+
`})}
|
|
438
|
+
</div>
|
|
439
|
+
`}
|
|
440
|
+
>
|
|
441
|
+
</mealz-accordion>
|
|
434
442
|
`:c}
|
|
435
443
|
</div>
|
|
436
|
-
${
|
|
444
|
+
${this.noSupplier?c:this.renderLowerContent()}
|
|
437
445
|
</div>
|
|
438
446
|
`}renderHeader(){var e;return a`
|
|
439
447
|
<div class="mealz-products-picker__header">
|
|
@@ -475,7 +483,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
475
483
|
<div class="mealz-products-picker__more">
|
|
476
484
|
${!this.isAlreadyOnCatalogPage()&&!this.plannerMode?a`
|
|
477
485
|
<a class="mealz-products-picker__more-anchor"
|
|
478
|
-
href="${
|
|
486
|
+
href="${l.router.getCatalogUrl()}"
|
|
479
487
|
@click="${this.sendHomeDisplayEvent}">
|
|
480
488
|
<button class="mealz-products-picker__go-to-catalog-button mealz-ds-button secondary">
|
|
481
489
|
<span class="mealz-ds-text weight-l size-s">Voir plus d'idées repas</span>
|
|
@@ -488,7 +496,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
488
496
|
`}
|
|
489
497
|
</div>
|
|
490
498
|
<mealz-legal-notice .tags="${this.recipe.relationships.tags}"></mealz-legal-notice>
|
|
491
|
-
`}sendHomeDisplayEvent(){
|
|
499
|
+
`}sendHomeDisplayEvent(){l.analytics.sendEvent("home.display",this.analyticsPath,{})}};H([p({type:Boolean})],E.prototype,"inBasket",2);H([p({type:Boolean})],E.prototype,"plannerMode",2);E=H([g("mealz-products-picker")],E);customElements.get("mealz-products-picker")||customElements.define("mealz-products-picker",E);var Le=Object.getOwnPropertyDescriptor,Be=(e,t,i,r)=>{for(var s=r>1?void 0:r?Le(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=o(s)||s);return s};let F=class extends m{constructor(){super(),this.invalidPos=!1,this.subscriptions=[],this.styleURL=new URL("./recipe-details/no-pos-selected/no-pos-selected.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.listenIfPosInvalid()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}listenIfPosInvalid(){this.subscriptions.push(l.recipes.invalidPosDisplay$.subscribe(e=>{this.invalidPos=e,this.requestUpdate()}))}callPosSelector(){const e=new CustomEvent("posSelected",{bubbles:!0,composed:!0});this.dispatchEvent(e)}openStoreLocator(){window.mealzInternal.noSupplier.displaySupplierSelector$.next(!0)}render(){return a`
|
|
492
500
|
<div class="mealz-no-pos-selected">
|
|
493
501
|
${this.invalidPos?a`
|
|
494
502
|
<!-- INVALID POS -->
|
|
@@ -514,7 +522,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
514
522
|
/>
|
|
515
523
|
<div class="mealz-no-pos-selected__texts">
|
|
516
524
|
<span class="mealz-ds-text mealz-no-pos-selected__title size-l weight-xxl">
|
|
517
|
-
Vous n
|
|
525
|
+
Vous n'avez pas sélectionné de magasin
|
|
518
526
|
</span>
|
|
519
527
|
<span class="mealz-ds-text mealz-no-pos-selected__description">
|
|
520
528
|
Vous devez sélectionner un magasin pour visualiser les produits de cette recette.
|
|
@@ -528,7 +536,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
528
536
|
Sélectionner un magasin
|
|
529
537
|
</button>
|
|
530
538
|
</div>
|
|
531
|
-
`}};
|
|
539
|
+
`}};F=Be([g("mealz-no-pos-selected")],F);customElements.get("mealz-no-pos-selected")||customElements.define("mealz-no-pos-selected",F);var Ue=Object.getOwnPropertyDescriptor,Ae=(e,t,i,r)=>{for(var s=r>1?void 0:r?Ue(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(s=o(s)||s);return s};let j=class extends m{constructor(){super(),this.activeTabIndex=0,this.destroy$=new D,this.remainingBasketEntries=[],this.guestObserverService=te.getInstance(),this.isSticky=!1,this.styleURL=new URL("./recipe-details/recipe-details.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.destroy$=new D,this.handleNoSupplierMode(),Z(l.recipes.displayedRecipe$.pipe(w(this.destroy$),Q(e=>!!e),z(e=>{e.recipe!==null&&(this.recipe=e.recipe,this.sponsor=e.recipe.relationships.sponsors.data[0],this.analyticsPath=`/recipes/${this.recipe.id}/shopping`,this.plannerMode=!!e.planner,this.getLikeButton(),this.checkSponsorStorytelling(),this.pageview(),this.listenToCloseEvent(),this.setStickyObserver())}),Y(e=>e.recipe===null?[]:this.listenToRecipeInBasket())),this.listenPosStatus(),this.listenRemainingBasketEntries(),this.listenLastOrderDate(),this.listenToLoadingStates(),this.listenToAddAllToBasket()).pipe(w(this.destroy$)).subscribe({next:()=>this.requestUpdate(),error:e=>console.error("Recipe details error:",e)}),this.addEventListener("products-picker-ready",()=>this.startRecipeDetailsOnboardingIfNeeded())}disconnectedCallback(){super.disconnectedCallback(),this.destroy$.next(),this.destroy$.complete(),this.topObserver&&this.topObserver.disconnect(),this.stickyTimeout&&clearTimeout(this.stickyTimeout)}setStickyObserver(){this.topObserver||this.updateComplete.then(()=>{const e=this.querySelector(".mealz-recipe-details__sticky-anchor");e&&(this.topObserver=new IntersectionObserver(([t])=>{this.stickyTimeout&&clearTimeout(this.stickyTimeout),this.stickyTimeout=window.setTimeout(()=>{const i=!t.isIntersecting;this.isSticky!==i&&(this.isSticky=i,this.requestUpdate())},150)},{threshold:0}),this.topObserver.observe(e))})}startRecipeDetailsOnboardingIfNeeded(){localStorage.getItem("_miam/recipeDetailsOnboarding")==="true"||!this.plannerMode||this.updateComplete.then(()=>{this.scrollJustAfterImage();let t=document.querySelector("mealz-planner-onboarding");t?t.type="recipe-details":(t=new ue,t.type="recipe-details",document.body.appendChild(t)),t.launchOnboardingTour()})}scrollJustAfterImage(){const e=this.querySelector(".mealz-recipe-details__tabs");if(!e)return;const t=document.querySelector(".mealz-drawer__content-container");if(t){const i=e.getBoundingClientRect(),r=t.getBoundingClientRect();t.scrollTop+=i.top-r.top;return}e.scrollIntoView({behavior:"smooth",block:"start"})}handleNoSupplierMode(){this.noSupplier=!!l.supplier.isNoSupplier(),this.requestUpdate()}close(){this.sendCloseEvent(),l.recipes.displayedRecipe$.next(null)}listenToCloseEvent(){const e=document.querySelector("mealz-drawer");e&&e.addEventListener("drawerClosed",()=>{this.sendCloseEvent()})}selectTab(e){this.activeTabIndex=e,this.activeTabIndex===1&&this.sendCookingDisplayEvent(),this.requestUpdate()}getLikeButton(){this.noSupplier||l.user.isAuthenticated().pipe(w(this.destroy$),Q(e=>e),Y(()=>l.html.like(this.recipe.id))).subscribe({next:e=>{this.likeButtonHTML=e,this.requestUpdate()},error:e=>console.error("Like button error:",e)})}checkSponsorStorytelling(){this.sponsor&&l.sponsor.hasStorytelling(this.sponsor.id).pipe(w(this.destroy$)).subscribe({next:e=>{this.hasSponsorStorytelling=e,this.requestUpdate()},error:e=>console.error("Sponsor storytelling error:",e)})}listenPosStatus(){return J({noPosDisplay:l.recipes.noPosDisplay$,invalidPosDisplay:l.recipes.invalidPosDisplay$}).pipe(z(({noPosDisplay:e,invalidPosDisplay:t})=>{this.noPosDisplay=e,this.invalidPosDisplay=t,this.activeTabIndex=e?1:0}),h(()=>{}))}listenLastOrderDate(){return l.recipes.orderHistoryDate$.pipe(z(e=>{this.orderHistoryDate=e}))}listenToLoadingStates(){return J([l.recipes.ingredientToBasketLoading$,l.recipes.updateIngredientFromBasketLoading$]).pipe(h(([e,t])=>e||t),z(e=>{this.basketIsUpdating=e}),be(1))}listenRemainingBasketEntries(){return l.recipes.remainingBasketEntries$.pipe(z(e=>{this.remainingBasketEntries=e}))}listenToAddAllToBasket(){return l.recipes.allIngredientsToBasketLoading$.pipe(z(e=>{e&&(this.selectTab(0),setTimeout(()=>{this.scrollToPicker()},50))}))}listenToRecipeInBasket(){return l.recipes.isRecipeInBasket(this.recipe.id).pipe(z(e=>{this.inBasket=e}))}scrollToPicker(){const e=this.querySelector(".mealz-products-picker");if(e){const t=this.querySelector(".mealz-recipe-details__title-container"),i=(t==null?void 0:t.offsetHeight)||0;e.style.scrollMarginTop=`${i}px`,e.scrollIntoView({behavior:"instant",block:"start"})}}scrollToReplacedItem(e){var i,r;const t=this.querySelectorAll("mealz-product-card-planner");for(const s of Array.from(t)){const n=s;if(((r=(i=n.product)==null?void 0:i.item)==null?void 0:r.id)===e){n.scrollIntoView({behavior:"instant",block:"center"});break}}}openLastOrderModal(){this.sendOrderedDisplayEvent();const e=new de;e.recipeId=this.recipe.id,e.addEventListener("orderAgain",()=>this.orderAgain()),e.displayLastOrderModal(this.orderHistoryDate)}orderAgain(){l.recipes.addAllIngredientsToBasket({originPath:this.analyticsPath,props:{}})}updateGuests(e){if(this.recipe.modifiedGuests===e.detail.value)return;this.recipe.modifiedGuests=e.detail.value,this.guestObserverService.updateGuests(this.recipe.modifiedGuests);const t={originPath:this.analyticsPath,props:{}};this.plannerMode?l.planner.updateGuests(this.recipe.modifiedGuests,t):l.recipes.updateGuests(t),this.requestUpdate()}render(){return a`
|
|
532
540
|
<div class="mealz-recipe-details">
|
|
533
541
|
<!-- IF IS LOADING -->
|
|
534
542
|
${this.recipe?c:a`
|
|
@@ -696,4 +704,4 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
696
704
|
</div>
|
|
697
705
|
`:c}
|
|
698
706
|
</div>
|
|
699
|
-
`}showRecipeAddon(){this.sendSponsorDisplayEvent();const e=document.querySelector("mealz-drawer-view-swapper");e&&e.displayRecipeAddon$.next(!0)}pageview(){
|
|
707
|
+
`}showRecipeAddon(){this.sendSponsorDisplayEvent();const e=document.querySelector("mealz-drawer-view-swapper");e&&e.displayRecipeAddon$.next(!0)}pageview(){l.analytics.sendEvent("pageview",this.analyticsPath,{})}sendSponsorDisplayEvent(){l.analytics.sendEvent("sponsor.display",this.analyticsPath,{recipe_id:this.recipe.id})}sendCloseEvent(){l.analytics.sendEvent("recipe.close",this.analyticsPath,{recipe_id:this.recipe.id})}sendCookingDisplayEvent(){l.analytics.sendEvent("recipe.cooking.display",this.analyticsPath,{recipe_id:this.recipe.id})}sendOrderedDisplayEvent(){l.analytics.sendEvent("recipe.ordered.display",this.analyticsPath,{recipe_id:this.recipe.id})}};j=Ae([g("mealz-recipe-details")],j);customElements.get("mealz-recipe-details")||customElements.define("mealz-recipe-details",j);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as P,B as m}from"../assets/no-shadow-element-
|
|
1
|
+
import{N as P,B as m}from"../assets/no-shadow-element-Dz9jgDtr.js";import{V as b}from"../assets/viewport-listener-DrFhSZNW.js";import{t as f}from"../assets/custom-element-BhZVzxrc.js";import{w as I,m as n}from"../assets/mealz-sdk-E_fNZM-c.js";import{s as g}from"../assets/skipWhile-BzDgmir5.js";import{t as l}from"../assets/take-ByPtGQky.js";import{f as h}from"../assets/filter-DQ4vwAGj.js";import"../assets/debounceTime-D7R6Z3Am.js";import"../assets/async-D5WN8Wfc.js";import"../assets/OperatorSubscriber-DF1TYu__.js";import"../assets/empty-Bs9kqCuA.js";class p{constructor(){this.priceMemorized=new Map,this.displayedPrices=new Set,this.cleanupInterval=null,this.MAX_MEMO_SIZE=500,this.CLEANUP_INTERVAL=600*1e3,this.handlePageUnload=()=>{this.destroy()},this.startAutoCleanup(),this.setupPageUnloadListener()}static getInstance(){return p.instance||(p.instance=new p),p.instance}getMemorizedPrice(e,r){const s=`${e}-${r}`;return this.priceMemorized.get(s)}memorizedPrice(e,r,s){const c=`${e}-${r}`;this.priceMemorized.size>=this.MAX_MEMO_SIZE&&this.cleanOldPrices(),this.priceMemorized.set(c,{price:s,guests:r})}isPriceDisplayed(e,r){const s=`${e}-${r}`;return this.displayedPrices.has(s)}markPriceAsDisplayed(e,r){const s=`${e}-${r}`;this.displayedPrices.add(s)}cleanOldPrices(){this.priceMemorized.size>this.MAX_MEMO_SIZE*.8&&Array.from(this.priceMemorized.entries()).slice(0,Math.floor(this.priceMemorized.size*.3)).forEach(([s])=>{this.priceMemorized.delete(s),this.displayedPrices.delete(s)})}clearAllPrices(){this.priceMemorized.clear(),this.displayedPrices.clear()}destroy(){window.removeEventListener("beforeunload",this.handlePageUnload),this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null),this.priceMemorized.clear(),this.displayedPrices.clear(),p.instance=null}startAutoCleanup(){this.cleanupInterval=window.setInterval(()=>{this.cleanOldPrices()},this.CLEANUP_INTERVAL)}setupPageUnloadListener(){window.addEventListener("beforeunload",this.handlePageUnload)}}var v=Object.getOwnPropertyDescriptor,y=(i,e,r,s)=>{for(var c=s>1?void 0:s?v(e,r):e,t=i.length-1,a;t>=0;t--)(a=i[t])&&(c=a(c)||c);return c};let o=class extends P{constructor(){super(...arguments),this.recipePricing=null,this.formattedPrice="",this.recipeId="",this.pricePerServe="",this.recipePricingValue=null,this.serves=0,this.posId="",this.extStoreId="",this.rendered=new m(!1),this.priceViewportObserver=null,this.priceFetched=!1,this.planner=!1,this.lastDisplayedRecipeId="",this.lastPlannerPrice=0,this.plannerPriceSubscription=null,this.lastAppliedPrice="",this.priceDisplayed=!1,this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.classList.add("re-rendering"),this.getInitialStatus(),this.listenInView(),I().then(()=>{this.setupSubscriptions()}).catch(i=>{console.warn("Failed to initialize SDK subscriptions:",i)}),requestAnimationFrame(()=>{this.classList.remove("re-rendering")})}disconnectedCallback(){var i;super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.plannerPriceSubscription&&(this.plannerPriceSubscription.unsubscribe(),this.plannerPriceSubscription=null),(i=this.priceViewportObserver)==null||i.disconnect()}setupSubscriptions(){const i=n;this.subscriptions.push(this.rendered.pipe(g(e=>!e),l(1)).subscribe(()=>{const e=i.basket.recipePricesInBasket$().subscribe(r=>{if(!r)return;const s=r.find(c=>c.id===this.recipeId);r.length>0&&s&&parseFloat(s.price)>0&&(this.serves=i.basket.guestsForRecipe(s.id),this.recipePricingValue={id:s.id,price:parseFloat(s.price),guests:this.serves},this.recalculatePrice(parseFloat(s.price),this.serves))});this.subscriptions.push(e)}),i.recipes.recipePriceUpdated().subscribe(e=>{e.recipeId===this.recipeId&&!e.inBasket&&this.recipePricingValue&&(this.recipePricingValue.price=e.remaining,this.recalculatePrice(e.remaining,this.serves))}),this.setupDisplayedRecipeSubscription(),this.setupGuestUpdatesSubscription(),this.setupMenuPriceSubscription())}setupDisplayedRecipeSubscription(){return n.recipes.displayedRecipe$.pipe(h(()=>this.planner&&!!this.recipeId)).subscribe(e=>{var r;((r=e==null?void 0:e.recipe)==null?void 0:r.id)===this.recipeId?(this.lastDisplayedRecipeId=this.recipeId,this.trackPlannerRecipePrice(),this.updateGuestCountFromMenu()):!(e!=null&&e.recipe)&&this.lastDisplayedRecipeId===this.recipeId&&(this.updatePriceFromCapturedPlannerPrice(),this.lastDisplayedRecipeId="",this.plannerPriceSubscription&&(this.plannerPriceSubscription.unsubscribe(),this.plannerPriceSubscription=null))})}setupGuestUpdatesSubscription(){return n.recipes.guestsUpdated().pipe(h(()=>!!this.recipeId)).subscribe(({guests:e,recipeId:r})=>{r===this.recipeId&&(this.serves=e,this.recipePricingValue&&this.recipePricingValue.price!==null&&this.recalculatePrice(this.recipePricingValue.price,this.serves))})}setupMenuPriceSubscription(){return n.planner.menuPrice$.pipe(h(()=>this.planner&&!!this.recipeId)).subscribe(()=>{if(this.lastPlannerPrice>0&&this.serves>0){const e=this.lastPlannerPrice/this.serves;this.applyCurrencyDisplay(e.toFixed(2))}})}fetchPrice(){const i=p.getInstance(),e=i.getMemorizedPrice(this.recipeId,this.serves);if(e){requestAnimationFrame(()=>{this.applyCurrencyDisplay(e.price),i.markPriceAsDisplayed(this.recipeId,this.serves)});return}this.fetchAndUpdatePrice()}render(){this.recipePricing=this.querySelector(".mealz-recipe-pricing"),this.recipePricing&&(this.recipeId&&this.pricePerServe&&p.getInstance().isPriceDisplayed(this.recipeId,this.serves)&&requestAnimationFrame(()=>{this.applyCurrencyDisplay(this.pricePerServe)}),this.rendered.next(!0),this.getInitialStatus())}getInitialStatus(){const i=this.attributes.getNamedItem("starting-data"),e=i==null?void 0:i.value;if(!e)return;const r=JSON.parse(e),{recipeId:s,extStoreId:c,posId:t,pricePerServe:a,serves:d,planner:u}=r;this.extStoreId=c||"",this.posId=t||"",this.recipeId=s,this.pricePerServe=(a==null?void 0:a.toString())??"",this.serves=d,this.planner=u||!1,this.recipePricingValue={id:this.recipeId,price:null,guests:this.serves},this.pricePerServe&&this.applyCurrencyDisplay(this.pricePerServe)}applyCurrencyDisplay(i){if(this.lastAppliedPrice===i)return;const e=parseFloat(i);isNaN(e)||(this.lastAppliedPrice=i,this.formattedPrice=e.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2}),this.recipePricing||(this.recipePricing=this.querySelector(".mealz-recipe-pricing")),this.updateDOM())}showPrice(){var r,s;if(this.priceDisplayed)return;const i=(r=this.recipePricing)==null?void 0:r.querySelector(".mealz-recipe-pricing__loading"),e=(s=this.recipePricing)==null?void 0:s.querySelector(".mealz-recipe-pricing__wrapper");i==null||i.classList.replace("active","hidden"),e==null||e.classList.replace("hidden","active"),this.priceDisplayed=!0}updateDOM(){var e;const i=(e=this.recipePricing)==null?void 0:e.querySelector(".mealz-recipe-pricing__wrapper__price");i&&(i.innerHTML=this.formattedPrice+" €",this.showPrice())}recalculatePrice(i,e){const r=(i/e).toString();this.applyCurrencyDisplay(r)}trackPlannerRecipePrice(){const i=n;this.plannerPriceSubscription&&(this.plannerPriceSubscription.unsubscribe(),this.plannerPriceSubscription=null),this.plannerPriceSubscription=i.planner.plannerRecipePrice$.subscribe(e=>{e>0&&(this.lastPlannerPrice=e)})}updateGuestCountFromMenu(){if(!this.planner||!this.recipeId)return;n.planner.getGuestsForRecipe(this.recipeId).pipe(l(1)).subscribe(e=>{e&&e>0&&(this.serves=e)})}updatePriceFromCapturedPlannerPrice(){if(!this.planner||!this.recipeId)return;n.planner.isRecipeInMenu$(this.recipeId).pipe(l(1)).subscribe(e=>{if(e&&this.lastPlannerPrice>0){if(this.serves>0){const r=this.lastPlannerPrice/this.serves;this.applyCurrencyDisplay(r.toFixed(2))}}else this.pricePerServe&&this.applyCurrencyDisplay(this.pricePerServe)})}listenInView(){this.priceViewportObserver=new b(this,()=>{var i;!this.priceFetched&&((i=this.recipePricingValue)==null?void 0:i.price)===null&&this.fetchPrice()})}fetchAndUpdatePrice(){const i=this.posId||this.extStoreId,e=!!this.extStoreId;if(!i||!this.recipeId||!this.serves)return;const c=n.recipes.fetchPricing(this.recipeId,i,this.serves,e).subscribe({next:t=>{t&&t["price-per-serve"]&&(this.pricePerServe=t["price-per-serve"].toString(),this.recipePricingValue={id:this.recipeId,price:t.price,guests:this.serves},this.recalculatePrice(t.price,this.serves),this.priceFetched=!0)},error:t=>{console.error("Failed to fetch recipe pricing:",t)}});this.subscriptions.push(c)}};o=y([f("mealz-recipe-pricing")],o);customElements.get("mealz-recipe-pricing")||customElements.define("mealz-recipe-pricing",o);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../assets/promotion-badge-
|
|
1
|
+
import"../../assets/promotion-badge-CzwsPJJq.js";import{N as n,k as s}from"../../assets/no-shadow-element-Dz9jgDtr.js";import{t as h}from"../../assets/custom-element-BhZVzxrc.js";import{n as p}from"../../assets/property-Bx8Yvr4_.js";import{g as u,a as z}from"../../assets/price-utils-BRFZa-3D.js";import{m as o}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/price-CHipCs2z.js";var b=Object.defineProperty,_=Object.getOwnPropertyDescriptor,l=(e,i,c,a)=>{for(var t=a>1?void 0:a?_(i,c):i,m=e.length-1,d;m>=0;m--)(d=e[m])&&(t=(a?d(i,c,t):d(t))||t);return a&&t&&b(i,c,t),t};let r=class extends n{constructor(){super(),this.noSupplier=o.supplier.isNoSupplier(),this.subscriptions=[],this.styleURL=new URL("./replace-item/replace-item-card/replace-item-card.css",this.getBaseURL()),this.subscriptions.push(o.replaceItem.replaceItemLoading$.subscribe(e=>{this.replaceItemLoading=e,this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}onSelectItem(e){const i={detail:{item:e},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("selectItem",i))}render(){var e,i,c,a,t,m;return s`
|
|
2
2
|
<div
|
|
3
3
|
class="
|
|
4
4
|
mealz-replace-item-card
|
|
@@ -38,23 +38,23 @@ ${((i=(e=this.basketEntry)==null?void 0:e.selectedItem)==null?void 0:i.id)===thi
|
|
|
38
38
|
<mealz-price
|
|
39
39
|
class="mealz-replace-item__product-price mealz-ds-text size-m weight-xxl"
|
|
40
40
|
.oldPrice=${u(this.itemWithPrice.price)}
|
|
41
|
-
.price=${
|
|
41
|
+
.price=${z(this.itemWithPrice.price)}>
|
|
42
42
|
</mealz-price>
|
|
43
43
|
<!-- PRODUCT CTA -->
|
|
44
44
|
<button
|
|
45
45
|
class="mealz-replace-item-card__cta mealz-ds-button small primary mealz-ds-text size-m weight-xl"
|
|
46
|
-
.disabled=${((a=(
|
|
46
|
+
.disabled=${((a=(c=this.basketEntry)==null?void 0:c.selectedItem)==null?void 0:a.id)===this.itemWithPrice.item.id&&!this.ignoreSelected&&this.index===0}
|
|
47
47
|
@click=${()=>this.onSelectItem(this.itemWithPrice.item)}>
|
|
48
48
|
${this.replaceItemLoading===this.itemWithPrice.item?s`<div class="mealz-ds-loader mealz-replace-item-card__loader"></div>`:s`<!-- NO SUPPLIER CTA LABEL -->
|
|
49
49
|
${this.noSupplier?s`<span>Ajouter</span>`:s`
|
|
50
50
|
<!-- WITH SUPPLIER CTA LABEL -->
|
|
51
51
|
${(t=this.basketEntry)!=null&&t.selectedItem&&!this.ignoreSelected?s`
|
|
52
52
|
<div>
|
|
53
|
-
${this.index===0&&((
|
|
53
|
+
${this.index===0&&((m=this.basketEntry)==null?void 0:m.selectedItem.id)===this.itemWithPrice.item.id?s`<span>Dans le panier</span>`:s`<span>Remplacer</span>`}
|
|
54
54
|
</div>
|
|
55
55
|
`:s`<span>Ajouter au panier</span>`}
|
|
56
56
|
`}`}
|
|
57
57
|
</button>
|
|
58
58
|
</div>
|
|
59
59
|
</div>
|
|
60
|
-
`}};l([p()],
|
|
60
|
+
`}};l([p()],r.prototype,"itemWithPrice",2);l([p()],r.prototype,"index",2);l([p()],r.prototype,"basketEntry",2);l([p()],r.prototype,"ignoreSelected",2);r=l([h("mealz-replace-item-card")],r);customElements.get("mealz-replace-item-card")||customElements.define("mealz-replace-item-card",r);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./replace-item-card/replace-item-card.min.js";import{N as h,n as u,D as o,k as i}from"../assets/no-shadow-element-
|
|
1
|
+
import"./replace-item-card/replace-item-card.min.js";import{N as h,n as u,D as o,k as i}from"../assets/no-shadow-element-Dz9jgDtr.js";import{t as g}from"../assets/custom-element-BhZVzxrc.js";import{c as _}from"../assets/capitalize-DUAqYmp4.js";import{m as s}from"../assets/mealz-sdk-E_fNZM-c.js";import{m as b}from"../assets/merge-tdU3EgEI.js";import{m as n}from"../assets/map-DHslluWD.js";import{d as z}from"../assets/debounceTime-D7R6Z3Am.js";import{f as v}from"../assets/filter-DQ4vwAGj.js";import{d as S}from"../assets/distinctUntilChanged-VvZTmHoN.js";import{s as $}from"../assets/switchMap-6Z80ObHE.js";import"../assets/promotion-badge-CzwsPJJq.js";import"../assets/property-Bx8Yvr4_.js";import"../assets/price-CHipCs2z.js";import"../assets/price-utils-BRFZa-3D.js";import"../assets/mergeAll-DTkL1sF8.js";import"../assets/mergeMap-g-JGW99j.js";import"../assets/innerFrom-FMZwm2mb.js";import"../assets/OperatorSubscriber-DF1TYu__.js";import"../assets/executeSchedule-C0acKsif.js";import"../assets/empty-Bs9kqCuA.js";import"../assets/from-BTlWkhKh.js";import"../assets/async-D5WN8Wfc.js";var f=Object.getOwnPropertyDescriptor,I=(e,t,c,a)=>{for(var r=a>1?void 0:a?f(t,c):t,l=e.length-1,m;l>=0;l--)(m=e[l])&&(r=m(r)||r);return r};let p=class extends h{constructor(){super(),this.addProductMode=!1,this.fromRecipeDetails=!1,this.isLoading=!1,this.subscriptions=[],this.searchString="",this.itemsWithPricesList=[],this.searchSubject=new u,this.styleURL=new URL("./replace-item/replace-item.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(this.setupSearchObservable(),s.replaceItem.basketEntryToReplace$.subscribe(e=>{this.handleToReplace(e)}),b(s.recipes.displayedRecipe$.pipe(n(e=>{var t;this.currentRecipeId=(t=e==null?void 0:e.recipe)==null?void 0:t.id,this.fromRecipeDetails=!!this.currentRecipeId})),s.replaceItem.replaceProductFromPreviewOpen$.pipe(n(e=>{this.basketEntry=e})),s.replaceItem.additionModalOpen$.pipe(n(e=>{this.addProductMode=e})),s.replaceItem.itemsWithPricesList$.pipe(n(e=>{this.itemsWithPricesList=e})),s.replaceItem.fetchingItemLoading$.pipe(n(e=>{this.isLoading=e}))).subscribe(()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}handleToReplace(e){if(this.searchString="",!e){this.basketEntry=void 0,this.ingredient=void 0,this.ignoreSelected=!1;return}this.basketEntry=e.basketEntry,this.ingredient=e.ingredient,this.ignoreSelected=e.ignoreSelected||!1,this.requestUpdate()}onClose(){s.replaceItem.replaceItemLoading$.next(void 0),s.replaceItem.basketEntryToReplace$.next(void 0),s.productAddition.close()}onSearchInputChange(e){this.searchString=e.target.value,this.searchSubject.next(this.searchString)}setupSearchObservable(){return this.searchSubject.pipe(z(200),v(e=>e.length>=3),S(),$(e=>s.replaceItem.searchItem(e))).subscribe()}onSelectItem(e){var a;const t=(a=this.basketEntry)==null?void 0:a.id,c=this.fromRecipeDetails?`/recipes/${this.currentRecipeId}/shopping`:"/basket/products";s.replaceItem.onSelectItem(e.detail.item,this.searchString,()=>{this.onClose(),s.productAddition.productAdded$.next(t)},{originPath:`${c}/item-selector`,props:{}})}renderIssues(){var e,t;return i`
|
|
2
2
|
<!-- NO SUBSTITUTION PRODUCT -->
|
|
3
3
|
${!this.isLoading&&this.itemsWithPricesList.length===1&&!this.searchString?i`
|
|
4
4
|
<div class="mealz-replace-item__error">
|
|
@@ -93,4 +93,4 @@ import"./replace-item-card/replace-item-card.min.js";import{N as h,n as u,D as o
|
|
|
93
93
|
</div>`:o}
|
|
94
94
|
</div>
|
|
95
95
|
</div>
|
|
96
|
-
`}};p=
|
|
96
|
+
`}};p=I([g("mealz-replace-item")],p);customElements.get("mealz-replace-item")||customElements.define("mealz-replace-item",p);
|
package/dist/replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../assets/promotion-badge-
|
|
1
|
+
import"../../assets/promotion-badge-CzwsPJJq.js";import{N as d,k as t}from"../../assets/no-shadow-element-Dz9jgDtr.js";import{t as o}from"../../assets/custom-element-BhZVzxrc.js";import{n}from"../../assets/property-Bx8Yvr4_.js";import{g as h,a as u}from"../../assets/price-utils-BRFZa-3D.js";import{m as z}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/price-CHipCs2z.js";var P=Object.defineProperty,_=Object.getOwnPropertyDescriptor,p=(a,r,l,s)=>{for(var e=s>1?void 0:s?_(r,l):r,c=a.length-1,m;c>=0;c--)(m=a[c])&&(e=(s?m(r,l,e):m(e))||e);return s&&e&&P(r,l,e),e};let i=class extends d{constructor(){super(),this.noSupplier=z.supplier.isNoSupplier(),this.styleURL=new URL("./replace-item-planner/replace-item-card-planner/replace-item-card-planner.css",this.getBaseURL())}onSelectItem(){this.itemWithPrice.status="ticked";const a={detail:{itemWithPrice:this.itemWithPrice},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("selectItem",a)),this.requestUpdate()}render(){return t`
|
|
2
2
|
<div class=" mealz-replace-item-card-planner
|
|
3
3
|
${this.itemWithPrice.status==="ticked"?"selected":""}"
|
|
4
4
|
>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as h,n as d,D as o,k as a}from"../assets/no-shadow-element-
|
|
1
|
+
import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as h,n as d,D as o,k as a}from"../assets/no-shadow-element-Dz9jgDtr.js";import{c as u}from"../assets/capitalize-DUAqYmp4.js";import{t as g}from"../assets/custom-element-BhZVzxrc.js";import{m as i}from"../assets/mealz-sdk-E_fNZM-c.js";import{m as _}from"../assets/merge-tdU3EgEI.js";import{m}from"../assets/map-DHslluWD.js";import{d as b}from"../assets/debounceTime-D7R6Z3Am.js";import{f as z}from"../assets/filter-DQ4vwAGj.js";import{d as v}from"../assets/distinctUntilChanged-VvZTmHoN.js";import{s as S}from"../assets/switchMap-6Z80ObHE.js";import"../assets/promotion-badge-CzwsPJJq.js";import"../assets/property-Bx8Yvr4_.js";import"../assets/price-CHipCs2z.js";import"../assets/price-utils-BRFZa-3D.js";import"../assets/mergeAll-DTkL1sF8.js";import"../assets/mergeMap-g-JGW99j.js";import"../assets/innerFrom-FMZwm2mb.js";import"../assets/OperatorSubscriber-DF1TYu__.js";import"../assets/executeSchedule-C0acKsif.js";import"../assets/empty-Bs9kqCuA.js";import"../assets/from-BTlWkhKh.js";import"../assets/async-D5WN8Wfc.js";var f=Object.getOwnPropertyDescriptor,$=(e,t,s,n)=>{for(var r=n>1?void 0:n?f(t,s):t,l=e.length-1,c;l>=0;l--)(c=e[l])&&(r=c(r)||r);return r};let p=class extends h{constructor(){super(),this.isLoading=!1,this.subscriptions=[],this.searchString="",this.itemsWithPricesList=[],this.analyticsPath="/meals-planner/current",this.searchSubject=new d,this.styleURL=new URL("./replace-item-planner/replace-item-planner.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(this.setupSearchObservable(),i.planner.itemToReplace$.subscribe(e=>{this.handleToReplace(e)}),_(i.recipes.displayedRecipe$.pipe(m(e=>{var t;this.currentRecipeId=(t=e==null?void 0:e.recipe)==null?void 0:t.id})),i.planner.itemsWithPricesList$.pipe(m(e=>{this.itemsWithPricesList=e})),i.planner.fetchingItemLoading$.pipe(m(e=>{this.isLoading=e}))).subscribe(()=>{this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}handleToReplace(e){if(this.searchString="",!e){this.item=void 0,this.ingredient=void 0;return}this.item=e.item,this.ingredient=e.ingredient,this.requestUpdate()}onClose(){i.planner.itemToReplace$.next(void 0)}onSearchInputChange(e){this.searchString=e.target.value,this.searchSubject.next(this.searchString)}setupSearchObservable(){return this.searchSubject.pipe(b(200),z(e=>e.length>=3),v(),S(e=>i.planner.searchItem(e,this.ingredient,this.item))).subscribe()}onSelectItem(e){this.replacedItemEvent(e.detail.itemWithPrice),i.planner.replaceProduct(e.detail.itemWithPrice),this.item=e.detail.itemWithPrice.item,this.onClose()}formatNumber(e){const t=i.user.getLanguage()||"fr";return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:2}).format(e)}renderIssues(){var e,t;return a`
|
|
2
2
|
<!-- NO SUBSTITUTION PRODUCT -->
|
|
3
3
|
${!this.isLoading&&this.itemsWithPricesList.length===1&&!this.searchString?a`
|
|
4
4
|
<div class="mealz-replace-item-planner__error">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as d,k as n}from"../assets/no-shadow-element-
|
|
1
|
+
import{N as d,k as n}from"../assets/no-shadow-element-Dz9jgDtr.js";import{t as h}from"../assets/custom-element-BhZVzxrc.js";import{n as c}from"../assets/property-Bx8Yvr4_.js";import{r as u}from"../assets/state-C5zM4-Pq.js";import"../assets/mealz-sdk-E_fNZM-c.js";var _=Object.defineProperty,m=Object.getOwnPropertyDescriptor,a=(e,i,t,o)=>{for(var l=o>1?void 0:o?m(i,t):i,p=e.length-1,r;p>=0;p--)(r=e[p])&&(l=(o?r(i,t,l):r(l))||l);return o&&l&&_(i,t,l),l};let s=class extends d{constructor(){super(),this.options=[],this.value="",this.placeholder="",this.disabled=!1,this._open=!1,this._onWindowClick=e=>{e.composedPath().includes(this)||this._open&&(this._open=!1,this.requestUpdate())},this.styleURL=new URL("./select/select.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this._attachOutsideClick()}disconnectedCallback(){this._detachOutsideClick(),super.disconnectedCallback()}render(){const e=this.options.find(t=>t.id===this.value),i=(e==null?void 0:e.label)||this.placeholder||"";return n`
|
|
2
2
|
<div class="mealz-select">
|
|
3
3
|
<button
|
|
4
4
|
type="button"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../store-locator/store-locator.min.js";import{N as o,k as c}from"../assets/no-shadow-element-Dz9jgDtr.js";import{t as h}from"../assets/custom-element-BhZVzxrc.js";import{n as b}from"../assets/property-Bx8Yvr4_.js";import"../assets/state-C5zM4-Pq.js";import"../assets/query-BApjzB0v.js";import"../assets/mealz-sdk-E_fNZM-c.js";var m=Object.defineProperty,p=Object.getOwnPropertyDescriptor,n=(e,t,i,a)=>{for(var s=a>1?void 0:a?p(t,i):t,d=e.length-1,r;d>=0;d--)(r=e[d])&&(s=(a?r(t,i,s):r(s))||s);return a&&s&&m(t,i,s),s};let l=class extends o{constructor(){super(),this._selectedTabIndex=0,this.styleURL=new URL("./slider-tabs/slider-tabs.css",this.getBaseURL())}get selectedTabIndex(){return this._selectedTabIndex}set selectedTabIndex(e){this._selectedTabIndex!==e&&(this._selectedTabIndex=e,this.sliderElement&&this.updateSlider())}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){this.sliderElement=this.querySelector(".mealz-slider-tab__background"),this.updateSlider()}render(){return c`
|
|
2
2
|
<div class="mealz-slider-tabs">
|
|
3
3
|
${this.tabs.map((e,t)=>c`
|
|
4
4
|
<button
|
|
@@ -11,4 +11,4 @@ import"../assets/store-locator-CQ_XQBby.js";import{N as o,k as c}from"../assets/
|
|
|
11
11
|
`)}
|
|
12
12
|
<div class="mealz-slider-tab__background"></div>
|
|
13
13
|
</div>
|
|
14
|
-
`}selectTab(e){if(e===this.selectedTabIndex)return;this.selectedTabIndex=e;const t={detail:{selectedTab:e},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("tabChanged",t)),this.requestUpdate()}updateSlider(){var e,t;this.sliderElement&&(this.sliderElement.style.width=`calc(${100/((e=this.tabs)==null?void 0:e.length)}% - 8px)`,this.sliderElement.style.marginLeft=`${this.selectedTabIndex*100/((t=this.tabs)==null?void 0:t.length)}%`,this.requestUpdate())}};n([b({type:Array})],
|
|
14
|
+
`}selectTab(e){if(e===this.selectedTabIndex)return;this.selectedTabIndex=e;const t={detail:{selectedTab:e},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("tabChanged",t)),this.requestUpdate()}updateSlider(){var e,t;this.sliderElement&&(this.sliderElement.style.width=`calc(${100/((e=this.tabs)==null?void 0:e.length)}% - 8px)`,this.sliderElement.style.marginLeft=`${this.selectedTabIndex*100/((t=this.tabs)==null?void 0:t.length)}%`,this.requestUpdate())}};n([b({type:Array})],l.prototype,"tabs",2);n([b({type:Number})],l.prototype,"selectedTabIndex",1);l=n([h("mealz-slider-tabs")],l);customElements.get("mealz-slider-tabs")||customElements.define("mealz-slider-tabs",l);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../store-locator/store-locator.min.js";import{N as p,D as m,k as u}from"../assets/no-shadow-element-Dz9jgDtr.js";import{t as d}from"../assets/custom-element-BhZVzxrc.js";import{n as h}from"../assets/property-Bx8Yvr4_.js";import{m as l}from"../assets/mealz-sdk-E_fNZM-c.js";import"../assets/state-C5zM4-Pq.js";import"../assets/query-BApjzB0v.js";var b=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,s,i,r)=>{for(var t=r>1?void 0:r?w(s,i):s,o=e.length-1,n;o>=0;o--)(n=e[o])&&(t=(r?n(s,i,t):n(t))||t);return r&&t&&b(s,i,t),t};let a=class extends p{constructor(){super(),this.analyticsPath="",this.subscriptions=[],this.styleURL=new URL("./store-indicator/store-indicator.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.setCurrentPosLabel()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){return this.currentPosLabel?u`
|
|
2
2
|
<div class="mealz-store-indicator">
|
|
3
3
|
<span class="mealz-store-indicator__pos-label mealz-ds-text weight-xl">
|
|
4
4
|
${this.currentPosLabel}
|