mealz-components 2.0.0-beta.8 → 2.0.0-beta.9
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/assets/merge-BlKu2J03.js +1 -0
- package/dist/assets/mergeAll-DQItozZ-.js +1 -0
- package/dist/catalog/my-meals-button/my-meals-button.min.js +1 -1
- package/dist/drawer-view-swapper/drawer-view-swapper.min.js +1 -1
- package/dist/onboarding/onboarding.css +1 -1
- package/dist/onboarding/onboarding.min.js +2 -2
- package/dist/planner/planner-current-menu/planner-current-menu.min.js +1 -1
- package/dist/planner/planner-onboarding-modal/planner-onboarding-modal.css +1 -1
- package/dist/planner/planner-recipe-suggestion/planner-recipe-suggestion.min.js +1 -1
- package/dist/recipe-card-cta/recipe-card-cta.min.js +1 -1
- package/dist/recipe-details/recipe-details.min.js +17 -17
- package/dist/replace-item/replace-item.min.js +1 -1
- package/dist/replace-item-planner/replace-item-planner.min.js +1 -1
- package/package.json +1 -1
- package/dist/assets/merge-OrXqfOOP.js +0 -1
- package/dist/assets/recipe-BwGs-blm.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as n}from"./mergeAll-DQItozZ-.js";import{i as t}from"./innerFrom-CVMPVEmB.js";import{E as s}from"./empty-DGYYDWIm.js";import{p,a as f,f as u}from"./from-Btz8AgkO.js";function h(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=p(r),a=f(r,1/0),m=r;return m.length?m.length===1?t(m[0]):n(a)(u(m,o)):s}export{h as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m}from"./mergeMap-CMaM5Agw.js";import{w as t}from"./no-shadow-element-DlGA0h9b.js";function o(i){return i===void 0&&(i=1/0),m(t,i)}export{o as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../basket-preview/basket-preview.min.js";import"../../drawer-view-swapper/drawer-view-swapper.min.js";import{N as n}from"../../assets/no-shadow-element-DlGA0h9b.js";import{t as l}from"../../assets/custom-element-BhZVzxrc.js";import{m}from"../../assets/mealz-sdk-DWLzEfKz.js";import"../../store-indicator/store-indicator.min.js";import"../../assets/store-locator-CKwiyckb.js";import"../../assets/property-Bg80vXcm.js";import"../../assets/state-bsKs-Mb2.js";import"../../assets/query-BApjzB0v.js";import"../../slider-tabs/slider-tabs.min.js";import"../../counter/counter.min.js";import"../../assets/debounceTime-CIA2MWDj.js";import"../../assets/async-H-Co76Oa.js";import"../../assets/OperatorSubscriber-z_a6lCKk.js";import"../../price/price.min.js";import"../../assets/price-DcNF55ef.js";import"../../modal/modal.min.js";import"../../assets/unsafe-html-MRC87lfr.js";import"../../onboarding/events.min.js";import"../../assets/capitalize-DUAqYmp4.js";import"../../assets/delay-0L99jHsb.js";import"../../assets/take-BmqRVy-3.js";import"../../assets/empty-DGYYDWIm.js";import"../../assets/map-oxUcVNGT.js";import"../../assets/mergeMap-CMaM5Agw.js";import"../../assets/innerFrom-CVMPVEmB.js";import"../../assets/executeSchedule-CTqB8mra.js";import"../../assets/timer-DmQ_oP6s.js";import"../../drawer/drawer.min.js";import"../../store-locator-drawer/store-locator-drawer.min.js";import"../../assets/skipWhile-BAgfjfH2.js";import"../../assets/switchMap-vA0vSKy4.js";import"../../recipe-details/recipe-details.min.js";import"../../recipe-pricing/recipe-pricing.min.js";import"../../assets/filter-DuHsB8oM.js";import"../../assets/combineLatest-DNi66MsF.js";import"../../assets/from-Btz8AgkO.js";import"../../assets/mapOneOrManyArgs-Do0PsDok.js";import"../../assets/of-CH-D5SN9.js";import"../../assets/tap-C4xC1M3N.js";import"../../assets/
|
|
1
|
+
import"../basket-preview/basket-preview.min.js";import"../../drawer-view-swapper/drawer-view-swapper.min.js";import{N as n}from"../../assets/no-shadow-element-DlGA0h9b.js";import{t as l}from"../../assets/custom-element-BhZVzxrc.js";import{m}from"../../assets/mealz-sdk-DWLzEfKz.js";import"../../store-indicator/store-indicator.min.js";import"../../assets/store-locator-CKwiyckb.js";import"../../assets/property-Bg80vXcm.js";import"../../assets/state-bsKs-Mb2.js";import"../../assets/query-BApjzB0v.js";import"../../slider-tabs/slider-tabs.min.js";import"../../counter/counter.min.js";import"../../assets/debounceTime-CIA2MWDj.js";import"../../assets/async-H-Co76Oa.js";import"../../assets/OperatorSubscriber-z_a6lCKk.js";import"../../price/price.min.js";import"../../assets/price-DcNF55ef.js";import"../../modal/modal.min.js";import"../../assets/unsafe-html-MRC87lfr.js";import"../../onboarding/events.min.js";import"../../assets/capitalize-DUAqYmp4.js";import"../../assets/delay-0L99jHsb.js";import"../../assets/take-BmqRVy-3.js";import"../../assets/empty-DGYYDWIm.js";import"../../assets/map-oxUcVNGT.js";import"../../assets/mergeMap-CMaM5Agw.js";import"../../assets/innerFrom-CVMPVEmB.js";import"../../assets/executeSchedule-CTqB8mra.js";import"../../assets/timer-DmQ_oP6s.js";import"../../drawer/drawer.min.js";import"../../store-locator-drawer/store-locator-drawer.min.js";import"../../assets/skipWhile-BAgfjfH2.js";import"../../assets/switchMap-vA0vSKy4.js";import"../../recipe-details/recipe-details.min.js";import"../../recipe-pricing/recipe-pricing.min.js";import"../../assets/filter-DuHsB8oM.js";import"../../assets/combineLatest-DNi66MsF.js";import"../../assets/from-Btz8AgkO.js";import"../../assets/mapOneOrManyArgs-Do0PsDok.js";import"../../assets/of-CH-D5SN9.js";import"../../assets/tap-C4xC1M3N.js";import"../../assets/merge-BlKu2J03.js";import"../../assets/mergeAll-DQItozZ-.js";import"../../assets/product-card-Be_9YL6f.js";import"../../assets/promotion-badge-2uUuiRau.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"../../last-order-modal/last-order-modal.min.js";import"../../planner/planner-onboarding/planner-onboarding.min.js";import"../../onboarding/onboarding.min.js";import"../../onboarding/analytics/onboarding-analytics.min.js";import"../../planner/planner-catalog/planner-catalog.min.js";import"../catalog-load-more.min.js";import"../../assets/http-BGziD2u2.js";import"../../replace-item/replace-item.min.js";import"../../replace-item/replace-item-card/replace-item-card.min.js";import"../../assets/price-utils-BRFZa-3D.js";import"../../assets/distinctUntilChanged-Ckq1Syk_.js";import"../../replace-item-planner/replace-item-planner.min.js";import"../../replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js";import"../../history-drawer/history-drawer.min.js";var c=Object.getOwnPropertyDescriptor,u=(t,i,r,s)=>{for(var o=s>1?void 0:s?c(i,r):i,e=t.length-1,p;e>=0;e--)(p=t[e])&&(o=p(o)||o);return o};let a=class extends n{constructor(){super(...arguments),this.analyticsPath="",this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.subscriptions.push(mealz.basket.recipeCount().subscribe(t=>{this.recipesCount=t,this.updateDOM()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(t=>t.unsubscribe())}render(){var i;if(this.button=this.querySelector(".mealz-my-meals-button"),!this.button)return;const t=(i=this.attributes["starting-data"])==null?void 0:i.value;if(t){const{path:r}=JSON.parse(t);this.analyticsPath=r,this.removeAttribute("starting-data")}this.button.addEventListener("click",r=>{r.stopPropagation(),this.toggleBasketPreview()})}toggleBasketPreview(){this.sendBasketDisplayEvent(),m.basket.basketPreviewState$.next({isOpen:!0})}updateDOM(){var i;if(!this.button)return;this.recipesCount?this.button.classList.remove("hidden"):this.button.classList.add("hidden");const t=(i=this.button.querySelector(".mealz-my-meals-button__text"))==null?void 0:i.firstElementChild;t&&(t.innerHTML=`${this.recipesCount||0}`)}sendBasketDisplayEvent(){m.analytics.sendEvent("basket.display",this.analyticsPath,{})}};a=u([l("mealz-my-meals-button")],a);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../drawer/drawer.min.js";import"../store-locator-drawer/store-locator-drawer.min.js";import{N as w,D as d,k as t,B as c}from"../assets/no-shadow-element-DlGA0h9b.js";import{t as v}from"../assets/custom-element-BhZVzxrc.js";import{n as g}from"../assets/property-Bg80vXcm.js";import{m as n,w as z}from"../assets/mealz-sdk-DWLzEfKz.js";import"../recipe-details/recipe-details.min.js";import"../assets/store-locator-CKwiyckb.js";import"../planner/planner-catalog/planner-catalog.min.js";import"../replace-item/replace-item.min.js";import"../replace-item-planner/replace-item-planner.min.js";import"../history-drawer/history-drawer.min.js";import{o as k,l as R}from"../catalog/basket-preview/basket-preview.min.js";import{m as f}from"../assets/merge-
|
|
1
|
+
import"../drawer/drawer.min.js";import"../store-locator-drawer/store-locator-drawer.min.js";import{N as w,D as d,k as t,B as c}from"../assets/no-shadow-element-DlGA0h9b.js";import{t as v}from"../assets/custom-element-BhZVzxrc.js";import{n as g}from"../assets/property-Bg80vXcm.js";import{m as n,w as z}from"../assets/mealz-sdk-DWLzEfKz.js";import"../recipe-details/recipe-details.min.js";import"../assets/store-locator-CKwiyckb.js";import"../planner/planner-catalog/planner-catalog.min.js";import"../replace-item/replace-item.min.js";import"../replace-item-planner/replace-item-planner.min.js";import"../history-drawer/history-drawer.min.js";import{o as k,l as R}from"../catalog/basket-preview/basket-preview.min.js";import{m as f}from"../assets/merge-BlKu2J03.js";import{m as p}from"../assets/map-oxUcVNGT.js";import"../assets/unsafe-html-MRC87lfr.js";import"../assets/state-bsKs-Mb2.js";import"../assets/skipWhile-BAgfjfH2.js";import"../assets/OperatorSubscriber-z_a6lCKk.js";import"../assets/switchMap-vA0vSKy4.js";import"../assets/innerFrom-CVMPVEmB.js";import"../recipe-pricing/recipe-pricing.min.js";import"../assets/filter-DuHsB8oM.js";import"../assets/combineLatest-DNi66MsF.js";import"../assets/from-Btz8AgkO.js";import"../assets/executeSchedule-CTqB8mra.js";import"../assets/mapOneOrManyArgs-Do0PsDok.js";import"../assets/of-CH-D5SN9.js";import"../assets/take-BmqRVy-3.js";import"../assets/empty-DGYYDWIm.js";import"../assets/tap-C4xC1M3N.js";import"../assets/price-DcNF55ef.js";import"../assets/capitalize-DUAqYmp4.js";import"../counter/counter.min.js";import"../assets/debounceTime-CIA2MWDj.js";import"../assets/async-H-Co76Oa.js";import"../assets/product-card-Be_9YL6f.js";import"../price/price.min.js";import"../assets/promotion-badge-2uUuiRau.js";import"../assets/delay-0L99jHsb.js";import"../assets/mergeMap-CMaM5Agw.js";import"../assets/timer-DmQ_oP6s.js";import"../store-indicator/store-indicator.min.js";import"../assets/query-BApjzB0v.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"../last-order-modal/last-order-modal.min.js";import"../planner/planner-onboarding/planner-onboarding.min.js";import"../onboarding/onboarding.min.js";import"../onboarding/events.min.js";import"../onboarding/analytics/onboarding-analytics.min.js";import"../catalog/catalog-load-more.min.js";import"../assets/http-BGziD2u2.js";import"../replace-item/replace-item-card/replace-item-card.min.js";import"../assets/price-utils-BRFZa-3D.js";import"../assets/distinctUntilChanged-Ckq1Syk_.js";import"../replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js";import"../slider-tabs/slider-tabs.min.js";import"../modal/modal.min.js";import"../assets/mergeAll-DQItozZ-.js";var C=Object.defineProperty,S=Object.getOwnPropertyDescriptor,V=(e,s,r,o)=>{for(var i=o>1?void 0:o?S(s,r):s,a=e.length-1,l;a>=0;a--)(l=e[a])&&(i=(o?l(s,r,i):l(i))||i);return o&&i&&C(s,r,i),i};let m=class extends w{constructor(){super(),this.styleURL=new URL("./recipe-details/sponsor-block/sponsor-block.css",this.getBaseURL())}render(){var b,$,y;if(!this.sponsorBlock)return d;const{pictureUrl:e,content:s,backgroundColor:r="#FFFFFF",fontSize:o=16,fontColor:i="#000000"}=this.sponsorBlock,a=(y=($=(b=this.sponsorBlock.relationships)==null?void 0:b["sponsor-block-type"])==null?void 0:$.data)==null?void 0:y.name;if(!a)return t``;const l=a.toLowerCase(),h=`background-color: ${r}; font-size: ${o}px; color: ${i};`;switch(a){case"TEXT":case"SMALL_TEXT":case"TITLE":case"SMALL_TITLE":return t`
|
|
2
2
|
<div class="sponsor-text-blocks sponsor-${l}-block" style="background-color: ${r};">
|
|
3
3
|
<span class="sponsor-${l}-block__text" style="font-size: ${a.includes("TITLE")?32:16}px; color: ${i};">
|
|
4
4
|
${s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.mealz-onboarding-overlay{position:fixed;z-index:calc(var(--m-z-index-modal-overlay) - 1);top:0;left:0;width:100vw;height:100dvh;-webkit-tap-highlight-color:transparent;opacity:0;animation:fadeIn .3s ease-in-out forwards}@keyframes fadeIn{to{opacity:1}}.mealz-onboarding-stage{position:fixed;box-shadow:0 0 0 9999px var(--mealz-ds-color-neutral-black, #0F191F);opacity:0;border-radius:12px;outline-offset:0;z-index:10001;pointer-events:none;animation:fadeInStage .3s ease-in-out forwards;transition:all .4s cubic-bezier(.4,0,.2,1)}@keyframes fadeInStage{to{opacity:.7}}.mealz-onboarding-highlight{position:relative
|
|
1
|
+
.mealz-onboarding-overlay{position:fixed;z-index:calc(var(--m-z-index-modal-overlay) - 1);top:0;left:0;width:100vw;height:100dvh;-webkit-tap-highlight-color:transparent;opacity:0;animation:fadeIn .3s ease-in-out forwards}@keyframes fadeIn{to{opacity:1}}.mealz-onboarding-stage{position:fixed;box-shadow:0 0 0 9999px var(--mealz-ds-color-neutral-black, #0F191F);opacity:0;border-radius:12px;outline-offset:0;z-index:10001;pointer-events:none;animation:fadeInStage .3s ease-in-out forwards;transition:all .4s cubic-bezier(.4,0,.2,1)}@keyframes fadeInStage{to{opacity:.7}}.mealz-onboarding-highlight{position:relative}.mealz-onboarding-popover{position:fixed;top:auto;bottom:110px;left:50%;transform:translate(-50%) translateY(20px);background-color:var(--mealz-ds-color-neutral-white, #fff);padding:24px;border-radius:16px;min-width:336px;width:336px;box-shadow:0 8px 24px #1018282e;z-index:10003;opacity:0;animation:slideUpFadeIn .3s ease-in-out forwards}@keyframes slideUpFadeIn{to{opacity:1;transform:translate(-50%) translateY(0)!important}}.mealz-onboarding-popover__no-bottom-radius{border-bottom-left-radius:0;border-bottom-right-radius:0}@media (max-width: 768px){.mealz-onboarding-popover{width:100%}.mealz-onboarding-popover .mealz-onboarding-popover__footer-button{width:100%;flex:1}}.mealz-onboarding-popover .mealz-onboarding-popover__header{display:flex;justify-content:space-between;align-items:center}.mealz-onboarding-popover .mealz-onboarding-popover__header>*:not(:last-child){margin-right:8px}.mealz-onboarding-popover .mealz-onboarding-popover__content{padding:24px 0}.mealz-onboarding-popover .mealz-onboarding-popover__footer{display:flex;justify-content:space-between;align-items:center}.mealz-onboarding-popover .mealz-onboarding-popover__footer>*:not(:last-child){margin-right:24px}.mealz-onboarding-popover .mealz-onboarding-popover__footer-centered{justify-content:center}.mealz-onboarding-popover__progress{--progress: calc(var(--value) / var(--total) * 360deg);width:40px;height:40px;border-radius:50%;background:conic-gradient(var(--mealz-ds-color-primary, #24748F) var(--progress),var(--mealz-ds-color-primary-100, #E4EAEC) 0deg);display:grid;place-items:center}.mealz-onboarding-popover__progress-inner{width:32px;height:32px;border-radius:50%;background:#fff;display:flex;align-items:center;justify-content:center}.mealz-onboarding-popover__progress-inner span{color:var(--mealz-ds-color-neutral-black, #0F191F);opacity:.7}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as g,k as h}from"../assets/no-shadow-element-DlGA0h9b.js";import{t as v}from"../assets/custom-element-BhZVzxrc.js";import{n as c}from"../assets/property-Bg80vXcm.js";import{r as u}from"../assets/state-bsKs-Mb2.js";import{e as d}from"../assets/query-BApjzB0v.js";import{O as f,c as b,b as E}from"./events.min.js";import"../assets/mealz-sdk-DWLzEfKz.js";var y=Object.defineProperty,S=Object.getOwnPropertyDescriptor,l=(t,e,o,
|
|
1
|
+
import{N as g,k as h}from"../assets/no-shadow-element-DlGA0h9b.js";import{t as v}from"../assets/custom-element-BhZVzxrc.js";import{n as c}from"../assets/property-Bg80vXcm.js";import{r as u}from"../assets/state-bsKs-Mb2.js";import{e as d}from"../assets/query-BApjzB0v.js";import{O as f,c as b,b as E}from"./events.min.js";import"../assets/mealz-sdk-DWLzEfKz.js";var y=Object.defineProperty,S=Object.getOwnPropertyDescriptor,l=(t,e,o,s)=>{for(var i=s>1?void 0:s?S(e,o):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(i=(s?a(e,o,i):a(i))||i);return s&&i&&y(e,o,i),i};let n=class extends g{constructor(){super(),this.isTourActive=!1,this.stepIndex=0,this.popoverTitle="",this.popoverDescription="",this.steps=[],this.showProgress=!0,this.bottomMargin=110,this.configurations={},this.type="guide",this.highlightedElement=null,this.isThrottling=!1,this.originalBodyOverflow=null,this.originalDrawerOverflow=null,this.drawerContainer=null,this.drawerScrollTimeout=null,this.cachedRootElement=null,this.cachedNodesWithStyles=[],this.focusableSelector='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',this.boundThrottledStageUpdate=this.throttledStageUpdate.bind(this),this.boundHandleDocumentClick=this.handleDocumentClick.bind(this),this.boundHandleKeydown=this.handleKeydown.bind(this),this.boundOnDrawerScroll=this.onDrawerScroll.bind(this),this.boundHandleWindowScroll=this.handleWindowScroll.bind(this),this.scrollDisableTransitionTimeout=null,this.styleURL=new URL("./onboarding/onboarding.css",this.getBaseURL())}get currentStep(){return this.steps[this.stepIndex]}disconnectedCallback(){super.disconnectedCallback(),this.removeHighlight(),this.disableHoverBlock(),this.bindGlobalEvents(!1)}startOnboardingTour(){const t=this.getConfig(this.type);t&&(this.steps=t.steps||[],this.showProgress=t.showProgress??!0),!(!this.steps||this.steps.length===0)&&(this.stepIndex=0,this.applyCurrentStep(),this.isTourActive=!0,this.bindGlobalEvents(!0),this.focusPopoverAsync())}endOnboardingTour(){var t;this.removeHighlight(),this.disableHoverBlock(),this.isTourActive=!1,this.stageElement&&Object.assign(this.stageElement.style,{top:"",left:"",width:"",height:""}),this.bindGlobalEvents(!1),(t=this.triggerButton)==null||t.focus(),this.dispatchEvent(new CustomEvent(f))}shouldShowProgress(){return this.showProgress}render(){return this.isTourActive?h`
|
|
2
2
|
<div class="mealz-onboarding-overlay" aria-hidden="true"></div>
|
|
3
3
|
<div class="mealz-onboarding-stage" aria-hidden="true" @click=${()=>this.goToNextStep()}></div>
|
|
4
4
|
<div class="mealz-onboarding-popover ${this.bottomMargin===0?"mealz-onboarding-popover__no-bottom-radius":""}"
|
|
@@ -38,4 +38,4 @@ import{N as g,k as h}from"../assets/no-shadow-element-DlGA0h9b.js";import{t as v
|
|
|
38
38
|
${this.isFinalStep()?"J'ai compris":"Suivant"}
|
|
39
39
|
</span>
|
|
40
40
|
</button>
|
|
41
|
-
`}isFinalStep(){return this.stepIndex>=this.steps.length-1}goToNextStep(){if(this.isFinalStep())return this.dispatchEvent(new CustomEvent(b)),this.endOnboardingTour();this.disableHoverBlock(),this.stepIndex+=1,this.applyCurrentStep(),this.dispatchEvent(new CustomEvent(E,{detail:{stepIndex:this.stepIndex}}))}applyCurrentStep(){var o;if(this.removeHighlight(),!this.currentStep)return;const t=this.getCurrentElement();t&&(this.highlightedElement=t,t.classList.add("mealz-onboarding-highlight"),!this.isElementFullyVisible(t)&&t.tagName.toLowerCase()!=="div"&&t.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),requestAnimationFrame(()=>{this.updateStagePosition(),this.updatePopoverPosition()}));const e=((o=this.currentStep)==null?void 0:o.popover)||{};this.popoverTitle=e.title||"",this.popoverDescription=e.description||"",this.enableHoverBlock(),this.focusPopoverAsync()}getCurrentElement(){var e;const t=(e=this.currentStep)==null?void 0:e.element;try{if(typeof t=="string"){const o=document.querySelector(t);if(o&&this.isElementFullyVisible(o))return o;const
|
|
41
|
+
`}isFinalStep(){return this.stepIndex>=this.steps.length-1}goToNextStep(){if(this.isFinalStep())return this.dispatchEvent(new CustomEvent(b)),this.endOnboardingTour();this.disableHoverBlock(),this.stepIndex+=1,this.applyCurrentStep(),this.dispatchEvent(new CustomEvent(E,{detail:{stepIndex:this.stepIndex}}))}applyCurrentStep(){var o;if(this.removeHighlight(),!this.currentStep)return;const t=this.getCurrentElement();t&&(this.highlightedElement=t,t.classList.add("mealz-onboarding-highlight"),!this.isElementFullyVisible(t)&&t.tagName.toLowerCase()!=="div"&&t.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),requestAnimationFrame(()=>{this.updateStagePosition(),this.updatePopoverPosition()}));const e=((o=this.currentStep)==null?void 0:o.popover)||{};this.popoverTitle=e.title||"",this.popoverDescription=e.description||"",this.enableHoverBlock(),this.focusPopoverAsync()}getCurrentElement(){var e;const t=(e=this.currentStep)==null?void 0:e.element;try{if(typeof t=="string"){const o=document.querySelector(t);if(o&&this.isElementFullyVisible(o))return o;const s=Array.from(document.querySelectorAll(t));return s.length===0?null:s.find(r=>this.isElementFullyVisible(r))||s[0]||null}return t||null}catch(o){return console.warn("Failed to get element for onboarding:",o),null}}isElementFullyVisible(t){if(!(t instanceof HTMLElement))return!1;const e=t.getBoundingClientRect();return e.top>=0&&e.bottom<=window.innerHeight}resetStageElement(){this.stageElement&&Object.assign(this.stageElement.style,{top:"",left:"",width:"",height:""})}updateStagePosition(){if(!this.stageElement)return;const t=this.highlightedElement;if(!t){this.resetStageElement();return}const e=10,o=t.getBoundingClientRect(),s={top:0,left:0,right:window.innerWidth,bottom:window.innerHeight},i={top:Math.max(o.top,s.top),bottom:Math.min(o.bottom,s.bottom),left:Math.max(o.left,s.left),right:Math.min(o.right,s.right)};if(this.applyClippingElements(t,i),i.top>=i.bottom||i.left>=i.right){this.resetStageElement();return}Object.assign(this.stageElement.style,{position:"fixed",top:`${i.top-e}px`,left:`${i.left-e}px`,width:`${i.right-i.left+e*2}px`,height:`${i.bottom-i.top+e*2}px`})}applyClippingElements(t,e){[".mealz-planner-current-menu__footer"].forEach(s=>{var a,p;const i=document.querySelector(s);if(!i||!((a=i.parentElement)!=null&&a.contains(t))||(p=t.parentElement)!=null&&p.contains(i))return;const r=i.getBoundingClientRect();r.top<e.bottom&&r.bottom>e.top&&(e.bottom=Math.min(e.bottom,r.top))})}setStageTransitionEnabled(t){this.stageElement&&(this.stageElement.style.transition=t?"":"none")}handleWindowScroll(){this.isTourActive&&(this.setStageTransitionEnabled(!1),this.updateStagePosition(),this.updatePopoverPosition(),this.scrollDisableTransitionTimeout&&clearTimeout(this.scrollDisableTransitionTimeout),this.scrollDisableTransitionTimeout=window.setTimeout(()=>{this.setStageTransitionEnabled(!0),this.scrollDisableTransitionTimeout=null},120))}throttledStageUpdate(){this.isThrottling||(this.isThrottling=!0,requestAnimationFrame(()=>{this.updateStagePosition(),this.updatePopoverPosition(),this.isThrottling=!1}))}updatePopoverPosition(){var p,m;if(!this.popoverElement||!((m=(p=this.currentStep)==null?void 0:p.popover)!=null&&m.overElement))return;let t=null;const e=this.currentStep.popover.overElement;if(typeof e=="string"?t=document.querySelector(e):e instanceof HTMLElement&&(t=e),!t)return;const o=t.getBoundingClientRect(),s=this.currentStep.popover.spacerTop??0,i=this.currentStep.popover.spacerLeft??0,r=this.currentStep.popover.spacerRight??0,a=this.currentStep.popover.spacerBottom??0;this.popoverElement.style.top=`${o.top}px`,this.popoverElement.style.left=`${o.left}px`,this.popoverElement.style.right="initial",this.popoverElement.style.bottom="initial",this.popoverElement.style.transform="initial",r&&(this.popoverElement.style.left="initial",this.popoverElement.style.right=`${o.right+r}px`),a&&(this.popoverElement.style.top="initial",this.popoverElement.style.bottom=`${o.bottom+a}px`),s&&(this.popoverElement.style.top=`${o.top+s}px`),i&&(this.popoverElement.style.left=`${o.left+i}px`)}onDrawerScroll(){this.setStageTransitionEnabled(!1),this.updateStagePosition(),this.updatePopoverPosition(),this.drawerScrollTimeout&&clearTimeout(this.drawerScrollTimeout),this.drawerScrollTimeout=window.setTimeout(()=>{this.setStageTransitionEnabled(!0),this.drawerScrollTimeout=null},120)}handleKeydown(t){this.isTourActive&&(t.key==="Escape"&&this.endOnboardingTour(),t.key==="Tab"&&this.popoverElement&&this.trapFocusWithinPopover(t))}handleDocumentClick(t){!this.isTourActive||t.target.closest(".mealz-onboarding-popover")||(t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),this.goToNextStep())}getDrawerContainer(){return this.drawerContainer||(this.drawerContainer=document.querySelector(".mealz-drawer__content-container")),this.drawerContainer}enableHoverBlock(){this.getCurrentElement()&&this.toggleHoverBlock("none","default")}disableHoverBlock(){if(this.getCurrentElement()){this.toggleHoverBlock("auto","");return}this.cachedNodesWithStyles.length&&this.cachedNodesWithStyles.forEach(({element:e,pointerEvents:o,cursor:s})=>{e.style.pointerEvents=o,e.style.cursor=s}),this.cachedRootElement=null,this.cachedNodesWithStyles=[]}toggleHoverBlock(t,e){const o=this.getCurrentElement();if(o){if(this.cachedRootElement!==o||this.cachedNodesWithStyles.length===0){this.cachedRootElement=o;const s=Array.from(o.querySelectorAll("*")),i=[o,...s];this.cachedNodesWithStyles=i.map(r=>{const a=window.getComputedStyle(r);return{element:r,pointerEvents:a.pointerEvents||"",cursor:a.cursor||""}})}if(t==="auto"&&e===""){this.cachedNodesWithStyles.forEach(({element:s,pointerEvents:i,cursor:r})=>{s.style.pointerEvents=i,s.style.cursor=r}),this.cachedRootElement=null,this.cachedNodesWithStyles=[];return}this.cachedNodesWithStyles.forEach(({element:s})=>{s.style.pointerEvents=t,s.style.cursor=e})}}removeHighlight(){this.highlightedElement&&(this.highlightedElement.classList.remove("mealz-onboarding-highlight"),this.highlightedElement=null)}getConfig(t){var e,o;return((e=this.configurations)==null?void 0:e[t])||((o=this.configurations)==null?void 0:o.guide)}hasSeenOnboarding(t){const e=this.getConfig(t);if(!(e!=null&&e.localStorageKey))return!1;try{return localStorage.getItem(e.localStorageKey)==="true"}catch{return!1}}bindGlobalEvents(t){var o;const e=t?"addEventListener":"removeEventListener";window[e]("scroll",this.boundHandleWindowScroll,{capture:!0,passive:!0}),window[e]("resize",this.boundThrottledStageUpdate,!0),document[e]("click",this.boundHandleDocumentClick,!0),document[e]("keydown",this.boundHandleKeydown,!0),this.drawerContainer=this.getDrawerContainer(),(o=this.drawerContainer)==null||o[e]("scroll",this.boundOnDrawerScroll,{passive:!0}),t||(this.drawerContainer=null,this.drawerScrollTimeout&&(clearTimeout(this.drawerScrollTimeout),this.drawerScrollTimeout=null))}focusPopoverAsync(){this.updateComplete.then(()=>{if(!this.popoverElement)return;const t=this.popoverElement.querySelector(".mealz-onboarding-popover__footer button");if(t){t.focus({preventScroll:!0});return}})}trapFocusWithinPopover(t){if(!this.popoverElement)return;const e=this.popoverElement.querySelectorAll(this.focusableSelector),o=e[0],s=e[e.length-1],i=document.activeElement;if(!(!!i&&this.popoverElement.contains(i))){t.preventDefault(),(o||this.popoverElement).focus();return}if(t.shiftKey&&i===o){t.preventDefault(),(s||this.popoverElement).focus();return}!t.shiftKey&&i===s&&(t.preventDefault(),(o||this.popoverElement).focus())}};l([u()],n.prototype,"isTourActive",2);l([u()],n.prototype,"stepIndex",2);l([u()],n.prototype,"popoverTitle",2);l([u()],n.prototype,"popoverDescription",2);l([d(".mealz-onboarding-stage")],n.prototype,"stageElement",2);l([d(".mealz-onboarding-popover")],n.prototype,"popoverElement",2);l([d('button[aria-label="Start onboarding"]')],n.prototype,"triggerButton",2);l([c({type:Array})],n.prototype,"steps",2);l([c({type:Boolean})],n.prototype,"showProgress",2);l([c({type:Number})],n.prototype,"bottomMargin",2);l([c({attribute:!1})],n.prototype,"configurations",2);l([c({type:String})],n.prototype,"type",2);n=l([v("mealz-onboarding")],n);export{n as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../drawer-view-swapper/drawer-view-swapper.min.js";import"../../slider-tabs/slider-tabs.min.js";import"../planner-onboarding-modal/planner-onboarding-modal.min.js";import"../to-basket-loader/to-basket-loader.min.js";import{o as u}from"../helpers/open-onboarding-modal.min.js";import{M as b}from"../planner-abandon-modal/planner-abandon-modal.min.js";import{i as g,a as f,M as d}from"../planner-onboarding/planner-onboarding.min.js";import{M as y}from"../planner-open-catalog-modal/planner-open-catalog-modal.min.js";import{M}from"../planner-welcome-modal/planner-welcome-modal.min.js";import{N as C,B as v}from"../../assets/no-shadow-element-DlGA0h9b.js";import{t as w}from"../../assets/custom-element-BhZVzxrc.js";import{r as B}from"../../assets/state-bsKs-Mb2.js";import{m as o}from"../../assets/mealz-sdk-DWLzEfKz.js";import{t as a}from"../../assets/take-BmqRVy-3.js";import{f as m}from"../../assets/filter-DuHsB8oM.js";import{m as p}from"../../assets/map-oxUcVNGT.js";import{c as R}from"../../assets/combineLatest-DNi66MsF.js";import"../../drawer/drawer.min.js";import"../../assets/property-Bg80vXcm.js";import"../../assets/unsafe-html-MRC87lfr.js";import"../../store-locator-drawer/store-locator-drawer.min.js";import"../../assets/skipWhile-BAgfjfH2.js";import"../../assets/OperatorSubscriber-z_a6lCKk.js";import"../../assets/switchMap-vA0vSKy4.js";import"../../assets/innerFrom-CVMPVEmB.js";import"../../recipe-details/recipe-details.min.js";import"../../recipe-pricing/recipe-pricing.min.js";import"../../assets/from-Btz8AgkO.js";import"../../assets/executeSchedule-CTqB8mra.js";import"../../assets/mapOneOrManyArgs-Do0PsDok.js";import"../../assets/of-CH-D5SN9.js";import"../../assets/tap-C4xC1M3N.js";import"../../assets/empty-DGYYDWIm.js";import"../../assets/price-DcNF55ef.js";import"../../assets/recipe-BwGs-blm.js";import"../../assets/merge-OrXqfOOP.js";import"../../assets/mergeMap-CMaM5Agw.js";import"../../assets/capitalize-DUAqYmp4.js";import"../../counter/counter.min.js";import"../../assets/debounceTime-CIA2MWDj.js";import"../../assets/async-H-Co76Oa.js";import"../../assets/product-card-Be_9YL6f.js";import"../../price/price.min.js";import"../../assets/promotion-badge-2uUuiRau.js";import"../../assets/delay-0L99jHsb.js";import"../../assets/timer-DmQ_oP6s.js";import"../../store-indicator/store-indicator.min.js";import"../../assets/store-locator-CKwiyckb.js";import"../../assets/query-BApjzB0v.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"../../last-order-modal/last-order-modal.min.js";import"../../onboarding/onboarding.min.js";import"../../onboarding/events.min.js";import"../../onboarding/analytics/onboarding-analytics.min.js";import"../planner-catalog/planner-catalog.min.js";import"../../catalog/catalog-load-more.min.js";import"../../assets/http-BGziD2u2.js";import"../../replace-item/replace-item.min.js";import"../../replace-item/replace-item-card/replace-item-card.min.js";import"../../assets/price-utils-BRFZa-3D.js";import"../../assets/distinctUntilChanged-Ckq1Syk_.js";import"../../replace-item-planner/replace-item-planner.min.js";import"../../replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js";import"../../history-drawer/history-drawer.min.js";import"../../catalog/basket-preview/basket-preview.min.js";import"../../modal/modal.min.js";var _=Object.defineProperty,z=Object.getOwnPropertyDescriptor,h=(e,t,n,r)=>{for(var i=r>1?void 0:r?z(t,n):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(r?c(t,n,i):c(i))||i);return r&&i&&_(t,n,i),i};let l=class extends C{constructor(){super(...arguments),this.analyticsPath="/meals-planner/current",this.loaderToBasketComplete$=new v(!1),this.subscriptions=[],this.isCustomMenu=!1,this.isMobile=!1}get selectors(){return{recipe:".mealz-planner-current-menu__recipe",menu:".mealz-planner-current-menu__menu",displayMenuButton:".mealz-planner-current-menu__mobile-menu-button",displayRecipeButton:".mealz-planner-current-menu__mobile-recipe-button",returnButton:".mealz-planner-current-menu__mobile-return-button",preferencesButton:".mealz-planner-current-menu__menu-header-preferences",preferencesMobileButton:".mealz-planner-current-menu__mobile-preferences-button",onboardingButton:".mealz-planner-current-menu__onboarding-button",onboardingButtonMobile:".mealz-planner-current-menu__mobile-onboarding-button",cancelMenuButton:".mealz-planner-current-menu__cancel-menu-button",footerButton:".mealz-planner-current-menu__footer-button",footerIcon:".mealz-planner-current-menu__footer-icon",footerDisabledIcon:".mealz-planner-current-menu__footer-disabled-icon",recipeCounterBadge:".mealz-planner-current-menu__menu-badge",preferencesCounterBadges:[".mealz-planner-current-menu__preferences-badge"],mealExtras:[".mealz-planner-current-menu__meal-extras-choice"]}}get nbrRecipeInMenu(){return this.querySelectorAll(".mealz-planner-recipe-card").length}connectedCallback(){super.connectedCallback(),this.pageview(),this.initSelectors(),this.addEventListeners(),this.isMobile=g(this),this.handleResize(),this.removeResponsiveListener=f(this,e=>{e!==this.isMobile&&(this.isMobile=e),this.handleResize()}),o.recipes.setIsRecipeDetailsFromPlanner(!0),this.isCustomMenu=localStorage.getItem("_miam/isCustomMenu")==="true",this.isCustomMenu||this.setDefaultMobileView(),this.subscriptions.push(o.preferences.preferencesCount().subscribe(e=>this.updatePreferencesCount(e))),this.updateRecipeCounterBadge(this.nbrRecipeInMenu),this.showWelcomeModal()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.removeResponsiveListener&&(this.removeResponsiveListener(),this.removeResponsiveListener=void 0)}render(){const e=this.getAttribute("starting-data");e&&(Object.assign(this,JSON.parse(e)),this.removeAttribute("starting-data"))}showWelcomeModal(){const e=this.isCustomMenu?"_miam/customMenuOnboarding":"_miam/suggestionOnboarding";if(localStorage.getItem(e)==="true")return;const n=new M;n.isCustomMenu=this.isCustomMenu,n.addEventListener("openOnboarding",r=>{const i=r.detail??{};this.startPlannerOnboarding(i.isCustomMenu??this.isCustomMenu,!1)}),n.addEventListener("onboarding-skipped",()=>{localStorage.setItem(e,"true"),this.startPlannerOnboarding(!1,!0)}),n.displayPlannerWelcomeModal(),this.autoCloseWelcomeOnDrawerOpen(n)}autoCloseWelcomeOnDrawerOpen(e){requestAnimationFrame(()=>{const n=document.querySelector("mealz-drawer-view-swapper");if(!n)return;const r=n.currentView$.subscribe(i=>{i!==void 0&&(document.body.contains(e)&&e.remove(),r.unsubscribe())})})}startPlannerOnboarding(e,t){this.scrollIntoView({behavior:"smooth",block:"center"});const n=new d;n.isCustomMenu=e,document.body.appendChild(n),t?(n.type=this.isMobile?"guide-mobile":"guide",n.launchOnboardingTour()):(this.isMobile?n.type=e?"custom-mobile":"suggestion-mobile":n.type=e?"custom":"suggestion",n.startTour())}addEventListeners(){this.addClickListener("displayMenuButton",()=>{this.toggleMobileView(!0)}),this.addClickListener("displayRecipeButton",()=>{this.toggleMobileView(!1)}),this.addClickListener("preferencesButton",()=>{this.openPreferences()}),this.addClickListener("preferencesMobileButton",()=>{this.openPreferences()}),this.addClickListener("cancelMenuButton",this.cancelMenu.bind(this)),this.addClickListener("footerButton",()=>{this.handleMenu()}),this.addClickListener("onboardingButton",()=>u("current")),this.addClickListener("onboardingButtonMobile",()=>u("current"));const{mealExtras:e}=this.elements;e==null||e.forEach(t=>{t.addEventListener("click",this.openCatalogSelection.bind(this))})}toggleMobileView(e){const{recipe:t,menu:n,displayMenuButton:r,displayRecipeButton:i,returnButton:s}=this.elements;!t||!n||!r||!i||!s||(t.style.display=e?"none":"block",n.style.display=e?"flex":"none",r.style.display=e?"none":"flex",i.style.display=e?"block":"none",s.style.display=e?"none":"block")}setDefaultMobileView(){this.isMobile&&this.toggleMobileView(!0)}handleResize(){const{menu:e,recipe:t}=this.elements;!e||!t||(this.isMobile?this.toggleMobileView(!1):(e.style.display="flex",t.style.display="block"))}async openPreferences(){const e=document.querySelector("mealz-drawer-view-swapper");e&&(e.displayPreferences$.next(!0),await e.updateComplete)}updatePreferencesCount(e){const{preferencesCounterBadges:t}=this.elements;t&&t.forEach(n=>{const r=n.querySelector("p");r&&(r.textContent=e.toString(),n.classList.toggle("hidden",e===0))})}updateRecipeCounterBadge(e){const{recipeCounterBadge:t}=this.elements;if(!t)return;const n=t.querySelector("p");n.textContent=e.toString(),t.classList.toggle("hidden",e===0)}openCatalogSelection(e){const t=e.target.closest(".mealz-planner-current-menu__meal-extras-choice");if(!t)return;const r=["starter","dessert","drink"].find(i=>t.classList.contains(i));r&&(this.openCatalogDrawer(r),this.categoryDisplayEvent(r))}cancelMenu(){const e=new b;e.addEventListener("resetMenu",()=>this.resetMenu()),e.displayPlannerAbandonModal()}resetMenu(){const e=o.planner.deleteMenu(this.menuId);this.resetMenuEvent(),e.pipe(a(1)).subscribe(()=>{this.updateRecipeCounterBadge(0),this.redirectToDashboard()})}redirectToDashboard(){var e;(e=this.plannerRoutes)!=null&&e.dashboard&&(window.location.href=this.plannerRoutes.dashboard)}redirectToRetailerCart(){var e,t;if((e=this.plannerRoutes)!=null&&e.retailerCart){window.location.href=this.plannerRoutes.retailerCart;return}(t=this.plannerRoutes)!=null&&t.catalogHome&&(window.location.href=this.plannerRoutes.catalogHome+"?myMeals=products")}handleMenu(){this.storeId?(this.displayAddToBasketLoaderView(),this.finalizeMenuEvent(),this.navigateOnceDone()):console.log("register menu")}navigateOnceDone(){const e=this.loaderToBasketComplete$.pipe(m(n=>n===!0),a(1)),t=o.planner.menuToBasket(this.basket.id).pipe(a(1),p(()=>o.basket.updateRetailerBasketFromPlanner()));this.subscriptions.push(R([t,e]).pipe(a(1)).subscribe(()=>{this.loaderToBasketElement.remove(),this.redirectToRetailerCart()}))}retrieveRecipesImgs(){const e=[];return document.querySelectorAll(".mealz-planner-recipe-card").forEach(n=>{if(n.querySelector(".mealz-planner-recipe-card__in-basket:not(.hidden)"))return;const i=n.querySelector("img");i&&i.src&&e.push(i.src)}),e}displayAddToBasketLoaderView(){const e=document.querySelector(".mealz-planner-current-menu");if(!e)return;e.style.display="none";const t=this.retrieveRecipesImgs();this.loaderToBasketElement=document.querySelector("mealz-to-basket-loader")||document.createElement("mealz-to-basket-loader"),document.querySelector("mealz-to-basket-loader")||(this.loaderToBasketElement.recipeImgs=t,this.loaderToBasketElement.addEventListener("basketComplete",()=>{this.loaderToBasketComplete$.next(!0)}),e.insertAdjacentElement("afterend",this.loaderToBasketElement))}updateFooterButton(e){const{footerButton:t,footerIcon:n,footerDisabledIcon:r}=this.elements;!t||!n||!r||(t.classList.toggle("disabled",!e),n.classList.toggle("hidden",!e),r.classList.toggle("hidden",e))}openCatalogModal(){const e=new y;e.addEventListener("openCatalog",()=>{this.openCatalogDrawer()}),e.displayMealzPlannerOpenCatalogModal()}async openCatalogDrawer(e){const t=document.querySelector("mealz-drawer-view-swapper");if(!t)return;t.displayPlannerCatalog$.next(!0),await t.updateComplete;const n=document.querySelector("mealz-planner-catalog");n&&(n.setConfig(this.storeId,this.catalogURL,this.sessionId,e),n.getPlannerCatalog(),n.pageview())}addRecipe(e,t){var i,s;const n=(s=(i=o.recipes)==null?void 0:i.productsPlannerByCategory$)==null?void 0:s.value,r=(n==null?void 0:n.toPickProducts)||[];return o.planner.addRecipeToMenu(e,t,!!o.pos.currentPos().value,r).pipe(a(1),p(async()=>{await this.addRecipeToList(e),this.showResetMenuButton(),this.updateFooterButtonState(),this.updateRecipeCounterBadge(this.nbrRecipeInMenu),this.recipeAddedEvent(e),this.shouldShowMenuToBasketOnboarding()}))}removeRecipe(e){return o.planner.removeRecipeFromMenu(e).pipe(a(1),p(()=>{const t=this.findRecipeIndexById(e);t!==-1&&(this.removeRecipeFromList(t),this.updateFooterButtonState(),this.updateRecipeCounterBadge(this.nbrRecipeInMenu),this.recipeRemovedEvent(e))}))}async addRecipeToList(e){const t=document.querySelector("mealz-planner-recipe-list");t&&await t.addRecipeCardToList(e)}removeRecipeFromList(e){const t=document.querySelector("mealz-planner-recipe-list");t&&t.removeRecipeCardFromList(e)}showResetMenuButton(){const e=document.querySelector(".mealz-planner-current-menu__cancel-menu");e&&e.classList.remove("hidden")}shouldShowMenuToBasketOnboarding(){var r;if(localStorage.getItem("_miam/menuToBasketOnboarding")==="true")return;this.isMobile&&this.toggleMobileView(!0);const t=document.querySelector("mealz-drawer-view-swapper");((r=t==null?void 0:t.currentView$)==null?void 0:r.value)!==void 0?this.subscriptions.push(t.currentView$.pipe(m(i=>i===void 0),a(1)).subscribe(()=>{this.showMenuToBasketOnboarding()})):this.showMenuToBasketOnboarding()}showMenuToBasketOnboarding(){this.updateComplete.then(()=>{const e=new d;e.type=this.isMobile?"menu-to-basket-mobile":"menu-to-basket",document.body.appendChild(e),e.launchOnboardingTour()})}updateFooterButtonState(){const e=this.nbrRecipeInMenu>0;this.updateFooterButton(e)}findRecipeIndexById(e){const t=document.querySelectorAll("mealz-planner-recipe-card");for(let n=0;n<t.length;n++)if(t[n].recipeId===e)return n;return-1}pageview(){o.analytics.sendEvent("pageview",this.analyticsPath,{})}resetMenuEvent(){o.analytics.sendEvent("planner.reset",this.analyticsPath,{})}finalizeMenuEvent(){o.analytics.sendEvent("planner.finalize",this.analyticsPath,{budget_user:0,recipe_count:this.nbrRecipeInMenu,guests:this.guests})}recipeAddedEvent(e){o.analytics.sendEvent("planner.recipe.add",this.analyticsPath,{recipe_id:e})}recipeRemovedEvent(e){o.analytics.sendEvent("planner.recipe.delete",this.analyticsPath,{recipe_id:e})}categoryDisplayEvent(e){o.analytics.sendEvent("category.display",this.analyticsPath,{category_id:e})}};h([B()],l.prototype,"isMobile",2);l=h([w("mealz-planner-current-menu")],l);customElements.get("mealz-planner-current-menu")||customElements.define("mealz-planner-current-menu",l);
|
|
1
|
+
import"../../drawer-view-swapper/drawer-view-swapper.min.js";import"../../slider-tabs/slider-tabs.min.js";import"../planner-onboarding-modal/planner-onboarding-modal.min.js";import"../to-basket-loader/to-basket-loader.min.js";import{o as u}from"../helpers/open-onboarding-modal.min.js";import{M as b}from"../planner-abandon-modal/planner-abandon-modal.min.js";import{i as g,a as f,M as d}from"../planner-onboarding/planner-onboarding.min.js";import{M as y}from"../planner-open-catalog-modal/planner-open-catalog-modal.min.js";import{M}from"../planner-welcome-modal/planner-welcome-modal.min.js";import{N as C,B as v}from"../../assets/no-shadow-element-DlGA0h9b.js";import{t as w}from"../../assets/custom-element-BhZVzxrc.js";import{r as B}from"../../assets/state-bsKs-Mb2.js";import{m as o}from"../../assets/mealz-sdk-DWLzEfKz.js";import{t as a}from"../../assets/take-BmqRVy-3.js";import{f as m}from"../../assets/filter-DuHsB8oM.js";import{m as p}from"../../assets/map-oxUcVNGT.js";import{c as R}from"../../assets/combineLatest-DNi66MsF.js";import"../../drawer/drawer.min.js";import"../../assets/property-Bg80vXcm.js";import"../../assets/unsafe-html-MRC87lfr.js";import"../../store-locator-drawer/store-locator-drawer.min.js";import"../../assets/skipWhile-BAgfjfH2.js";import"../../assets/OperatorSubscriber-z_a6lCKk.js";import"../../assets/switchMap-vA0vSKy4.js";import"../../assets/innerFrom-CVMPVEmB.js";import"../../recipe-details/recipe-details.min.js";import"../../recipe-pricing/recipe-pricing.min.js";import"../../assets/from-Btz8AgkO.js";import"../../assets/executeSchedule-CTqB8mra.js";import"../../assets/mapOneOrManyArgs-Do0PsDok.js";import"../../assets/of-CH-D5SN9.js";import"../../assets/tap-C4xC1M3N.js";import"../../assets/empty-DGYYDWIm.js";import"../../assets/price-DcNF55ef.js";import"../../assets/merge-BlKu2J03.js";import"../../assets/mergeAll-DQItozZ-.js";import"../../assets/mergeMap-CMaM5Agw.js";import"../../assets/capitalize-DUAqYmp4.js";import"../../counter/counter.min.js";import"../../assets/debounceTime-CIA2MWDj.js";import"../../assets/async-H-Co76Oa.js";import"../../assets/product-card-Be_9YL6f.js";import"../../price/price.min.js";import"../../assets/promotion-badge-2uUuiRau.js";import"../../assets/delay-0L99jHsb.js";import"../../assets/timer-DmQ_oP6s.js";import"../../store-indicator/store-indicator.min.js";import"../../assets/store-locator-CKwiyckb.js";import"../../assets/query-BApjzB0v.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"../../last-order-modal/last-order-modal.min.js";import"../../onboarding/onboarding.min.js";import"../../onboarding/events.min.js";import"../../onboarding/analytics/onboarding-analytics.min.js";import"../planner-catalog/planner-catalog.min.js";import"../../catalog/catalog-load-more.min.js";import"../../assets/http-BGziD2u2.js";import"../../replace-item/replace-item.min.js";import"../../replace-item/replace-item-card/replace-item-card.min.js";import"../../assets/price-utils-BRFZa-3D.js";import"../../assets/distinctUntilChanged-Ckq1Syk_.js";import"../../replace-item-planner/replace-item-planner.min.js";import"../../replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js";import"../../history-drawer/history-drawer.min.js";import"../../catalog/basket-preview/basket-preview.min.js";import"../../modal/modal.min.js";var _=Object.defineProperty,z=Object.getOwnPropertyDescriptor,h=(e,t,n,r)=>{for(var i=r>1?void 0:r?z(t,n):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(r?c(t,n,i):c(i))||i);return r&&i&&_(t,n,i),i};let l=class extends C{constructor(){super(...arguments),this.analyticsPath="/meals-planner/current",this.loaderToBasketComplete$=new v(!1),this.subscriptions=[],this.isCustomMenu=!1,this.isMobile=!1}get selectors(){return{recipe:".mealz-planner-current-menu__recipe",menu:".mealz-planner-current-menu__menu",displayMenuButton:".mealz-planner-current-menu__mobile-menu-button",displayRecipeButton:".mealz-planner-current-menu__mobile-recipe-button",returnButton:".mealz-planner-current-menu__mobile-return-button",preferencesButton:".mealz-planner-current-menu__menu-header-preferences",preferencesMobileButton:".mealz-planner-current-menu__mobile-preferences-button",onboardingButton:".mealz-planner-current-menu__onboarding-button",onboardingButtonMobile:".mealz-planner-current-menu__mobile-onboarding-button",cancelMenuButton:".mealz-planner-current-menu__cancel-menu-button",footerButton:".mealz-planner-current-menu__footer-button",footerIcon:".mealz-planner-current-menu__footer-icon",footerDisabledIcon:".mealz-planner-current-menu__footer-disabled-icon",recipeCounterBadge:".mealz-planner-current-menu__menu-badge",preferencesCounterBadges:[".mealz-planner-current-menu__preferences-badge"],mealExtras:[".mealz-planner-current-menu__meal-extras-choice"]}}get nbrRecipeInMenu(){return this.querySelectorAll(".mealz-planner-recipe-card").length}connectedCallback(){super.connectedCallback(),this.pageview(),this.initSelectors(),this.addEventListeners(),this.isMobile=g(this),this.handleResize(),this.removeResponsiveListener=f(this,e=>{e!==this.isMobile&&(this.isMobile=e),this.handleResize()}),o.recipes.setIsRecipeDetailsFromPlanner(!0),this.isCustomMenu=localStorage.getItem("_miam/isCustomMenu")==="true",this.isCustomMenu||this.setDefaultMobileView(),this.subscriptions.push(o.preferences.preferencesCount().subscribe(e=>this.updatePreferencesCount(e))),this.updateRecipeCounterBadge(this.nbrRecipeInMenu),this.showWelcomeModal()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.removeResponsiveListener&&(this.removeResponsiveListener(),this.removeResponsiveListener=void 0)}render(){const e=this.getAttribute("starting-data");e&&(Object.assign(this,JSON.parse(e)),this.removeAttribute("starting-data"))}showWelcomeModal(){const e=this.isCustomMenu?"_miam/customMenuOnboarding":"_miam/suggestionOnboarding";if(localStorage.getItem(e)==="true")return;const n=new M;n.isCustomMenu=this.isCustomMenu,n.addEventListener("openOnboarding",r=>{const i=r.detail??{};this.startPlannerOnboarding(i.isCustomMenu??this.isCustomMenu,!1)}),n.addEventListener("onboarding-skipped",()=>{localStorage.setItem(e,"true"),this.startPlannerOnboarding(!1,!0)}),n.displayPlannerWelcomeModal(),this.autoCloseWelcomeOnDrawerOpen(n)}autoCloseWelcomeOnDrawerOpen(e){requestAnimationFrame(()=>{const n=document.querySelector("mealz-drawer-view-swapper");if(!n)return;const r=n.currentView$.subscribe(i=>{i!==void 0&&(document.body.contains(e)&&e.remove(),r.unsubscribe())})})}startPlannerOnboarding(e,t){this.scrollIntoView({behavior:"smooth",block:"center"});const n=new d;n.isCustomMenu=e,document.body.appendChild(n),t?(n.type=this.isMobile?"guide-mobile":"guide",n.launchOnboardingTour()):(this.isMobile?n.type=e?"custom-mobile":"suggestion-mobile":n.type=e?"custom":"suggestion",n.startTour())}addEventListeners(){this.addClickListener("displayMenuButton",()=>{this.toggleMobileView(!0)}),this.addClickListener("displayRecipeButton",()=>{this.toggleMobileView(!1)}),this.addClickListener("preferencesButton",()=>{this.openPreferences()}),this.addClickListener("preferencesMobileButton",()=>{this.openPreferences()}),this.addClickListener("cancelMenuButton",this.cancelMenu.bind(this)),this.addClickListener("footerButton",()=>{this.handleMenu()}),this.addClickListener("onboardingButton",()=>u("current")),this.addClickListener("onboardingButtonMobile",()=>u("current"));const{mealExtras:e}=this.elements;e==null||e.forEach(t=>{t.addEventListener("click",this.openCatalogSelection.bind(this))})}toggleMobileView(e){const{recipe:t,menu:n,displayMenuButton:r,displayRecipeButton:i,returnButton:s}=this.elements;!t||!n||!r||!i||!s||(t.style.display=e?"none":"block",n.style.display=e?"flex":"none",r.style.display=e?"none":"flex",i.style.display=e?"block":"none",s.style.display=e?"none":"block")}setDefaultMobileView(){this.isMobile&&this.toggleMobileView(!0)}handleResize(){const{menu:e,recipe:t}=this.elements;!e||!t||(this.isMobile?this.toggleMobileView(!1):(e.style.display="flex",t.style.display="block"))}async openPreferences(){const e=document.querySelector("mealz-drawer-view-swapper");e&&(e.displayPreferences$.next(!0),await e.updateComplete)}updatePreferencesCount(e){const{preferencesCounterBadges:t}=this.elements;t&&t.forEach(n=>{const r=n.querySelector("p");r&&(r.textContent=e.toString(),n.classList.toggle("hidden",e===0))})}updateRecipeCounterBadge(e){const{recipeCounterBadge:t}=this.elements;if(!t)return;const n=t.querySelector("p");n.textContent=e.toString(),t.classList.toggle("hidden",e===0)}openCatalogSelection(e){const t=e.target.closest(".mealz-planner-current-menu__meal-extras-choice");if(!t)return;const r=["starter","dessert","drink"].find(i=>t.classList.contains(i));r&&(this.openCatalogDrawer(r),this.categoryDisplayEvent(r))}cancelMenu(){const e=new b;e.addEventListener("resetMenu",()=>this.resetMenu()),e.displayPlannerAbandonModal()}resetMenu(){const e=o.planner.deleteMenu(this.menuId);this.resetMenuEvent(),e.pipe(a(1)).subscribe(()=>{this.updateRecipeCounterBadge(0),this.redirectToDashboard()})}redirectToDashboard(){var e;(e=this.plannerRoutes)!=null&&e.dashboard&&(window.location.href=this.plannerRoutes.dashboard)}redirectToRetailerCart(){var e,t;if((e=this.plannerRoutes)!=null&&e.retailerCart){window.location.href=this.plannerRoutes.retailerCart;return}(t=this.plannerRoutes)!=null&&t.catalogHome&&(window.location.href=this.plannerRoutes.catalogHome+"?myMeals=products")}handleMenu(){this.storeId?(this.displayAddToBasketLoaderView(),this.finalizeMenuEvent(),this.navigateOnceDone()):console.log("register menu")}navigateOnceDone(){const e=this.loaderToBasketComplete$.pipe(m(n=>n===!0),a(1)),t=o.planner.menuToBasket(this.basket.id).pipe(a(1),p(()=>o.basket.updateRetailerBasketFromPlanner()));this.subscriptions.push(R([t,e]).pipe(a(1)).subscribe(()=>{this.loaderToBasketElement.remove(),this.redirectToRetailerCart()}))}retrieveRecipesImgs(){const e=[];return document.querySelectorAll(".mealz-planner-recipe-card").forEach(n=>{if(n.querySelector(".mealz-planner-recipe-card__in-basket:not(.hidden)"))return;const i=n.querySelector("img");i&&i.src&&e.push(i.src)}),e}displayAddToBasketLoaderView(){const e=document.querySelector(".mealz-planner-current-menu");if(!e)return;e.style.display="none";const t=this.retrieveRecipesImgs();this.loaderToBasketElement=document.querySelector("mealz-to-basket-loader")||document.createElement("mealz-to-basket-loader"),document.querySelector("mealz-to-basket-loader")||(this.loaderToBasketElement.recipeImgs=t,this.loaderToBasketElement.addEventListener("basketComplete",()=>{this.loaderToBasketComplete$.next(!0)}),e.insertAdjacentElement("afterend",this.loaderToBasketElement))}updateFooterButton(e){const{footerButton:t,footerIcon:n,footerDisabledIcon:r}=this.elements;!t||!n||!r||(t.classList.toggle("disabled",!e),n.classList.toggle("hidden",!e),r.classList.toggle("hidden",e))}openCatalogModal(){const e=new y;e.addEventListener("openCatalog",()=>{this.openCatalogDrawer()}),e.displayMealzPlannerOpenCatalogModal()}async openCatalogDrawer(e){const t=document.querySelector("mealz-drawer-view-swapper");if(!t)return;t.displayPlannerCatalog$.next(!0),await t.updateComplete;const n=document.querySelector("mealz-planner-catalog");n&&(n.setConfig(this.storeId,this.catalogURL,this.sessionId,e),n.getPlannerCatalog(),n.pageview())}addRecipe(e,t){var i,s;const n=(s=(i=o.recipes)==null?void 0:i.productsPlannerByCategory$)==null?void 0:s.value,r=(n==null?void 0:n.toPickProducts)||[];return o.planner.addRecipeToMenu(e,t,!!o.pos.currentPos().value,r).pipe(a(1),p(async()=>{await this.addRecipeToList(e),this.showResetMenuButton(),this.updateFooterButtonState(),this.updateRecipeCounterBadge(this.nbrRecipeInMenu),this.recipeAddedEvent(e),this.shouldShowMenuToBasketOnboarding()}))}removeRecipe(e){return o.planner.removeRecipeFromMenu(e).pipe(a(1),p(()=>{const t=this.findRecipeIndexById(e);t!==-1&&(this.removeRecipeFromList(t),this.updateFooterButtonState(),this.updateRecipeCounterBadge(this.nbrRecipeInMenu),this.recipeRemovedEvent(e))}))}async addRecipeToList(e){const t=document.querySelector("mealz-planner-recipe-list");t&&await t.addRecipeCardToList(e)}removeRecipeFromList(e){const t=document.querySelector("mealz-planner-recipe-list");t&&t.removeRecipeCardFromList(e)}showResetMenuButton(){const e=document.querySelector(".mealz-planner-current-menu__cancel-menu");e&&e.classList.remove("hidden")}shouldShowMenuToBasketOnboarding(){var r;if(localStorage.getItem("_miam/menuToBasketOnboarding")==="true")return;this.isMobile&&this.toggleMobileView(!0);const t=document.querySelector("mealz-drawer-view-swapper");((r=t==null?void 0:t.currentView$)==null?void 0:r.value)!==void 0?this.subscriptions.push(t.currentView$.pipe(m(i=>i===void 0),a(1)).subscribe(()=>{this.showMenuToBasketOnboarding()})):this.showMenuToBasketOnboarding()}showMenuToBasketOnboarding(){this.updateComplete.then(()=>{const e=new d;e.type=this.isMobile?"menu-to-basket-mobile":"menu-to-basket",document.body.appendChild(e),e.launchOnboardingTour()})}updateFooterButtonState(){const e=this.nbrRecipeInMenu>0;this.updateFooterButton(e)}findRecipeIndexById(e){const t=document.querySelectorAll("mealz-planner-recipe-card");for(let n=0;n<t.length;n++)if(t[n].recipeId===e)return n;return-1}pageview(){o.analytics.sendEvent("pageview",this.analyticsPath,{})}resetMenuEvent(){o.analytics.sendEvent("planner.reset",this.analyticsPath,{})}finalizeMenuEvent(){o.analytics.sendEvent("planner.finalize",this.analyticsPath,{budget_user:0,recipe_count:this.nbrRecipeInMenu,guests:this.guests})}recipeAddedEvent(e){o.analytics.sendEvent("planner.recipe.add",this.analyticsPath,{recipe_id:e})}recipeRemovedEvent(e){o.analytics.sendEvent("planner.recipe.delete",this.analyticsPath,{recipe_id:e})}categoryDisplayEvent(e){o.analytics.sendEvent("category.display",this.analyticsPath,{category_id:e})}};h([B()],l.prototype,"isMobile",2);l=h([w("mealz-planner-current-menu")],l);customElements.get("mealz-planner-current-menu")||customElements.define("mealz-planner-current-menu",l);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.mealz-modal{height:680px;max-width:600px;max-height:100%;padding:0;z-index:calc(var(--m-z-index-modal) + 2)}.mealz-modal .mealz-modal__header{padding:24px}.mealz-modal .mealz-modal__content-container{padding-top:0;height:calc(100% - 80px);box-sizing:border-box}@media (max-width: 768px){.mealz-modal{height:740px;width:100%;max-width:unset;top:unset;left:0;bottom:0;right:0;border-radius:16px 16px 0 0;transform:none}}.mealz-planner-onboarding-modal{display:flex;flex-direction:column;height:100%}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body{display:flex;flex-direction:column;justify-content:space-between;align-items:center;flex:1;padding:0 24px;overflow:
|
|
1
|
+
.mealz-modal{height:680px;max-width:600px;max-height:100%;padding:0;z-index:calc(var(--m-z-index-modal) + 2)}.mealz-modal .mealz-modal__header{padding:24px}.mealz-modal .mealz-modal__content-container{padding-top:0;height:calc(100% - 80px);box-sizing:border-box}@media (max-width: 768px){.mealz-modal{height:740px;width:100%;max-width:unset;top:unset;left:0;bottom:0;right:0;border-radius:16px 16px 0 0;transform:none}}.mealz-planner-onboarding-modal{display:flex;flex-direction:column;height:100%}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body{display:flex;flex-direction:column;justify-content:space-between;align-items:center;flex:1;padding:0 24px;overflow:auto}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__content{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__content .mealz-planner-onboarding-modal__img{width:100%;height:auto;margin-bottom:16px;max-width:552px}@media (max-width: 768px){.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__content .mealz-planner-onboarding-modal__img{max-width:343px}}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__content .mealz-planner-onboarding-modal__title{margin-bottom:4px;text-align:center}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__content .mealz-planner-onboarding-modal__text{text-align:center}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__content .mealz-planner-onboarding-modal__text span{display:inline;padding:0 4px 0 0}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__content .mealz-planner-onboarding-modal__text .mealz-planner-onboarding-modal__bold{font-weight:700}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__content .mealz-planner-onboarding-modal__text .mealz-planner-onboarding-modal__bold:last-of-type{color:var(--mealz-ds-color-primary)}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__track{display:flex;justify-content:center;width:100%;margin-top:24px}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__track>*:not(:last-child){margin-right:8px}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__track .mealz-planner-onboarding-modal__indicator{width:32px;height:8px;border-radius:50px;background-color:var(--mealz-ds-color-primary, #24748F);opacity:.4;transition:all .3s ease-in-out}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body .mealz-planner-onboarding-modal__track .mealz-planner-onboarding-modal__indicator.active{width:80px;height:8px;opacity:1}@media (max-width: 768px){.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__body{padding:0 16px}}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__navigation-buttons{display:flex;justify-content:center;width:100%;margin-bottom:16px;margin-top:24px}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__navigation-buttons>*:not(:last-child){margin-right:8px}@media (max-width: 768px){.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__navigation-buttons{flex-direction:column-reverse;padding:0 16px}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__navigation-buttons>*:not(:last-child){margin-right:0}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__navigation-buttons>*:not(:first-child){margin-bottom:8px}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__navigation-buttons .mealz-planner-onboarding-modal__previous,.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__navigation-buttons .mealz-planner-onboarding-modal__next{width:100%;flex:1}}.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__previous.hidden,.mealz-planner-onboarding-modal .mealz-planner-onboarding-modal__next.hidden{display:none}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as h,q as m,S as f}from"../../assets/no-shadow-element-DlGA0h9b.js";import{R as S}from"../../assets/recipe-BwGs-blm.js";import{t as R}from"../../assets/custom-element-BhZVzxrc.js";import{m as p}from"../../assets/mealz-sdk-DWLzEfKz.js";import{d as v}from"../../assets/debounceTime-CIA2MWDj.js";import{o as L}from"../../assets/of-CH-D5SN9.js";import{t as d}from"../../assets/take-BmqRVy-3.js";import{t as C}from"../../assets/tap-C4xC1M3N.js";import"../../assets/async-H-Co76Oa.js";import"../../assets/OperatorSubscriber-z_a6lCKk.js";import"../../assets/from-Btz8AgkO.js";import"../../assets/executeSchedule-CTqB8mra.js";import"../../assets/innerFrom-CVMPVEmB.js";import"../../assets/empty-DGYYDWIm.js";var w=Object.getOwnPropertyDescriptor,B=(e,t,s,i)=>{for(var n=i>1?void 0:i?w(t,s):t,o=e.length-1,r;o>=0;o--)(r=e[o])&&(n=r(n)||n);return n};let g=class extends h{constructor(){super(...arguments),this.recipeId="",this.isDragging=!1,this.dragStartX=0,this.initialScrollLeft=0,this.layoutObserver=null,this.menuRecipes=[],this.suggestedRecipes=[],this.buttonClickHandlers=new Map,this.swapRecipeCount=0,this.swapRecipeClick$=new m,this.analyticsPath="/meals-planner/current",this.preferencesSubscription=new f,this.lastShownRecipeId=null}get selectors(){return{buttonsContainer:".mealz-planner-recipe-suggestion__meals-count",title:".mealz-planner-current-menu__recipe-title",removeButtons:".mealz-planner-recipe-suggestion__actions-remove",removeButton:".mealz-planner-recipe-suggestion__actions-remove-button",swapButton:".mealz-planner-recipe-suggestion__actions-swap-button",addButton:".mealz-planner-recipe-suggestion__actions-add-button",seeRecipe:".mealz-planner-recipe-suggestion__see-recipe",promotion:".mealz-planner-recipe-suggestion__recipe-badges-promotion",sponsor:".mealz-planner-recipe-suggestion__recipe-sponsor",addAndSwapButtons:".mealz-planner-recipe-suggestion__actions-add-and-swap",buttons:[".mealz-planner-recipe-suggestion__meals-count-button"],activeButton:".mealz-planner-recipe-suggestion__meals-count-button.primary",pictureContainer:".mealz-planner-recipe-suggestion__picture",picture:".mealz-planner-recipe-suggestion__picture img",sponsorImg:".mealz-planner-recipe-suggestion__recipe-sponsor img"}}connectedCallback(){super.connectedCallback(),this.initSelectors(),this.addEventListeners(),this.swapRecipeClick$.pipe(v(300)).subscribe(()=>this.swapRecipe()),this.subscribeToPreferencesChanges()}disconnectedCallback(){super.disconnectedCallback(),this.layoutObserver&&this.layoutObserver.disconnect(),this.swapRecipeClick$.complete(),this.preferencesSubscription.unsubscribe()}render(){const{buttonsContainer:e,buttons:t}=this.elements;!e||!t.length||this.mealsCountButtonsListener(t)}firstUpdated(){var i,n;const{buttonsContainer:e,buttons:t}=this.elements;if(!e||!t.length)return;this.initScrolling(e,t),this.initDragScrolling(e);const s=(i=this.attributes["starting-data"])==null?void 0:i.value;s&&(Object.assign(this,JSON.parse(s)),this.recipeId=(n=this.recipeDisplayed)==null?void 0:n.id,t.length===1&&this.recipeId&&this.suggestionShownEvent(),this.removeAttribute("starting-data"))}addEventListeners(){this.addClickListener("removeButton",()=>this.removeRecipe().subscribe()),this.addClickListener("swapButton",()=>this.swapRecipeClick$.next()),this.addClickListener("addButton",()=>this.addRecipe()),this.addClickListener("title",()=>this.openRecipeDetails()),this.addClickListener("seeRecipe",()=>this.openRecipeDetails()),this.addClickListener("pictureContainer",()=>this.openRecipeDetails())}mealsCountButtonsListener(e){e.forEach((t,s)=>{const i=this.buttonClickHandlers.get(t);i&&t.removeEventListener("click",i);const n=()=>this.handleRecipeSelect(e,t,s);this.buttonClickHandlers.set(t,n),t.addEventListener("click",n)})}handleRecipeSelect(e,t,s){e.forEach(i=>i.classList.remove("primary")),t.classList.add("primary"),this.updateDisplayedRecipe(!1,s),s+1===e.length&&this.suggestionShownEvent(),this.scrollToButton(t)}updateDisplayedRecipe(e=!1,t){const{title:s,promotion:i,sponsor:n,addAndSwapButtons:o,removeButtons:r,picture:c,sponsorImg:l}=this.elements;if(!c||!s||!i||!n||!l||!o||!r)return;const a=this.getRecipeToDisplay(e,t);if(!a)return;const u=new S;Object.assign(u,a),this.recipeId=a.id,this.initializeUIState(c,i,n),this.setupImageHandlers(c,l,n,u,s,i,o,r,t)}getRecipeToDisplay(e,t){return e?this.suggestedRecipes[0]:this.menuRecipes[t]||this.suggestedRecipes[0]}initializeUIState(e,t,s){e.classList.add("loading"),t.classList.add("hidden"),s.classList.add("hidden")}setupImageHandlers(e,t,s,i,n,o,r,c,l){let a=null;const u=()=>{a&&(clearTimeout(a),a=null),this.updateRecipeUI(e,s,n,o,r,c,i,l)};if(e.onload=u,e.onerror=u,i.attributes["media-url"])e.src=i.attributes["media-url"];else{u();return}i.sponsorLogoUrl&&(t.src=i.sponsorLogoUrl),a=window.setTimeout(u,1e3)}updateRecipeUI(e,t,s,i,n,o,r,c){e.classList.remove("loading"),r.sponsorLogoUrl&&t.classList.remove("hidden"),s.textContent=r.attributes.title||"",i.classList.toggle("hidden",!r.discounted);const l=!!this.menuRecipes[c];n.classList.toggle("hidden",l),o.classList.toggle("hidden",!l)}addRecipe(){this.toggleLoadingButton(!0);const e=document.querySelector("mealz-planner-current-menu");if(!e){this.toggleLoadingButton(!1);return}e.addRecipe(this.recipeId,this.guests).subscribe({next:()=>{this.addAndSelectNewSuggestion(),this.toggleLoadingButton(!1)},error:()=>{this.toggleLoadingButton(!1)}})}toggleLoadingButton(e){const t=this.selectors.addButton,s=this.querySelector(t);s&&s.classList.toggle("loading",e)}addAndSelectNewSuggestion(e){!e||this.suggestedRecipes[0].id===e.id?(this.menuRecipes.push(this.suggestedRecipes[0]),this.removeSuggestedRecipe()):this.menuRecipes.push(e),this.addNewMealCountButton(),this.selectNewSuggestion(),this.addCheckIconToButton(),this.requestUpdate()}addNewMealCountButton(){var n;const{buttons:e}=this.elements;if(!e.length)return;const t=e[e.length-1],s=t.cloneNode(!0);s.classList.remove("primary");const i=s.querySelector("span");if(i){const o=(n=i.textContent)==null?void 0:n.match(/\d+/);if(o){const r=parseInt(o[0],10)+1;i.textContent=i.textContent.replace(/\d+/,r.toString())}}t.after(s)}selectNewSuggestion(){this.initSelectors("buttons");const{buttons:e}=this.elements;if(!e.length)return;const t=e[e.length-1];this.handleRecipeSelect(e,t,e.length-1)}addCheckIconToButton(){this.initSelectors("buttons");const{buttons:e}=this.elements;if(!e.length)return;const t=e[e.length-2],s=document.createElement("img");s.src="https://storage.googleapis.com/assets.miam.tech/generic/icons/Check.svg",s.alt="check icon",t.appendChild(s)}removeRecipe(e){const t=e||this.recipeId,s=document.querySelector("mealz-planner-current-menu");return!s||!t?L():s.removeRecipe(t).pipe(d(1),C(()=>{const i=this.menuRecipes.findIndex(n=>n.id===t);i!==-1&&(this.removeRecipeFromMenu(i),this.removeButtonFromContainer(i),this.updateButtonsCount())}))}removeButtonFromContainer(e){const{buttonsContainer:t,buttons:s}=this.elements;if(!t||!s.length)return;const i=s[e];if(i.classList.contains("primary")){const n=+e+1,o=s[n];this.handleRecipeSelect(s,o,e)}i.remove()}removeRecipeFromMenu(e){this.menuRecipes.splice(e,1)}updateButtonsCount(){this.initSelectors("buttons");const{buttons:e}=this.elements;e.forEach((t,s)=>{var n;const i=t.querySelector("span");if(i&&((n=i.textContent)==null?void 0:n.match(/\d+/))){const r=s+1;i.textContent=i.textContent.replace(/\d+/,r.toString())}}),this.requestUpdate()}swapRecipe(){p.planner.rejectRecipe(this.recipeId).pipe(d(1)).subscribe(),this.recipeSwappedEvent(),this.swapRecipeCount++,!sessionStorage.getItem("_miam/selectFromCatalogSuggestion")&&this.swapRecipeCount>3&&(sessionStorage.setItem("_miam/selectFromCatalogSuggestion","true"),this.openCatalogModal()),this.removeSuggestedRecipe(),this.updateDisplayedRecipe(!0),this.suggestionShownEvent()}removeSuggestedRecipe(){this.suggestedRecipes.shift(),this.suggestedRecipes.length<3&&p.planner.getSuggestedRecipes().pipe(d(1)).subscribe(e=>{this.suggestedRecipes=[...this.suggestedRecipes,...e]})}openCatalogModal(){const e=document.querySelector("mealz-planner-current-menu");this.promptCatalogEvent(),e==null||e.openCatalogModal()}openRecipeDetails(){p.recipes.openDetails(this.recipeId,this.guests,0,"",!0)}initScrolling(e,t){t.length>0&&t[0].offsetWidth>0?this.centerActiveButton(e,t):this.waitForButtonLayout(e,t)}centerActiveButton(e,t){this.initSelectors("activeButton");const{activeButton:s}=this.elements;this.setPadding(e,t),s&&this.scrollToButton(s,"instant")}waitForButtonLayout(e,t){const s=new ResizeObserver(()=>{t.length>0&&t[0].offsetWidth>0&&(this.centerActiveButton(e,t),s.disconnect())});t.forEach(i=>s.observe(i))}initDragScrolling(e){e.addEventListener("mousedown",t=>this.startDrag(t,e)),e.addEventListener("mouseleave",()=>this.stopDrag()),e.addEventListener("mouseup",()=>this.stopDrag()),e.addEventListener("mousemove",t=>this.onDrag(t,e))}refreshSuggestions(){p.planner.getSuggestedRecipes().pipe(d(1)).subscribe(e=>{var n;this.suggestedRecipes=e,this.initSelectors("buttons","activeButton");const{buttons:t,activeButton:s}=this.elements;if(!!(t!=null&&t.length)&&s===t[t.length-1]&&this.suggestedRecipes.length>0){const o=this.suggestedRecipes[0];((n=this.recipeDisplayed)==null?void 0:n.id)!==o.id&&(this.recipeDisplayed=o,this.updateDisplayedRecipe(!0),this.requestUpdate())}})}subscribeToPreferencesChanges(){this.preferencesSubscription.add(p.preferences.preferencesChanged$().subscribe(()=>this.refreshSuggestions()))}setPadding(e,t){const s=t[0].offsetWidth,i=t[t.length-1].offsetWidth;e.style.paddingLeft=`calc(50% - ${s/2}px)`,e.style.paddingRight=`calc(50% - ${i/2}px)`}scrollToButton(e,t="smooth"){if(!e||!e.parentElement)return;const s=e.parentElement,n=Array.from(this.elements.buttons).indexOf(e);if(n===-1)return;const o=window.getComputedStyle(s),r=parseFloat(o.paddingLeft||"0"),c=window.getComputedStyle(e),l=parseFloat(c.marginRight||"0");let a=e.offsetLeft-r;a+=l*n,s.scrollTo({left:a,behavior:t})}startDrag(e,t){this.isDragging=!0,this.dragStartX=e.pageX-t.offsetLeft,this.initialScrollLeft=t.scrollLeft}stopDrag(){this.isDragging=!1}onDrag(e,t){if(!this.isDragging)return;e.preventDefault();const s=e.pageX-t.offsetLeft;t.scrollLeft=this.initialScrollLeft-(s-this.dragStartX)}recipeSwappedEvent(){p.analytics.sendEvent("planner.recipe.swap",this.analyticsPath,{recipe_id:this.recipeId})}promptCatalogEvent(){p.analytics.sendEvent("planner.recipe.catalog-prompt",this.analyticsPath,{})}suggestionShownEvent(){this.recipeId&&this.recipeId!==this.lastShownRecipeId&&(p.analytics.sendEvent("planner.suggestion.show",this.analyticsPath,{recipe_id:this.recipeId}),this.lastShownRecipeId=this.recipeId)}};g=B([R("mealz-planner-recipe-suggestion")],g);
|
|
1
|
+
import{N as h,q as m,S as f}from"../../assets/no-shadow-element-DlGA0h9b.js";import{t as S}from"../../assets/custom-element-BhZVzxrc.js";import{m as p}from"../../assets/mealz-sdk-DWLzEfKz.js";import{d as b}from"../../assets/debounceTime-CIA2MWDj.js";import{o as R}from"../../assets/of-CH-D5SN9.js";import{t as g}from"../../assets/take-BmqRVy-3.js";import{t as v}from"../../assets/tap-C4xC1M3N.js";import"../../assets/async-H-Co76Oa.js";import"../../assets/OperatorSubscriber-z_a6lCKk.js";import"../../assets/from-Btz8AgkO.js";import"../../assets/executeSchedule-CTqB8mra.js";import"../../assets/innerFrom-CVMPVEmB.js";import"../../assets/empty-DGYYDWIm.js";class L{constructor(){this.attributes={title:"","ext-id":"","ext-link":"",description:"","number-of-guests":"","preparation-time":"","preheating-time":"","cooking-time":"","resting-time":"","media-url":"",source:"","informational-page-html":"","filigrane-logo-url":"","informational-sentence":"","order-history":"",difficulty:1,cost:1,suggested:!1,popularity:0,"video-id":"",promoted:!1,editable:!1,position:-1},this.ttl=3600,this.finalTimer=this.attributes["preparation-time"]+this.attributes["preheating-time"]+this.attributes["cooking-time"]+this.attributes["resting-time"]}get title(){return this.attributes.title}get promoted(){return this.attributes.promoted}get guests(){return this.attributes["number-of-guests"]}set guests(t){this.attributes["number-of-guests"]=t}get filigraneLogoUrl(){return this.attributes["filigrane-logo-url"]?this.attributes["filigrane-logo-url"]:null}get sponsorName(){return this.relationships.sponsors.length>0?this.relationships.sponsors[0].attributes.name:null}get sponsorLogoUrl(){var t;return this.relationships.sponsors.data.length>0&&((t=this.included)!=null&&t.length)?this.included.find(s=>s.id===this.relationships.sponsors.data[0].id&&s.type==="sponsors").attributes["logo-url"]:null}get informationalSentence(){return this.attributes["informational-sentence"]}get costLabel(){switch(this.attributes.cost){case 1:return"faible";case 2:return"moyen";case 3:return"élevé";default:return"moyen"}}get orderHistory(){return this.attributes["order-history"]}get preparationTime(){}get cookingTime(){}get restingTime(){}get difficulty(){return this.attributes.difficulty}set difficulty(t){this.attributes.difficulty=t}}var w=Object.getOwnPropertyDescriptor,C=(e,t,s,i)=>{for(var n=i>1?void 0:i?w(t,s):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(n=o(n)||n);return n};let d=class extends h{constructor(){super(...arguments),this.recipeId="",this.isDragging=!1,this.dragStartX=0,this.initialScrollLeft=0,this.layoutObserver=null,this.menuRecipes=[],this.suggestedRecipes=[],this.buttonClickHandlers=new Map,this.swapRecipeCount=0,this.swapRecipeClick$=new m,this.analyticsPath="/meals-planner/current",this.preferencesSubscription=new f,this.lastShownRecipeId=null}get selectors(){return{buttonsContainer:".mealz-planner-recipe-suggestion__meals-count",title:".mealz-planner-current-menu__recipe-title",removeButtons:".mealz-planner-recipe-suggestion__actions-remove",removeButton:".mealz-planner-recipe-suggestion__actions-remove-button",swapButton:".mealz-planner-recipe-suggestion__actions-swap-button",addButton:".mealz-planner-recipe-suggestion__actions-add-button",seeRecipe:".mealz-planner-recipe-suggestion__see-recipe",promotion:".mealz-planner-recipe-suggestion__recipe-badges-promotion",sponsor:".mealz-planner-recipe-suggestion__recipe-sponsor",addAndSwapButtons:".mealz-planner-recipe-suggestion__actions-add-and-swap",buttons:[".mealz-planner-recipe-suggestion__meals-count-button"],activeButton:".mealz-planner-recipe-suggestion__meals-count-button.primary",pictureContainer:".mealz-planner-recipe-suggestion__picture",picture:".mealz-planner-recipe-suggestion__picture img",sponsorImg:".mealz-planner-recipe-suggestion__recipe-sponsor img"}}connectedCallback(){super.connectedCallback(),this.initSelectors(),this.addEventListeners(),this.swapRecipeClick$.pipe(b(300)).subscribe(()=>this.swapRecipe()),this.subscribeToPreferencesChanges()}disconnectedCallback(){super.disconnectedCallback(),this.layoutObserver&&this.layoutObserver.disconnect(),this.swapRecipeClick$.complete(),this.preferencesSubscription.unsubscribe()}render(){const{buttonsContainer:e,buttons:t}=this.elements;!e||!t.length||this.mealsCountButtonsListener(t)}firstUpdated(){var i,n;const{buttonsContainer:e,buttons:t}=this.elements;if(!e||!t.length)return;this.initScrolling(e,t),this.initDragScrolling(e);const s=(i=this.attributes["starting-data"])==null?void 0:i.value;s&&(Object.assign(this,JSON.parse(s)),this.recipeId=(n=this.recipeDisplayed)==null?void 0:n.id,t.length===1&&this.recipeId&&this.suggestionShownEvent(),this.removeAttribute("starting-data"))}addEventListeners(){this.addClickListener("removeButton",()=>this.removeRecipe().subscribe()),this.addClickListener("swapButton",()=>this.swapRecipeClick$.next()),this.addClickListener("addButton",()=>this.addRecipe()),this.addClickListener("title",()=>this.openRecipeDetails()),this.addClickListener("seeRecipe",()=>this.openRecipeDetails()),this.addClickListener("pictureContainer",()=>this.openRecipeDetails())}mealsCountButtonsListener(e){e.forEach((t,s)=>{const i=this.buttonClickHandlers.get(t);i&&t.removeEventListener("click",i);const n=()=>this.handleRecipeSelect(e,t,s);this.buttonClickHandlers.set(t,n),t.addEventListener("click",n)})}handleRecipeSelect(e,t,s){e.forEach(i=>i.classList.remove("primary")),t.classList.add("primary"),this.updateDisplayedRecipe(!1,s),s+1===e.length&&this.suggestionShownEvent(),this.scrollToButton(t)}updateDisplayedRecipe(e=!1,t){const{title:s,promotion:i,sponsor:n,addAndSwapButtons:r,removeButtons:o,picture:c,sponsorImg:l}=this.elements;if(!c||!s||!i||!n||!l||!r||!o)return;const a=this.getRecipeToDisplay(e,t);if(!a)return;const u=new L;Object.assign(u,a),this.recipeId=a.id,this.initializeUIState(c,i,n),this.setupImageHandlers(c,l,n,u,s,i,r,o,t)}getRecipeToDisplay(e,t){return e?this.suggestedRecipes[0]:this.menuRecipes[t]||this.suggestedRecipes[0]}initializeUIState(e,t,s){e.classList.add("loading"),t.classList.add("hidden"),s.classList.add("hidden")}setupImageHandlers(e,t,s,i,n,r,o,c,l){let a=null;const u=()=>{a&&(clearTimeout(a),a=null),this.updateRecipeUI(e,s,n,r,o,c,i,l)};if(e.onload=u,e.onerror=u,i.attributes["media-url"])e.src=i.attributes["media-url"];else{u();return}i.sponsorLogoUrl&&(t.src=i.sponsorLogoUrl),a=window.setTimeout(u,1e3)}updateRecipeUI(e,t,s,i,n,r,o,c){e.classList.remove("loading"),o.sponsorLogoUrl&&t.classList.remove("hidden"),s.textContent=o.attributes.title||"",i.classList.toggle("hidden",!o.discounted);const l=!!this.menuRecipes[c];n.classList.toggle("hidden",l),r.classList.toggle("hidden",!l)}addRecipe(){this.toggleLoadingButton(!0);const e=document.querySelector("mealz-planner-current-menu");if(!e){this.toggleLoadingButton(!1);return}e.addRecipe(this.recipeId,this.guests).subscribe({next:()=>{this.addAndSelectNewSuggestion(),this.toggleLoadingButton(!1)},error:()=>{this.toggleLoadingButton(!1)}})}toggleLoadingButton(e){const t=this.selectors.addButton,s=this.querySelector(t);s&&s.classList.toggle("loading",e)}addAndSelectNewSuggestion(e){!e||this.suggestedRecipes[0].id===e.id?(this.menuRecipes.push(this.suggestedRecipes[0]),this.removeSuggestedRecipe()):this.menuRecipes.push(e),this.addNewMealCountButton(),this.selectNewSuggestion(),this.addCheckIconToButton(),this.requestUpdate()}addNewMealCountButton(){var n;const{buttons:e}=this.elements;if(!e.length)return;const t=e[e.length-1],s=t.cloneNode(!0);s.classList.remove("primary");const i=s.querySelector("span");if(i){const r=(n=i.textContent)==null?void 0:n.match(/\d+/);if(r){const o=parseInt(r[0],10)+1;i.textContent=i.textContent.replace(/\d+/,o.toString())}}t.after(s)}selectNewSuggestion(){this.initSelectors("buttons");const{buttons:e}=this.elements;if(!e.length)return;const t=e[e.length-1];this.handleRecipeSelect(e,t,e.length-1)}addCheckIconToButton(){this.initSelectors("buttons");const{buttons:e}=this.elements;if(!e.length)return;const t=e[e.length-2],s=document.createElement("img");s.src="https://storage.googleapis.com/assets.miam.tech/generic/icons/Check.svg",s.alt="check icon",t.appendChild(s)}removeRecipe(e){const t=e||this.recipeId,s=document.querySelector("mealz-planner-current-menu");return!s||!t?R():s.removeRecipe(t).pipe(g(1),v(()=>{const i=this.menuRecipes.findIndex(n=>n.id===t);i!==-1&&(this.removeRecipeFromMenu(i),this.removeButtonFromContainer(i),this.updateButtonsCount())}))}removeButtonFromContainer(e){const{buttonsContainer:t,buttons:s}=this.elements;if(!t||!s.length)return;const i=s[e];if(i.classList.contains("primary")){const n=+e+1,r=s[n];this.handleRecipeSelect(s,r,e)}i.remove()}removeRecipeFromMenu(e){this.menuRecipes.splice(e,1)}updateButtonsCount(){this.initSelectors("buttons");const{buttons:e}=this.elements;e.forEach((t,s)=>{var n;const i=t.querySelector("span");if(i&&((n=i.textContent)==null?void 0:n.match(/\d+/))){const o=s+1;i.textContent=i.textContent.replace(/\d+/,o.toString())}}),this.requestUpdate()}swapRecipe(){p.planner.rejectRecipe(this.recipeId).pipe(g(1)).subscribe(),this.recipeSwappedEvent(),this.swapRecipeCount++,!sessionStorage.getItem("_miam/selectFromCatalogSuggestion")&&this.swapRecipeCount>3&&(sessionStorage.setItem("_miam/selectFromCatalogSuggestion","true"),this.openCatalogModal()),this.removeSuggestedRecipe(),this.updateDisplayedRecipe(!0),this.suggestionShownEvent()}removeSuggestedRecipe(){this.suggestedRecipes.shift(),this.suggestedRecipes.length<3&&p.planner.getSuggestedRecipes().pipe(g(1)).subscribe(e=>{this.suggestedRecipes=[...this.suggestedRecipes,...e]})}openCatalogModal(){const e=document.querySelector("mealz-planner-current-menu");this.promptCatalogEvent(),e==null||e.openCatalogModal()}openRecipeDetails(){p.recipes.openDetails(this.recipeId,this.guests,0,"",!0)}initScrolling(e,t){t.length>0&&t[0].offsetWidth>0?this.centerActiveButton(e,t):this.waitForButtonLayout(e,t)}centerActiveButton(e,t){this.initSelectors("activeButton");const{activeButton:s}=this.elements;this.setPadding(e,t),s&&this.scrollToButton(s,"instant")}waitForButtonLayout(e,t){const s=new ResizeObserver(()=>{t.length>0&&t[0].offsetWidth>0&&(this.centerActiveButton(e,t),s.disconnect())});t.forEach(i=>s.observe(i))}initDragScrolling(e){e.addEventListener("mousedown",t=>this.startDrag(t,e)),e.addEventListener("mouseleave",()=>this.stopDrag()),e.addEventListener("mouseup",()=>this.stopDrag()),e.addEventListener("mousemove",t=>this.onDrag(t,e))}refreshSuggestions(){p.planner.getSuggestedRecipes().pipe(g(1)).subscribe(e=>{var n;this.suggestedRecipes=e,this.initSelectors("buttons","activeButton");const{buttons:t,activeButton:s}=this.elements;if(!!(t!=null&&t.length)&&s===t[t.length-1]&&this.suggestedRecipes.length>0){const r=this.suggestedRecipes[0];((n=this.recipeDisplayed)==null?void 0:n.id)!==r.id&&(this.recipeDisplayed=r,this.updateDisplayedRecipe(!0),this.requestUpdate())}})}subscribeToPreferencesChanges(){this.preferencesSubscription.add(p.preferences.preferencesChanged$().subscribe(()=>this.refreshSuggestions()))}setPadding(e,t){const s=t[0].offsetWidth,i=t[t.length-1].offsetWidth;e.style.paddingLeft=`calc(50% - ${s/2}px)`,e.style.paddingRight=`calc(50% - ${i/2}px)`}scrollToButton(e,t="smooth"){if(!e||!e.parentElement)return;const s=e.parentElement,n=Array.from(this.elements.buttons).indexOf(e);if(n===-1)return;const r=window.getComputedStyle(s),o=parseFloat(r.paddingLeft||"0"),c=window.getComputedStyle(e),l=parseFloat(c.marginRight||"0");let a=e.offsetLeft-o;a+=l*n,s.scrollTo({left:a,behavior:t})}startDrag(e,t){this.isDragging=!0,this.dragStartX=e.pageX-t.offsetLeft,this.initialScrollLeft=t.scrollLeft}stopDrag(){this.isDragging=!1}onDrag(e,t){if(!this.isDragging)return;e.preventDefault();const s=e.pageX-t.offsetLeft;t.scrollLeft=this.initialScrollLeft-(s-this.dragStartX)}recipeSwappedEvent(){p.analytics.sendEvent("planner.recipe.swap",this.analyticsPath,{recipe_id:this.recipeId})}promptCatalogEvent(){p.analytics.sendEvent("planner.recipe.catalog-prompt",this.analyticsPath,{})}suggestionShownEvent(){this.recipeId&&this.recipeId!==this.lastShownRecipeId&&(p.analytics.sendEvent("planner.suggestion.show",this.analyticsPath,{recipe_id:this.recipeId}),this.lastShownRecipeId=this.recipeId)}};d=C([S("mealz-planner-recipe-suggestion")],d);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as
|
|
1
|
+
import{N as m}from"../assets/no-shadow-element-DlGA0h9b.js";import{t as f}from"../assets/custom-element-BhZVzxrc.js";import{m as u}from"../assets/mealz-sdk-DWLzEfKz.js";import{m as o}from"../assets/map-oxUcVNGT.js";import{d as n}from"../assets/distinctUntilChanged-Ckq1Syk_.js";import{m as g}from"../assets/mergeAll-DQItozZ-.js";import{f as b,p as h}from"../assets/from-Btz8AgkO.js";import{o as C}from"../assets/OperatorSubscriber-z_a6lCKk.js";import{c as I}from"../assets/combineLatest-DNi66MsF.js";import"../assets/mergeMap-CMaM5Agw.js";import"../assets/innerFrom-CVMPVEmB.js";import"../assets/executeSchedule-CTqB8mra.js";import"../assets/mapOneOrManyArgs-Do0PsDok.js";function v(){return g(1)}function d(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v()(b(e,h(e)))}function l(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var s=h(e);return C(function(a,i){(s?d(e,a,s):d(e,a)).subscribe(i)})}var S=Object.getOwnPropertyDescriptor,k=(e,t,s,a)=>{for(var i=a>1?void 0:a?S(t,s):t,r=e.length-1,p;r>=0;r--)(p=e[r])&&(i=p(i)||i);return i};let c=class extends m{constructor(){super(...arguments),this.subscriptions=[],this.recipeId="",this.status="add",this.planner=!1,this.recipeCta=null}connectedCallback(){super.connectedCallback(),this.getInitialStatus();const e=u.basket.recipePricesInBasket$().pipe(o(t=>t.some(s=>s.id===this.recipeId)),n(),l(!1));this.subscriptions.push(I([u.planner.isRecipeInMenu$(this.recipeId).pipe(l(!1),n()),e]).pipe(o(([t,s])=>this.planner?s?"in-basket":t?"in-menu":"add":s?"in-basket":"add"),n()).subscribe(t=>this.updateStatus(t)))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){this.recipeCta=this.querySelector(".mealz-recipe-card-cta"),this.recipeCta&&this.updateStatus(this.status)}getInitialStatus(){const e=this.getAttribute("starting-data");if(e)try{const t=e.trim();if(t.startsWith("{")||t.startsWith("[")){const s=JSON.parse(t);Object.assign(this,s),!this.recipeId&&s&&(s.recipeId||s.id)&&(this.recipeId=String(s.recipeId||s.id))}else this.recipeId=t;if(this.removeAttribute("starting-data"),this.planner)this.updateStatus(this.status);else{const s=this.classList.contains("in-basket");this.updateStatus(s?"in-basket":"add")}}catch(t){console.error("Error parsing starting-data attribute:",t)}}updateStatus(e){this.status!==e&&(this.status=e,this.recipeCta&&(this.recipeCta.classList.remove("in-basket","in-menu","add"),this.recipeCta.classList.add(this.status),this.recipeCta.classList.toggle("primary",this.status==="add"),this.recipeCta.classList.toggle("secondary",this.status!=="add"),this.updateButtonState(),this.updateImages()))}updateButtonState(){this.recipeCta&&(this.planner&&this.status==="in-basket"?this.recipeCta.setAttribute("disabled","true"):this.recipeCta.removeAttribute("disabled"))}updateImages(){if(!this.recipeCta)return;this.recipeCta.querySelectorAll("img").forEach(t=>{t.classList.contains(this.status)?t.classList.remove("hidden"):t.classList.add("hidden")})}getStatus(){return this.status}};c=k([f("mealz-recipe-card-cta")],c);customElements.get("mealz-recipe-card-cta")||customElements.define("mealz-recipe-card-cta",c);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";import{_ as re,q as D,t as X,a as ne,b as oe,v as le,N as m,D as c,k as a}from"../assets/no-shadow-element-DlGA0h9b.js";import{t as g}from"../assets/custom-element-BhZVzxrc.js";import{n as p}from"../assets/property-Bg80vXcm.js";import{P as ce}from"../assets/price-DcNF55ef.js";import{
|
|
1
|
+
import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";import{_ as re,q as D,t as X,a as ne,b as oe,v as le,N as m,D as c,k as a}from"../assets/no-shadow-element-DlGA0h9b.js";import{t as g}from"../assets/custom-element-BhZVzxrc.js";import{n as p}from"../assets/property-Bg80vXcm.js";import{P as ce}from"../assets/price-DcNF55ef.js";import{m as o}from"../assets/mealz-sdk-DWLzEfKz.js";import{m as Z}from"../assets/merge-BlKu2J03.js";import{m as h}from"../assets/map-oxUcVNGT.js";import{t as F}from"../assets/take-BmqRVy-3.js";import{c as ee}from"../assets/capitalize-DUAqYmp4.js";import"../counter/counter.min.js";import{G as te}from"../assets/product-card-Be_9YL6f.js";import"../price/price.min.js";import"../assets/promotion-badge-2uUuiRau.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-MRC87lfr.js";import{M as ue}from"../planner/planner-onboarding/planner-onboarding.min.js";import{o as se,c as he}from"../assets/OperatorSubscriber-z_a6lCKk.js";import{i as N}from"../assets/innerFrom-CVMPVEmB.js";import{f as j}from"../assets/filter-DuHsB8oM.js";import{t as z}from"../assets/tap-C4xC1M3N.js";import{s as V}from"../assets/switchMap-vA0vSKy4.js";import{c as H}from"../assets/combineLatest-DNi66MsF.js";import{d as me}from"../assets/async-H-Co76Oa.js";import"../assets/skipWhile-BAgfjfH2.js";import"../assets/from-Btz8AgkO.js";import"../assets/executeSchedule-CTqB8mra.js";import"../assets/mapOneOrManyArgs-Do0PsDok.js";import"../assets/of-CH-D5SN9.js";import"../assets/mergeAll-DQItozZ-.js";import"../assets/mergeMap-CMaM5Agw.js";import"../assets/empty-DGYYDWIm.js";import"../assets/debounceTime-CIA2MWDj.js";import"../assets/delay-0L99jHsb.js";import"../assets/timer-DmQ_oP6s.js";import"../assets/store-locator-CKwiyckb.js";import"../assets/state-bsKs-Mb2.js";import"../assets/query-BApjzB0v.js";import"../onboarding/onboarding.min.js";import"../onboarding/events.min.js";import"../onboarding/analytics/onboarding-analytics.min.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,l=r._infiniteTimeWindow,d=r._timestampProvider,v=r._windowTime;s||(n.push(i),!l&&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,l=s._buffer,d=l.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,l=i._infiniteTimeWindow,d=(l?1:2)*r;if(r<1/0&&d<n.length&&n.splice(0,n.length-d),!l){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,l=n===void 0?!0:n,d=e.resetOnRefCountZero,v=d===void 0?!0:d;return function(k){var u,f,I,E=0,x=!1,C=!1,S=function(){f==null||f.unsubscribe(),f=void 0},L=function(){S(),u=I=void 0,x=C=!1},ae=function(){var P=u;L(),P==null||P.unsubscribe()};return se(function(P,G){E++,!C&&!x&&S();var R=I=I??i();G.add(function(){E--,E===0&&!C&&!x&&(f=B(ae,v))}),R.subscribe(G),!u&&E>0&&(u=new X({next:function(O){return R.next(O)},error:function(O){C=!0,S(),f=B(L,s,O),R.error(O)},complete:function(){x=!0,S(),f=B(L,l),R.complete()}}),N(P).subscribe(u))})(k)}}function B(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 N(t.apply(void 0,ne([],oe(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){N(e).subscribe(he(i,function(){return i.complete()},le)),!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,l;n>=0;n--)(l=e[n])&&(s=(r?l(t,i,s):l(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(o.recipes.remainingBasketEntries$.pipe(h(e=>{this.remainingBasketEntries=e})),o.recipes.recipePrice$.pipe(h(e=>{const t=e.remaining+e.inBasket;this.recipePrice={...e,total:t,totalPerGuest:0}})),o.recipes.allIngredientsToBasketLoading$.pipe(h(e=>{this.allIngredientsToBasketLoading=e})),o.recipes.ingredientToBasketLoading$.pipe(h(e=>{this.ingredientToBasketLoading=e})),o.recipes.updateIngredientFromBasketLoading$.pipe(h(e=>{this.updateIngredientFromBasketLoading=e})),o.recipes.productsLoading$.pipe(h(e=>{this.productsLoading=e})),o.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=o.planner.isRecipeInMenu$(this.recipeId).pipe(h(e=>{this.inMenu=e})).subscribe(()=>this.requestUpdate()))}closeRecipeDetails(e=!1){o.recipes.displayedRecipe$.next(null),e&&o.basket.basketPreviewState$.next({isOpen:!0,activeTabIndex:o.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=o.recipes)==null?void 0:i.productsPlannerByCategory$)==null?void 0:r.value,n=(s==null?void 0:s.toPickProducts)||[];o.planner.addRecipeToMenu(this.recipeId,this.guests,!!o.pos.currentPos().value,n).pipe(F(1)).subscribe(()=>{this.inMenu=!0;const l=document.querySelector("mealz-planner-recipe-list");l==null||l.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){o.planner.removeRecipeFromMenu(this.recipeId).pipe(F(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(){o.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 -->
|
|
@@ -78,7 +78,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
78
78
|
src="https://storage.googleapis.com/assets.miam.tech/generic/icons/Basket.svg"/>
|
|
79
79
|
</button>
|
|
80
80
|
`:c}
|
|
81
|
-
`}renderPrice(){if(this.recipePrice.inBasket<=0&&!this.plannerMode)return;const e=this.ingredientToBasketLoading||this.updateIngredientFromBasketLoading||this.productsLoading,t=this.plannerMode?this.recipePrice.totalPerGuest:this.recipePrice.inBasket;return a`
|
|
81
|
+
`}renderPrice(){if(this.recipePrice.inBasket<=0&&!this.plannerMode)return c;const e=this.ingredientToBasketLoading||this.updateIngredientFromBasketLoading||this.productsLoading,t=this.plannerMode?this.recipePrice.totalPerGuest:this.recipePrice.inBasket;return a`
|
|
82
82
|
<div class="mealz-recipe-details__price">
|
|
83
83
|
<div
|
|
84
84
|
class="mealz-recipe-details__price-label ${this.plannerMode?"":"primary"} mealz-ds-text size-l weight-xxl">
|
|
@@ -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(){o.analytics.sendEvent("entry.add-all",this.analyticsPath,{recipe_id:this.recipeId,entry_count:this.remainingBasketEntries.length})}sendAddRecipeEvent(){o.analytics.sendEvent("recipe.add",this.analyticsPath,{recipe_id:this.recipeId})}sendContinueEvent(){o.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({
|
|
94
|
+
`}sendAddAllEvent(){o.analytics.sendEvent("entry.add-all",this.analyticsPath,{recipe_id:this.recipeId,entry_count:this.remainingBasketEntries.length})}sendAddRecipeEvent(){o.analytics.sendEvent("recipe.add",this.analyticsPath,{recipe_id:this.recipeId})}sendContinueEvent(){o.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,l;n>=0;n--)(l=e[n])&&(s=l(s)||s);return s};let W=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(o.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
|
-
`}};W
|
|
160
|
+
`}};W=ye([g("mealz-details-infos")],W);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,l;n>=0;n--)(l=e[n])&&(s=l(s)||s);return s};let K=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(o.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
|
-
`}};K=
|
|
183
|
+
`}};K=ke([g("mealz-details-steps")],K);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,l;n>=0;n--)(l=e[n])&&(s=l(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(o.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"}};Q=
|
|
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);var Te=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,$=(e,t,i,r)=>{for(var s=r>1?void 0:r?Ee(t,i):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(s=(r?l(t,i,s):l(s))||s);return r&&s&&Te(t,i,s),s};const U=["unavailable"],xe=["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(){o.planner.openReplaceItemView(this.product),this.replaceItemViewEvent()}onCheckboxChange(e){e.target.checked?(this.status="ticked",o.planner.selectProduct(+this.product.item.id,this.product.ingredient.relationships.definition.data.id),this.addItemEvent()):(this.status="unselected",o.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
|
+
${U.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
|
+
${xe.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
|
+
${U.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
|
+
${U.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(){o.analytics.sendEvent("planner.item.add",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}deleteItemEvent(){o.analytics.sendEvent("planner.item.delete",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}replaceItemViewEvent(){o.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
|
|
321
|
+
`}addItemEvent(){o.analytics.sendEvent("planner.item.add",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}deleteItemEvent(){o.analytics.sendEvent("planner.item.delete",this.analyticsPath,{recipe_id:this.recipeId,item_id:this.product.item.id})}replaceItemViewEvent(){o.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,Se=Object.getOwnPropertyDescriptor,ie=(e,t,i,r)=>{for(var s=r>1?void 0:r?Se(t,i):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(s=(r?l(t,i,s):l(s))||s);return r&&s&&Ce(t,i,s),s};let A=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()],A.prototype,"tags",2);A=ie([g("mealz-legal-notice")],A);var
|
|
333
|
+
`:c}};ie([p()],A.prototype,"tags",2);A=ie([g("mealz-legal-notice")],A);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,l;n>=0;n--)(l=e[n])&&(s=l(s)||s);return s};let Y=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
|
-
`}};Y=
|
|
376
|
+
`}};Y=Oe([g("mealz-products-card-skeleton")],Y);var we=Object.defineProperty,De=Object.getOwnPropertyDescriptor,q=(e,t,i,r)=>{for(var s=r>1?void 0:r?De(t,i):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(s=(r?l(t,i,s):l(s))||s);return r&&s&&we(t,i,s),s};let T=class extends m{constructor(){super(),this.inBasket=!1,this.plannerMode=!1,this.numberUnavailableProducts=0,this.subscriptions=[],this.noSupplier=o.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(o.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?o.recipes.productsPlannerByCategory$:o.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(o.router.getCatalogUrl())}closeRecipeModal(){}currentPath(){return""}guestsChange(){const e=new CustomEvent("guestChange",{bubbles:!0,composed:!0});this.dispatchEvent(e)}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">
|
|
@@ -488,7 +488,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
488
488
|
`}
|
|
489
489
|
</div>
|
|
490
490
|
<mealz-legal-notice .tags="${this.recipe.relationships.tags}"></mealz-legal-notice>
|
|
491
|
-
`}sendHomeDisplayEvent(){o.analytics.sendEvent("home.display",this.analyticsPath,{})}};q([p({type:Boolean})],T.prototype,"inBasket",2);q([p({type:Boolean})],T.prototype,"plannerMode",2);T=q([g("mealz-products-picker")],T);customElements.get("mealz-products-picker")||customElements.define("mealz-products-picker",T);var
|
|
491
|
+
`}sendHomeDisplayEvent(){o.analytics.sendEvent("home.display",this.analyticsPath,{})}};q([p({type:Boolean})],T.prototype,"inBasket",2);q([p({type:Boolean})],T.prototype,"plannerMode",2);T=q([g("mealz-products-picker")],T);customElements.get("mealz-products-picker")||customElements.define("mealz-products-picker",T);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,l;n>=0;n--)(l=e[n])&&(s=l(s)||s);return s};let M=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(o.recipes.invalidPosDisplay$.subscribe(e=>{this.invalidPos=e,this.requestUpdate()}))}callPosSelector(){const e=new CustomEvent("posSelected",{bubbles:!0,composed:!0});this.dispatchEvent(e)}openStoreLocator(){const e=document.querySelector("mealz-drawer-view-swapper");e&&e.displayStoreLocator$.next(!0)}render(){return a`
|
|
492
492
|
<div class="mealz-no-pos-selected">
|
|
493
493
|
${this.invalidPos?a`
|
|
494
494
|
<!-- INVALID POS -->
|
|
@@ -528,7 +528,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
528
528
|
Sélectionner un magasin
|
|
529
529
|
</button>
|
|
530
530
|
</div>
|
|
531
|
-
`}};M=Be([g("mealz-no-pos-selected")],M);customElements.get("mealz-no-pos-selected")||customElements.define("mealz-no-pos-selected",M);var
|
|
531
|
+
`}};M=Be([g("mealz-no-pos-selected")],M);customElements.get("mealz-no-pos-selected")||customElements.define("mealz-no-pos-selected",M);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,l;n>=0;n--)(l=e[n])&&(s=l(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(o.recipes.displayedRecipe$.pipe(w(this.destroy$),j(e=>!!e),z(e=>{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()}),V(()=>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=!!o.supplier.isNoSupplier(),this.requestUpdate()}close(){this.sendCloseEvent(),o.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||o.user.isAuthenticated().pipe(w(this.destroy$),j(e=>e),V(()=>o.html.like(this.recipe.id))).subscribe({next:e=>{this.likeButtonHTML=e,this.requestUpdate()},error:e=>console.error("Like button error:",e)})}checkSponsorStorytelling(){this.sponsor&&o.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 H({noPosDisplay:o.recipes.noPosDisplay$,invalidPosDisplay:o.recipes.invalidPosDisplay$}).pipe(z(({noPosDisplay:e,invalidPosDisplay:t})=>{this.noPosDisplay=e,this.invalidPosDisplay=t,this.activeTabIndex=e?1:0}),h(()=>{}))}listenLastOrderDate(){return o.recipes.orderHistoryDate$.pipe(z(e=>{this.orderHistoryDate=e}))}listenToLoadingStates(){return H([o.recipes.ingredientToBasketLoading$,o.recipes.updateIngredientFromBasketLoading$]).pipe(h(([e,t])=>e||t),z(e=>{this.basketIsUpdating=e}),be(1))}listenRemainingBasketEntries(){return o.recipes.remainingBasketEntries$.pipe(z(e=>{this.remainingBasketEntries=e}))}listenToAddAllToBasket(){return o.recipes.allIngredientsToBasketLoading$.pipe(z(e=>{e&&(this.selectTab(0),setTimeout(()=>{this.scrollToPicker()},50))}))}listenToRecipeInBasket(){return o.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(){o.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?o.planner.updateGuests(this.recipe.modifiedGuests,t):o.recipes.updateGuests(t),this.requestUpdate()}render(){return a`
|
|
532
532
|
<div class="mealz-recipe-details">
|
|
533
533
|
<!-- IF IS LOADING -->
|
|
534
534
|
${this.recipe?c:a`
|
|
@@ -599,7 +599,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
599
599
|
<div class="mealz-recipe-details__actions__icon">
|
|
600
600
|
<!-- LIKE BUTTON -->
|
|
601
601
|
<div class="mealz-recipe-details__like-button">
|
|
602
|
-
${
|
|
602
|
+
${pe(this.likeButtonHTML)}
|
|
603
603
|
</div>
|
|
604
604
|
<!-- CLOSE MODAL BUTTON -->
|
|
605
605
|
<div class="mealz-recipe-details__hideable-actions ${this.isSticky?"sticky":""}">
|
|
@@ -695,4 +695,4 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
695
695
|
</div>
|
|
696
696
|
`:c}
|
|
697
697
|
</div>
|
|
698
|
-
`}showRecipeAddon(){this.sendSponsorDisplayEvent();const e=document.querySelector("mealz-drawer-view-swapper");e&&e.displayRecipeAddon$.next(!0)}pageview(){o.analytics.sendEvent("pageview",this.analyticsPath,{})}sendSponsorDisplayEvent(){o.analytics.sendEvent("sponsor.display",this.analyticsPath,{recipe_id:this.recipe.id})}sendCloseEvent(){o.analytics.sendEvent("recipe.close",this.analyticsPath,{recipe_id:this.recipe.id})}sendCookingDisplayEvent(){o.analytics.sendEvent("recipe.cooking.display",this.analyticsPath,{recipe_id:this.recipe.id})}sendOrderedDisplayEvent(){o.analytics.sendEvent("recipe.ordered.display",this.analyticsPath,{recipe_id:this.recipe.id})}};J=
|
|
698
|
+
`}showRecipeAddon(){this.sendSponsorDisplayEvent();const e=document.querySelector("mealz-drawer-view-swapper");e&&e.displayRecipeAddon$.next(!0)}pageview(){o.analytics.sendEvent("pageview",this.analyticsPath,{})}sendSponsorDisplayEvent(){o.analytics.sendEvent("sponsor.display",this.analyticsPath,{recipe_id:this.recipe.id})}sendCloseEvent(){o.analytics.sendEvent("recipe.close",this.analyticsPath,{recipe_id:this.recipe.id})}sendCookingDisplayEvent(){o.analytics.sendEvent("recipe.cooking.display",this.analyticsPath,{recipe_id:this.recipe.id})}sendOrderedDisplayEvent(){o.analytics.sendEvent("recipe.ordered.display",this.analyticsPath,{recipe_id:this.recipe.id})}};J=Ae([g("mealz-recipe-details")],J);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./replace-item-card/replace-item-card.min.js";import{N as h,q as u,D as o,k as i}from"../assets/no-shadow-element-DlGA0h9b.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-DWLzEfKz.js";import{m as b}from"../assets/merge-
|
|
1
|
+
import"./replace-item-card/replace-item-card.min.js";import{N as h,q as u,D as o,k as i}from"../assets/no-shadow-element-DlGA0h9b.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-DWLzEfKz.js";import{m as b}from"../assets/merge-BlKu2J03.js";import{m as n}from"../assets/map-oxUcVNGT.js";import{d as z}from"../assets/debounceTime-CIA2MWDj.js";import{f as v}from"../assets/filter-DuHsB8oM.js";import{d as S}from"../assets/distinctUntilChanged-Ckq1Syk_.js";import{s as $}from"../assets/switchMap-vA0vSKy4.js";import"../assets/promotion-badge-2uUuiRau.js";import"../assets/property-Bg80vXcm.js";import"../assets/price-DcNF55ef.js";import"../assets/price-utils-BRFZa-3D.js";import"../assets/mergeAll-DQItozZ-.js";import"../assets/mergeMap-CMaM5Agw.js";import"../assets/innerFrom-CVMPVEmB.js";import"../assets/OperatorSubscriber-z_a6lCKk.js";import"../assets/executeSchedule-CTqB8mra.js";import"../assets/empty-DGYYDWIm.js";import"../assets/from-Btz8AgkO.js";import"../assets/async-H-Co76Oa.js";var I=Object.getOwnPropertyDescriptor,f=(e,t,c,a)=>{for(var r=a>1?void 0:a?I(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)}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">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as h,q as d,D as o,k as a}from"../assets/no-shadow-element-DlGA0h9b.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-DWLzEfKz.js";import{m as _}from"../assets/merge-
|
|
1
|
+
import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as h,q as d,D as o,k as a}from"../assets/no-shadow-element-DlGA0h9b.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-DWLzEfKz.js";import{m as _}from"../assets/merge-BlKu2J03.js";import{m}from"../assets/map-oxUcVNGT.js";import{d as b}from"../assets/debounceTime-CIA2MWDj.js";import{f as z}from"../assets/filter-DuHsB8oM.js";import{d as v}from"../assets/distinctUntilChanged-Ckq1Syk_.js";import{s as S}from"../assets/switchMap-vA0vSKy4.js";import"../assets/promotion-badge-2uUuiRau.js";import"../assets/property-Bg80vXcm.js";import"../assets/price-DcNF55ef.js";import"../assets/price-utils-BRFZa-3D.js";import"../assets/mergeAll-DQItozZ-.js";import"../assets/mergeMap-CMaM5Agw.js";import"../assets/innerFrom-CVMPVEmB.js";import"../assets/OperatorSubscriber-z_a6lCKk.js";import"../assets/executeSchedule-CTqB8mra.js";import"../assets/empty-DGYYDWIm.js";import"../assets/from-Btz8AgkO.js";import"../assets/async-H-Co76Oa.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">
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as t}from"./mergeMap-CMaM5Agw.js";import{w as n}from"./no-shadow-element-DlGA0h9b.js";import{i}from"./innerFrom-CVMPVEmB.js";import{E as s}from"./empty-DGYYDWIm.js";import{p as f,a as p,f as g}from"./from-Btz8AgkO.js";function u(r){return r===void 0&&(r=1/0),t(n,r)}function y(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var o=f(r),a=p(r,1/0),m=r;return m.length?m.length===1?i(m[0]):u(a)(g(m,o)):s}export{y as m};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class r{constructor(){this.attributes={title:"","ext-id":"","ext-link":"",description:"","number-of-guests":"","preparation-time":"","preheating-time":"","cooking-time":"","resting-time":"","media-url":"",source:"","informational-page-html":"","filigrane-logo-url":"","informational-sentence":"","order-history":"",difficulty:1,cost:1,suggested:!1,popularity:0,"video-id":"",promoted:!1,editable:!1,position:-1},this.ttl=3600,this.finalTimer=this.attributes["preparation-time"]+this.attributes["preheating-time"]+this.attributes["cooking-time"]+this.attributes["resting-time"]}get title(){return this.attributes.title}get promoted(){return this.attributes.promoted}get guests(){return this.attributes["number-of-guests"]}set guests(t){this.attributes["number-of-guests"]=t}get filigraneLogoUrl(){return this.attributes["filigrane-logo-url"]?this.attributes["filigrane-logo-url"]:null}get sponsorName(){return this.relationships.sponsors.length>0?this.relationships.sponsors[0].attributes.name:null}get sponsorLogoUrl(){var t;return this.relationships.sponsors.data.length>0&&((t=this.included)!=null&&t.length)?this.included.find(e=>e.id===this.relationships.sponsors.data[0].id&&e.type==="sponsors").attributes["logo-url"]:null}get informationalSentence(){return this.attributes["informational-sentence"]}get costLabel(){switch(this.attributes.cost){case 1:return"faible";case 2:return"moyen";case 3:return"élevé";default:return"moyen"}}get orderHistory(){return this.attributes["order-history"]}get preparationTime(){}get cookingTime(){}get restingTime(){}get difficulty(){return this.attributes.difficulty}set difficulty(t){this.attributes.difficulty=t}}export{r as R};
|