mealz-components 2.5.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{OperatorSubscriber-BaYaQC1O.js → OperatorSubscriber-DfCnFunn.js} +1 -1
- package/dist/assets/{accordion-DJLqKUJq.js → accordion-sjJSL32r.js} +1 -1
- package/dist/assets/{args-BozZ6oU-.js → args-DAL2bHut.js} +1 -1
- package/dist/assets/{async-CFBGA-Dz.js → async-C5Kj_SqM.js} +1 -1
- package/dist/assets/{combineLatest-BmqPE0OB.js → combineLatest-Capvy1jI.js} +1 -1
- package/dist/assets/{debounceTime-B4DpnstH.js → debounceTime-Cf_7YmIn.js} +1 -1
- package/dist/assets/delay-DHNms76g.js +1 -0
- package/dist/assets/{distinctUntilChanged-91AVuO2B.js → distinctUntilChanged-kXqVrZ5h.js} +1 -1
- package/dist/assets/empty-qrpgDBbc.js +1 -0
- package/dist/assets/{filter-BZ75lS5D.js → filter-q99GWcpD.js} +1 -1
- package/dist/assets/firstValueFrom-Bcbk1SUg.js +1 -0
- package/dist/assets/{from-CAidt5N1.js → from-D8c5akO7.js} +1 -1
- package/dist/assets/guestObserver-C5qvv1Ll.js +1 -0
- package/dist/assets/{innerFrom-BgPDnAsH.js → innerFrom-DePszgj9.js} +1 -1
- package/dist/assets/isDate-BwHtzZM4.js +1 -0
- package/dist/assets/isScheduler-CqHuyMwD.js +1 -0
- package/dist/assets/{map-BVOhpQm0.js → map-DT-7dkaR.js} +1 -1
- package/dist/assets/mapOneOrManyArgs-CHGhEDCk.js +1 -0
- package/dist/assets/merge-DzIA6T0M.js +1 -0
- package/dist/assets/mergeAll-DpEYIxY3.js +1 -0
- package/dist/assets/{mergeMap-Dw_YYHwH.js → mergeMap-D2yctTHQ.js} +1 -1
- package/dist/assets/no-shadow-element-D62BBu0I.js +21 -0
- package/dist/assets/of-DtJFltSl.js +1 -0
- package/dist/assets/price-D6RVRYHJ.js +1 -0
- package/dist/assets/product-card-TLfT6URx.js +189 -0
- package/dist/assets/{promotion-badge-8Arhhb-p.js → promotion-badge-B-er7bV2.js} +1 -1
- package/dist/assets/{property-_7ObQ3dl.js → property-CoRN-Ln2.js} +1 -1
- package/dist/assets/singleton-COF3iBbF.js +1 -0
- package/dist/assets/skip-Bup0JB81.js +1 -0
- package/dist/assets/{skipWhile-BZVFq1Cg.js → skipWhile-Beza3ws3.js} +1 -1
- package/dist/assets/{state-W5mtSPAs.js → state-DDIoBQp5.js} +1 -1
- package/dist/assets/{switchMap-Dk_0Nhlo.js → switchMap-BAdE9Uzw.js} +1 -1
- package/dist/assets/{take-CozE9iSG.js → take-CpvJwza7.js} +1 -1
- package/dist/assets/{tap-C8CJ3R2H.js → tap-BN_fPb40.js} +1 -1
- package/dist/assets/timer-3Kpx74mt.js +1 -0
- package/dist/assets/{unsafe-html-CY0Np4--.js → unsafe-html-DWUMaK1p.js} +1 -1
- package/dist/assets/{viewport-listener-CDsKFDz1.js → viewport-listener-DsRHfwo4.js} +1 -1
- package/dist/basket-transfer-modal/basket-transfer-modal.min.js +1 -1
- package/dist/catalog/basket-preview/basket-preview.min.js +3 -3
- package/dist/catalog/catalog-category/catalog-category.min.js +1 -1
- package/dist/catalog/catalog-favorites/catalog-favorites.min.js +1 -1
- package/dist/catalog/catalog-history/catalog-history.min.js +1 -1
- package/dist/catalog/catalog-home/catalog-home.min.js +1 -1
- package/dist/catalog/catalog-home-header/catalog-home-header.min.js +1 -0
- package/dist/catalog/catalog-list/catalog-list.min.js +1 -1
- package/dist/catalog/catalog-load-more.min.js +1 -1
- package/dist/catalog/catalog-tabs/catalog-tabs.min.js +1 -1
- package/dist/catalog/catalog-toolbar/catalog-toolbar.min.js +1 -1
- package/dist/catalog/my-meals-button/my-meals-button.min.js +1 -1
- package/dist/counter/counter.min.js +3 -3
- package/dist/drawer/drawer.css +1 -1
- package/dist/drawer/drawer.min.js +4 -4
- package/dist/drawer-view-swapper/drawer-view-swapper.min.js +7 -7
- package/dist/history-drawer/history-drawer.min.js +1 -1
- package/dist/history-order/history-order.min.js +1 -1
- package/dist/history-order-expanded/history-order-expanded.min.js +1 -1
- package/dist/last-order-badge/last-order-badge.min.js +2 -2
- package/dist/last-order-modal/last-order-modal.min.js +1 -1
- package/dist/like-button/like-button.min.js +1 -1
- package/dist/modal/modal.min.js +1 -1
- package/dist/no-supplier-add-to-cart-cta/no-supplier-add-to-cart-cta.min.js +1 -1
- package/dist/onboarding/onboarding.min.js +1 -1
- package/dist/order-again/order-again.min.js +2 -2
- package/dist/planner/helpers/get-planner-onboarding-modal-config.min.js +1 -0
- package/dist/planner/helpers/init-planner-onboarding-modal.min.js +1 -0
- package/dist/planner/helpers/open-onboarding-modal.min.js +1 -1
- package/dist/planner/planner-abandon-modal/planner-abandon-modal.min.js +1 -1
- package/dist/planner/planner-budget-edit-modal/planner-budget-edit-modal.min.js +1 -1
- package/dist/planner/planner-budget-gauge/planner-budget-gauge.min.js +1 -1
- package/dist/planner/planner-catalog/planner-catalog.min.js +1 -1
- package/dist/planner/planner-current-menu/planner-current-menu.css +1 -1
- package/dist/planner/planner-current-menu/planner-current-menu.min.js +1 -1
- package/dist/planner/planner-current-menu-modal/planner-current-menu-modal.min.js +1 -1
- package/dist/planner/planner-dashboard/planner-dashboard.min.js +1 -1
- package/dist/planner/planner-form/planner-form.min.js +1 -1
- package/dist/planner/planner-menu-option/planner-menu-option.min.js +1 -1
- package/dist/planner/planner-onboarding/planner-onboarding.min.js +1 -1
- package/dist/planner/planner-onboarding-modal/planner-onboarding-modal.min.js +2 -2
- package/dist/planner/planner-open-catalog-modal/planner-open-catalog-modal.min.js +1 -1
- package/dist/planner/planner-quick-menu/planner-quick-menu.min.js +1 -1
- package/dist/planner/planner-recipe-card/planner-recipe-card.min.js +1 -1
- package/dist/planner/planner-recipe-list/planner-recipe-list.css +1 -1
- package/dist/planner/planner-recipe-list/planner-recipe-list.min.js +1 -1
- package/dist/planner/planner-recipe-suggestion/planner-recipe-suggestion.css +1 -1
- package/dist/planner/planner-recipe-suggestion/planner-recipe-suggestion.min.js +1 -1
- package/dist/planner/planner-welcome-modal/planner-welcome-modal.min.js +1 -1
- package/dist/planner/to-basket-loader/to-basket-loader.min.js +1 -1
- package/dist/planner-entry/planner-entry.css +1 -1
- package/dist/planner-entry/planner-entry.min.js +1 -1
- package/dist/preferences/preferences.min.js +1 -1
- package/dist/price/price.min.js +3 -3
- package/dist/product-badges/product-badges.css +1 -1
- package/dist/product-card/product-card.css +1 -1
- package/dist/products-to-basket-cta/products-to-basket-cta.css +1 -0
- package/dist/products-to-basket-cta/products-to-basket-cta.min.js +1 -0
- package/dist/recipe-card/recipe-card.min.js +1 -1
- package/dist/recipe-card-cta/recipe-card-cta.min.js +1 -1
- package/dist/recipe-details/recipe-details.css +1 -1
- package/dist/recipe-details/recipe-details.min.js +41 -43
- package/dist/recipe-pricing/recipe-pricing.min.js +1 -1
- package/dist/recipe-to-basket/recipe-to-basket.css +1 -0
- package/dist/recipe-to-basket/recipe-to-basket.min.js +1 -0
- package/dist/replace-item/replace-item-card/replace-item-card.min.js +1 -1
- package/dist/replace-item/replace-item.min.js +18 -18
- package/dist/replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js +1 -1
- package/dist/replace-item-planner/replace-item-planner.min.js +1 -1
- package/dist/select/select.min.js +1 -1
- package/dist/slider-tabs/slider-tabs.min.js +1 -1
- package/dist/store-indicator/store-indicator.min.js +1 -1
- package/dist/store-locator/store-locator.min.js +1 -1
- package/dist/store-locator-drawer/store-locator-drawer.min.js +1 -1
- package/dist/supplier-selector/supplier-selector.min.js +1 -1
- package/package.json +1 -1
- package/dist/assets/delay-BNnJ-6LE.js +0 -1
- package/dist/assets/empty-0eVnsLmk.js +0 -1
- package/dist/assets/isScheduler-C5PGPVU1.js +0 -1
- package/dist/assets/mapOneOrManyArgs-COA1aRZM.js +0 -1
- package/dist/assets/merge-Cm-mm3_Q.js +0 -1
- package/dist/assets/mergeAll-BdUAXyrs.js +0 -1
- package/dist/assets/no-shadow-element-YPHUv5PR.js +0 -21
- package/dist/assets/of-DiALp3BZ.js +0 -1
- package/dist/assets/price-DAxY_7sk.js +0 -1
- package/dist/assets/product-card-HetVhdJ3.js +0 -189
- package/dist/assets/skip-zbH-ayby.js +0 -1
- package/dist/assets/timer-D82-ik89.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";import{_ as re,n as
|
|
1
|
+
import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";import{_ as re,n as D,p as X,b as ne,c as oe,q as le,N as $,D as c,k as r}from"../assets/no-shadow-element-D62BBu0I.js";import{t as k}from"../assets/custom-element-BhZVzxrc.js";import{n as h}from"../assets/property-CoRN-Ln2.js";import{P as ce}from"../assets/price-D6RVRYHJ.js";import{m as o}from"../assets/mealz-sdk-E_fNZM-c.js";import{m as Z}from"../assets/merge-DzIA6T0M.js";import{m as y}from"../assets/map-DT-7dkaR.js";import{t as L}from"../assets/take-CpvJwza7.js";import{c as ee}from"../assets/capitalize-DUAqYmp4.js";import"../counter/counter.min.js";import"../assets/product-card-TLfT6URx.js";import"../price/price.min.js";import"../assets/promotion-badge-B-er7bV2.js";import{G as te}from"../assets/guestObserver-C5qvv1Ll.js";import"../assets/accordion-sjJSL32r.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-DWUMaK1p.js";import{M as ue}from"../planner/planner-onboarding/planner-onboarding.min.js";import{o as se,c as he}from"../assets/OperatorSubscriber-DfCnFunn.js";import{i as H}from"../assets/innerFrom-DePszgj9.js";import{f as Q}from"../assets/filter-q99GWcpD.js";import{t as T}from"../assets/tap-BN_fPb40.js";import{s as Y}from"../assets/switchMap-BAdE9Uzw.js";import{c as J}from"../assets/combineLatest-Capvy1jI.js";import{d as me}from"../assets/async-C5Kj_SqM.js";import"../assets/viewport-listener-DsRHfwo4.js";import"../assets/debounceTime-Cf_7YmIn.js";import"../assets/skipWhile-Beza3ws3.js";import"../assets/singleton-COF3iBbF.js";import"../assets/mergeAll-DpEYIxY3.js";import"../assets/mergeMap-D2yctTHQ.js";import"../assets/executeSchedule-CEDvgTzM.js";import"../assets/empty-qrpgDBbc.js";import"../assets/args-DAL2bHut.js";import"../assets/isScheduler-CqHuyMwD.js";import"../assets/from-D8c5akO7.js";import"../assets/delay-DHNms76g.js";import"../assets/timer-3Kpx74mt.js";import"../assets/isDate-BwHtzZM4.js";import"../store-locator/store-locator.min.js";import"../assets/state-DDIoBQp5.js";import"../assets/query-BApjzB0v.js";import"../onboarding/onboarding.min.js";import"../onboarding/events.min.js";import"../onboarding/analytics/onboarding-analytics.min.js";import"../assets/responsive-C7Qf71r3.js";import"../assets/mapOneOrManyArgs-CHGhEDCk.js";var ge=function(e){re(t,e);function t(s,a,i){s===void 0&&(s=1/0),a===void 0&&(a=1/0),i===void 0&&(i=me);var n=e.call(this)||this;return n._bufferSize=s,n._windowTime=a,n._timestampProvider=i,n._buffer=[],n._infiniteTimeWindow=!0,n._infiniteTimeWindow=a===1/0,n._bufferSize=Math.max(1,s),n._windowTime=Math.max(1,a),n}return t.prototype.next=function(s){var a=this,i=a.isStopped,n=a._buffer,l=a._infiniteTimeWindow,d=a._timestampProvider,u=a._windowTime;i||(n.push(s),!l&&n.push(d.now()+u)),this._trimBuffer(),e.prototype.next.call(this,s)},t.prototype._subscribe=function(s){this._throwIfClosed(),this._trimBuffer();for(var a=this._innerSubscribe(s),i=this,n=i._infiniteTimeWindow,l=i._buffer,d=l.slice(),u=0;u<d.length&&!s.closed;u+=n?1:2)s.next(d[u]);return this._checkFinalizedStatuses(s),a},t.prototype._trimBuffer=function(){var s=this,a=s._bufferSize,i=s._timestampProvider,n=s._buffer,l=s._infiniteTimeWindow,d=(l?1:2)*a;if(a<1/0&&d<n.length&&n.splice(0,n.length-d),!l){for(var u=i.now(),g=0,p=1;p<n.length&&n[p]<=u;p+=2)g=p;g&&n.splice(0,g+1)}},t}(D);function ve(e){e===void 0&&(e={});var t=e.connector,s=t===void 0?function(){return new D}:t,a=e.resetOnError,i=a===void 0?!0:a,n=e.resetOnComplete,l=n===void 0?!0:n,d=e.resetOnRefCountZero,u=d===void 0?!0:d;return function(g){var p,m,v,b=0,_=!1,f=!1,z=function(){m==null||m.unsubscribe(),m=void 0},A=function(){z(),p=v=void 0,_=f=!1},ae=function(){var w=p;A(),w==null||w.unsubscribe()};return se(function(w,K){b++,!f&&!_&&z();var R=v=v??s();K.add(function(){b--,b===0&&!f&&!_&&(m=U(ae,u))}),R.subscribe(K),!p&&b>0&&(p=new X({next:function(x){return R.next(x)},error:function(x){f=!0,z(),m=U(A,i,x),R.error(x)},complete:function(){_=!0,z(),m=U(A,l),R.complete()}}),H(w).subscribe(p))})(g)}}function U(e,t){for(var s=[],a=2;a<arguments.length;a++)s[a-2]=arguments[a];if(t===!0){e();return}if(t!==!1){var i=new X({next:function(){i.unsubscribe(),e()}});return H(t.apply(void 0,ne([],oe(s)))).subscribe(i)}}function be(e,t,s){var a,i=!1;return a=e,ve({connector:function(){return new ge(a,t,s)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:i})}function O(e){return se(function(t,s){H(e).subscribe(he(s,function(){return s.complete()},le)),!s.closed&&t.subscribe(s)})}var _e=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,E=(e,t,s,a)=>{for(var i=a>1?void 0:a?fe(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=(a?l(t,s,i):l(i))||i);return a&&i&&_e(t,s,i),i};let I=class extends ${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(y(e=>{this.remainingBasketEntries=e})),o.recipes.recipePrice$.pipe(y(e=>{const t=e.remaining+e.inBasket;this.recipePrice={...e,total:t,totalPerGuest:0}})),o.recipes.allIngredientsToBasketLoading$.pipe(y(e=>{this.allIngredientsToBasketLoading=e})),o.recipes.ingredientToBasketLoading$.pipe(y(e=>{this.ingredientToBasketLoading=e})),o.recipes.updateIngredientFromBasketLoading$.pipe(y(e=>{this.updateIngredientFromBasketLoading=e})),o.recipes.productsLoading$.pipe(y(e=>{this.productsLoading=e})),o.planner.plannerRecipePrice$.pipe(y(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(y(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 a,i;this.menuUpdateLoading=!0,this.requestUpdate();const e=document.querySelector("mealz-planner-recipe-suggestion"),t=!!e&&!!e.recipeId&&e.recipeId===this.recipeId,s=document.querySelector("mealz-planner-current-menu");if(!s){const n=(i=(a=o.recipes)==null?void 0:a.productsPlannerByCategory$)==null?void 0:i.value,l=(n==null?void 0:n.toPickProducts)||[];o.planner.addRecipeToMenu(this.recipeId,this.guests,!!o.pos.currentPos().value,l).pipe(L(1)).subscribe(()=>{this.inMenu=!0;const d=document.querySelector("mealz-planner-recipe-list");d==null||d.addRecipeCardToList(this.recipeId),this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()});return}if(t){e.addRecipeFromDetails$(this.guests).subscribe({next:()=>{this.inMenu=!0,this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()},error:()=>{this.menuUpdateLoading=!1,this.requestUpdate()}});return}s.addRecipe(this.recipeId,this.guests).pipe(L(1)).subscribe({next:()=>{this.inMenu=!0,e==null||e.addAndSelectNewSuggestion(this.recipe||void 0),this.menuUpdateLoading=!1,this.requestUpdate(),this.closeRecipeDetails()},error:()=>{this.menuUpdateLoading=!1,this.requestUpdate()}})}removeFromMenu(){this.menuUpdateLoading=!0,this.requestUpdate();const e=document.querySelector("mealz-planner-recipe-suggestion");if(!e){o.planner.removeRecipeFromMenu(this.recipeId).pipe(L(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,s=this.plannerMode&&!this.inMenu;return r`
|
|
2
2
|
<div class="mealz-recipe-details__footer">
|
|
3
3
|
${this.productsLoading&&!this.plannerMode?c:r`
|
|
4
4
|
<!-- ADD TO BASKET CTA -->
|
|
@@ -10,12 +10,12 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
10
10
|
`}
|
|
11
11
|
${this.noPosDisplay?c:this.renderPrice()}
|
|
12
12
|
</div>`}renderAddToBasketButton(){const e=this.remainingBasketEntries.length;return this.allIngredientsToBasketLoading||this.menuUpdateLoading?r`
|
|
13
|
-
<button class="mealz-recipe-details__add-to-basket-cta mealz-ds-button primary">
|
|
13
|
+
<button class="mealz-recipe-details__add-to-basket-cta mealz-recipe-details__add-to-basket-cta--loading mealz-ds-button primary">
|
|
14
14
|
<div class="mealz-ds-loader"></div>
|
|
15
15
|
</button>
|
|
16
16
|
`:this.plannerMode?r`
|
|
17
17
|
<button
|
|
18
|
-
class="mealz-recipe-details__add-to-basket-cta mealz-ds-button primary"
|
|
18
|
+
class="mealz-recipe-details__add-to-basket-cta mealz-recipe-details__add-to-basket-cta--to-menu mealz-ds-button primary"
|
|
19
19
|
@click=${()=>this.addToMenu()}
|
|
20
20
|
>
|
|
21
21
|
<span class="mealz-ds-text size-s weight-xl">Ajouter au menu</span>
|
|
@@ -23,7 +23,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
23
23
|
</button>
|
|
24
24
|
`:r`
|
|
25
25
|
<button
|
|
26
|
-
class="mealz-recipe-details__add-to-basket-cta mealz-ds-text mealz-ds-button size-m weight-xl primary"
|
|
26
|
+
class="mealz-recipe-details__add-to-basket-cta mealz-recipe-details__add-to-basket-cta--to-basket mealz-ds-text mealz-ds-button size-m weight-xl primary"
|
|
27
27
|
@click=${()=>this.addAllIngredients()}
|
|
28
28
|
>
|
|
29
29
|
<img
|
|
@@ -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})}};
|
|
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})}};E([h({type:Boolean})],I.prototype,"noPosDisplay",2);E([h({type:Boolean})],I.prototype,"noSupplier",2);E([h({type:String})],I.prototype,"recipeId",2);E([h({type:Boolean})],I.prototype,"plannerMode",2);E([h({type:Number})],I.prototype,"guests",2);E([h({attribute:!1})],I.prototype,"recipe",2);I=E([k("mealz-details-footer")],I);customElements.get("mealz-details-footer")||customElements.define("mealz-details-footer",I);var ze=Object.getOwnPropertyDescriptor,ye=(e,t,s,a)=>{for(var i=a>1?void 0:a?ze(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let N=class extends ${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 r`<span class="mealz-recipe-details-infos__no-time-placeholder">0 min</span>`}noDataPlaceholder(){return r`<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 r`<span class="mealz-ds-text">Facile</span>`;case 2:return r`<span class="mealz-ds-text">Moyen</span>`;case 3:return r`<span class="mealz-ds-text">Difficile</span>`;default:return c}}renderPreparationTime(){return r`
|
|
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
|
-
`}};N=ye([
|
|
160
|
+
`}};N=ye([k("mealz-details-infos")],N);customElements.get("mealz-details-infos")||customElements.define("mealz-details-infos",N);var $e=Object.getOwnPropertyDescriptor,ke=(e,t,s,a)=>{for(var i=a>1?void 0:a?$e(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let q=class extends ${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,s)=>t.attributes["step-number"]-s.attributes["step-number"]).map(t=>t.attributes.description),this.requestUpdate())}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){return r`
|
|
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
|
-
`}};q=ke([
|
|
183
|
+
`}};q=ke([k("mealz-details-steps")],q);customElements.get("mealz-details-steps")||customElements.define("mealz-details-steps",q);var Ie=Object.getOwnPropertyDescriptor,Pe=(e,t,s,a)=>{for(var i=a>1?void 0:a?Ie(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let G=class extends ${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 r`
|
|
184
184
|
<div class="mealz-details-ingredients">
|
|
185
185
|
<!-- HEADER -->
|
|
186
186
|
<div class="mealz-ds-text weight-xxl mealz-details-ingredients__header">
|
|
@@ -209,7 +209,7 @@ 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"}};G=Pe([
|
|
212
|
+
`}ingredientPicture(e){return e.picture||"https://storage.googleapis.com/assets.miam.tech/generic/images/default-ingredient-picture.svg"}};G=Pe([k("mealz-details-ingredients")],G);customElements.get("mealz-details-ingredients")||customElements.define("mealz-details-ingredients",G);var Te=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,S=(e,t,s,a)=>{for(var i=a>1?void 0:a?Ee(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=(a?l(t,s,i):l(i))||i);return a&&i&&Te(t,s,i),i};const M=["unavailable"],Se=["ticked","unselected"];let P=class extends ${constructor(){super(),this.recipeId="",this.initialGuests=0,this.currentGuests=0,this.oftenIgnored=!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"}get isSponsored(){var e,t,s;return((s=(t=(e=this.product)==null?void 0:e.item)==null?void 0:t.attributes)==null?void 0:s.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 r`
|
|
213
213
|
<div class="mealz-product-card-planner
|
|
214
214
|
${this.status==="ticked"?"added":""}
|
|
215
215
|
${M.includes(this.status)||this.oftenIgnored?"disabled":""}
|
|
@@ -220,7 +220,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
220
220
|
${this.oftenIgnored?"disabled":""}
|
|
221
221
|
${this.status==="unavailable"?"unavailable":""}"
|
|
222
222
|
>
|
|
223
|
-
${
|
|
223
|
+
${Se.includes(this.status)&&!this.oftenIgnored?this.renderEnabledProductCard():this.renderDisabledOrUnavailableProduct()}
|
|
224
224
|
</div>
|
|
225
225
|
</div>
|
|
226
226
|
`}renderEnabledProductCard(){return r`
|
|
@@ -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})}}
|
|
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})}};S([h({type:Object})],P.prototype,"product",2);S([h({type:String})],P.prototype,"recipeId",2);S([h({type:Number})],P.prototype,"initialGuests",2);S([h({type:Number})],P.prototype,"currentGuests",2);S([h({type:Boolean})],P.prototype,"oftenIgnored",2);P=S([k("mealz-product-card-planner")],P);customElements.get("mealz-product-card-planner")||customElements.define("mealz-product-card-planner",P);var we=Object.defineProperty,Ce=Object.getOwnPropertyDescriptor,ie=(e,t,s,a)=>{for(var i=a>1?void 0:a?Ce(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=(a?l(t,s,i):l(i))||i);return a&&i&&we(t,s,i),i};let B=class extends ${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(s=>s.id==="ingredient_category_alcool")}render(){return this.containsAlcohol?r`
|
|
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([
|
|
333
|
+
`:c}};ie([h()],B.prototype,"tags",2);B=ie([k("mealz-legal-notice")],B);customElements.get("mealz-legal-notice")||customElements.define("mealz-legal-notice",B);var Re=Object.getOwnPropertyDescriptor,xe=(e,t,s,a)=>{for(var i=a>1?void 0:a?Re(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let F=class extends ${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 r`
|
|
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
|
-
`}};F=
|
|
376
|
+
`}};F=xe([k("mealz-products-card-skeleton")],F);customElements.get("mealz-products-card-skeleton")||customElements.define("mealz-products-card-skeleton",F);var Oe=Object.defineProperty,De=Object.getOwnPropertyDescriptor,W=(e,t,s,a)=>{for(var i=a>1?void 0:a?De(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=(a?l(t,s,i):l(i))||i);return a&&i&&Oe(t,s,i),i};let C=class extends ${constructor(){super(),this.inBasket=!1,this.plannerMode=!1,this.productsByCategory={toPickProducts:[],oftenIgnoredProducts:[]},this.numberUnavailableProducts=0,this.analyticsPath="",this.subscriptions=[],this.noSupplier=o.supplier.isNoSupplier(),this.hasEmittedReady=!1,this.hydrateOnly=!1,this.ssrTemplateRemoved=!1,this.styleURL=new URL("./products-picker/products-picker.css",this.getBaseURL())}get selectors(){return{unavailableBadge:"mealz-unavailable-badge"}}get totalProducts(){var e,t,s;return Array.isArray((s=(t=(e=this.recipe)==null?void 0:e.relationships)==null?void 0:t.ingredients)==null?void 0:s.data)?this.recipe.relationships.ingredients.data.length:0}connectedCallback(){var t,s;super.connectedCallback(),this.getInitialStatus(),this.resetProducts(),this.listenToProducts();const e=(s=(t=o)==null?void 0:t.recipes)==null?void 0:s.displayedRecipe$;e&&typeof e.subscribe=="function"&&this.subscriptions.push(e.subscribe(a=>{a&&(this.recipe=a.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()}getInitialStatus(){const e=this.getAttribute("starting-data");if(e)try{const t=JSON.parse(e);this.plannerMode=!!t.planner,this.hydrateOnly=!0,t.analyticsPath&&(this.analyticsPath=t.analyticsPath),t.recipeId&&(this.recipe={id:t.recipeId,attributes:{"number-of-guests":t.guests||4}})}catch(t){console.warn("[products-picker] starting-data parse error",t)}finally{this.removeAttribute("starting-data")}}removeSSRTemplate(){const e=this.querySelector(".mealz-products-picker");e&&e.parentElement===this&&e.remove()}listenToProducts(){const e=this.plannerMode?o.recipes.productsPlannerByCategory$:o.recipes.productsByCategory$;!e||typeof e.subscribe!="function"||this.subscriptions.push(e.subscribe(t=>{(t.toPickProducts.length>0||t.oftenIgnoredProducts.length>0)&&!this.ssrTemplateRemoved&&this.hydrateOnly&&(this.removeSSRTemplate(),this.ssrTemplateRemoved=!0),this.productsByCategory=t,this.plannerMode?this.numberUnavailableProducts=[...t.oftenIgnoredProducts,...t.toPickProducts].filter(s=>s.status==="unavailable").length:this.numberUnavailableProducts=[...t.oftenIgnoredProducts,...t.toPickProducts].filter(s=>s.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(e){const t=new CustomEvent("guestChange",{bubbles:!0,composed:!0,detail:{value:e.detail.value}});this.dispatchEvent(t)}render(){var i,n;const e=!!this.recipe&&this.recipe.id!==void 0,t=Array.isArray((i=this.productsByCategory)==null?void 0:i.toPickProducts)?this.productsByCategory.toPickProducts:[],s=Array.isArray((n=this.productsByCategory)==null?void 0:n.oftenIgnoredProducts)?this.productsByCategory.oftenIgnoredProducts:[],a=this.totalProducts||t.length||0;return r`
|
|
377
377
|
<div class="mealz-products-picker">
|
|
378
378
|
${this.inBasket&&this.plannerMode?r`
|
|
379
379
|
<div class="mealz-products-picker__overlay">
|
|
@@ -388,56 +388,54 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
388
388
|
${this.renderHeader()}
|
|
389
389
|
<div class="mealz-products-picker__list">
|
|
390
390
|
<!-- TO PICK PRODUCTS -->
|
|
391
|
-
${
|
|
391
|
+
${e&&t.length>0?t.map(l=>{var d,u,g,p,m,v,b,_,f,z;return this.plannerMode?r`
|
|
392
392
|
<mealz-product-card-planner
|
|
393
|
-
.product="${
|
|
393
|
+
.product="${l}"
|
|
394
394
|
.recipeId="${this.recipe.id}"
|
|
395
395
|
.oftenIgnored="${!1}"
|
|
396
|
-
.initialGuests="${((
|
|
397
|
-
.currentGuests="${this.recipe.modifiedGuests||((
|
|
396
|
+
.initialGuests="${((u=(d=this.recipe)==null?void 0:d.attributes)==null?void 0:u["number-of-guests"])||4}"
|
|
397
|
+
.currentGuests="${((g=this.recipe)==null?void 0:g.modifiedGuests)||((m=(p=this.recipe)==null?void 0:p.attributes)==null?void 0:m["number-of-guests"])||4}"
|
|
398
398
|
></mealz-product-card-planner>
|
|
399
399
|
`:r`
|
|
400
400
|
<mealz-product-card
|
|
401
|
-
.product="${
|
|
401
|
+
.product="${l}"
|
|
402
402
|
.recipeId="${this.recipe.id}"
|
|
403
|
-
.initialGuests="${((
|
|
404
|
-
.currentGuests="${this.recipe.modifiedGuests||((
|
|
403
|
+
.initialGuests="${((b=(v=this.recipe)==null?void 0:v.attributes)==null?void 0:b["number-of-guests"])||4}"
|
|
404
|
+
.currentGuests="${((_=this.recipe)==null?void 0:_.modifiedGuests)||((z=(f=this.recipe)==null?void 0:f.attributes)==null?void 0:z["number-of-guests"])||4}"
|
|
405
405
|
></mealz-product-card>
|
|
406
|
-
`}):Array(
|
|
407
|
-
<mealz-products-card-skeleton></mealz-products-card-skeleton>
|
|
408
|
-
`)}
|
|
406
|
+
`}):new Array(a).fill(r`<mealz-products-card-skeleton></mealz-products-card-skeleton>`)}
|
|
409
407
|
</div>
|
|
410
408
|
<!-- OFTEN IGNORED PRODUCTS -->
|
|
411
409
|
<div class="mealz-products-picker__secondary-list">
|
|
412
|
-
${
|
|
410
|
+
${e&&s.length>0?r`
|
|
413
411
|
<mealz-accordion
|
|
414
412
|
.noStyling=${!0}
|
|
415
|
-
|
|
413
|
+
>
|
|
414
|
+
<div slot="title">
|
|
416
415
|
<span class="mealz-ds-text weight-xl">
|
|
417
416
|
Déjà dans le placard
|
|
418
417
|
</span>
|
|
419
|
-
|
|
420
|
-
|
|
418
|
+
</div>
|
|
419
|
+
<div slot="content">
|
|
421
420
|
<div class="mealz-products-picker__list">
|
|
422
|
-
${
|
|
421
|
+
${s.map(l=>{var d,u,g,p,m,v,b,_,f,z;return this.plannerMode?r`
|
|
423
422
|
<mealz-product-card-planner
|
|
424
|
-
.product
|
|
425
|
-
.recipeId
|
|
426
|
-
.oftenIgnored
|
|
427
|
-
.initialGuests
|
|
428
|
-
.currentGuests
|
|
423
|
+
.product="${l}"
|
|
424
|
+
.recipeId="${this.recipe.id}"
|
|
425
|
+
.oftenIgnored="${!0}"
|
|
426
|
+
.initialGuests="${((u=(d=this.recipe)==null?void 0:d.attributes)==null?void 0:u["number-of-guests"])||4}"
|
|
427
|
+
.currentGuests="${((g=this.recipe)==null?void 0:g.modifiedGuests)||((m=(p=this.recipe)==null?void 0:p.attributes)==null?void 0:m["number-of-guests"])||4}"
|
|
429
428
|
></mealz-product-card-planner>
|
|
430
429
|
`:r`
|
|
431
430
|
<mealz-product-card
|
|
432
|
-
.product
|
|
433
|
-
.recipeId
|
|
434
|
-
.initialGuests
|
|
435
|
-
.currentGuests
|
|
431
|
+
.product="${l}"
|
|
432
|
+
.recipeId="${this.recipe.id}"
|
|
433
|
+
.initialGuests="${((b=(v=this.recipe)==null?void 0:v.attributes)==null?void 0:b["number-of-guests"])||4}"
|
|
434
|
+
.currentGuests="${((_=this.recipe)==null?void 0:_.modifiedGuests)||((z=(f=this.recipe)==null?void 0:f.attributes)==null?void 0:z["number-of-guests"])||4}"
|
|
436
435
|
></mealz-product-card>
|
|
437
436
|
`})}
|
|
438
437
|
</div>
|
|
439
|
-
|
|
440
|
-
>
|
|
438
|
+
</div>
|
|
441
439
|
</mealz-accordion>
|
|
442
440
|
`:c}
|
|
443
441
|
</div>
|
|
@@ -478,7 +476,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
478
476
|
</select>
|
|
479
477
|
</div> -->
|
|
480
478
|
</div>
|
|
481
|
-
`}renderLowerContent(){return r`
|
|
479
|
+
`}renderLowerContent(){var e,t;return r`
|
|
482
480
|
<!-- MORE RECIPE IDEAS -->
|
|
483
481
|
<div class="mealz-products-picker__more">
|
|
484
482
|
${!this.isAlreadyOnCatalogPage()&&!this.plannerMode?r`
|
|
@@ -495,8 +493,8 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
495
493
|
</button>
|
|
496
494
|
`}
|
|
497
495
|
</div>
|
|
498
|
-
<mealz-legal-notice .tags="${this.recipe.relationships.tags}"></mealz-legal-notice>
|
|
499
|
-
`}sendHomeDisplayEvent(){o.analytics.sendEvent("home.display",this.analyticsPath,{})}};W([
|
|
496
|
+
<mealz-legal-notice .tags="${(t=(e=this.recipe)==null?void 0:e.relationships)==null?void 0:t.tags}"></mealz-legal-notice>
|
|
497
|
+
`}sendHomeDisplayEvent(){o.analytics.sendEvent("home.display",this.analyticsPath,{})}};W([h({type:Boolean})],C.prototype,"inBasket",2);W([h({type:Boolean})],C.prototype,"plannerMode",2);C=W([k("mealz-products-picker")],C);customElements.get("mealz-products-picker")||customElements.define("mealz-products-picker",C);var Be=Object.getOwnPropertyDescriptor,Ae=(e,t,s,a)=>{for(var i=a>1?void 0:a?Be(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let V=class extends ${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(){window.mealzInternal.noSupplier.displaySupplierSelector$.next(!0)}render(){return r`
|
|
500
498
|
<div class="mealz-no-pos-selected">
|
|
501
499
|
${this.invalidPos?r`
|
|
502
500
|
<!-- INVALID POS -->
|
|
@@ -536,7 +534,7 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
536
534
|
Sélectionner un magasin
|
|
537
535
|
</button>
|
|
538
536
|
</div>
|
|
539
|
-
`}};V=
|
|
537
|
+
`}};V=Ae([k("mealz-no-pos-selected")],V);customElements.get("mealz-no-pos-selected")||customElements.define("mealz-no-pos-selected",V);var Le=Object.getOwnPropertyDescriptor,Ue=(e,t,s,a)=>{for(var i=a>1?void 0:a?Le(t,s):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(i=l(i)||i);return i};let j=class extends ${constructor(){super(),this.activeTabIndex=0,this.destroy$=new D,this.remainingBasketEntries=[],this.guestObserverService=te.getInstance(),this.isSticky=!1,this.hasBackNavigation=!1,this.drawerViewSwapper=null,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(O(this.destroy$),Q(e=>!!e),T(e=>{e.recipe!==null&&(this.recipe=e.recipe,this.sponsor=e.recipe.relationships.sponsors.data[0],this.analyticsPath=`/recipes/${this.recipe.id}/shopping`,this.plannerMode=!!e.planner,this.getLikeButton(),this.checkSponsorStorytelling(),this.pageview(),this.listenToCloseEvent(),this.setStickyObserver())}),Y(e=>e.recipe===null?[]:this.listenToRecipeInBasket())),this.listenPosStatus(),this.listenRemainingBasketEntries(),this.listenLastOrderDate(),this.listenToLoadingStates(),this.listenToAddAllToBasket()).pipe(O(this.destroy$)).subscribe({next:()=>this.requestUpdate(),error:e=>console.error("Recipe details error:",e)}),this.addEventListener("products-picker-ready",()=>this.startRecipeDetailsOnboardingIfNeeded()),this.setupDrawerBackNavigationIndicator()}disconnectedCallback(){super.disconnectedCallback(),this.destroy$.next(),this.destroy$.complete(),this.topObserver&&this.topObserver.disconnect(),this.stickyTimeout&&clearTimeout(this.stickyTimeout),this.drawerViewSwapper&&this.onActiveViewsChanged&&this.drawerViewSwapper.removeEventListener("mealz-active-views-changed",this.onActiveViewsChanged)}setupDrawerBackNavigationIndicator(){const e=this.closest("mealz-drawer-view-swapper");this.drawerViewSwapper=e??document.querySelector("mealz-drawer-view-swapper"),this.drawerViewSwapper&&(this.updateBackNavigationFromActiveViews(this.drawerViewSwapper.getActiveViewNames()),this.onActiveViewsChanged=t=>{const s=t==null?void 0:t.detail;s!=null&&s.activeViews&&this.updateBackNavigationFromActiveViews(s.activeViews)},this.drawerViewSwapper.addEventListener("mealz-active-views-changed",this.onActiveViewsChanged))}updateBackNavigationFromActiveViews(e){const t=Array.isArray(e)&&e.length>1;this.hasBackNavigation!==t&&(this.hasBackNavigation=t,this.requestUpdate())}getRecipeDetailsCloseIcon(){return this.hasBackNavigation?{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/arrow-right.svg",alt:"back button",className:"mealz-recipe-details__close-icon is-back"}:{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/Cross_primary.svg",alt:"modal close button",className:"mealz-recipe-details__close-icon"}}getRecipeDetailsStickyCloseIcon(){return this.hasBackNavigation?{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/ArrowLeft_dark.svg",alt:"back button",className:"mealz-recipe-details__close-icon before-title is-back"}:{src:"https://storage.googleapis.com/assets.miam.tech/generic/icons/Cross_Black.svg",alt:"modal close button",className:"mealz-recipe-details__close-icon"}}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 s=!t.isIntersecting;this.isSticky!==s&&(this.isSticky=s,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 s=e.getBoundingClientRect(),a=t.getBoundingClientRect();t.scrollTop+=s.top-a.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(O(this.destroy$),Q(e=>e),Y(()=>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(O(this.destroy$)).subscribe({next:e=>{this.hasSponsorStorytelling=e,this.requestUpdate()},error:e=>console.error("Sponsor storytelling error:",e)})}listenPosStatus(){return J({noPosDisplay:o.recipes.noPosDisplay$,invalidPosDisplay:o.recipes.invalidPosDisplay$}).pipe(T(({noPosDisplay:e,invalidPosDisplay:t})=>{this.noPosDisplay=e,this.invalidPosDisplay=t,this.activeTabIndex=e?1:0}),y(()=>{}))}listenLastOrderDate(){return o.recipes.orderHistoryDate$.pipe(T(e=>{this.orderHistoryDate=e}))}listenToLoadingStates(){return J([o.recipes.ingredientToBasketLoading$,o.recipes.updateIngredientFromBasketLoading$]).pipe(y(([e,t])=>e||t),T(e=>{this.basketIsUpdating=e}),be(1))}listenRemainingBasketEntries(){return o.recipes.remainingBasketEntries$.pipe(T(e=>{this.remainingBasketEntries=e}))}listenToAddAllToBasket(){return o.recipes.allIngredientsToBasketLoading$.pipe(T(e=>{e&&(this.selectTab(0),setTimeout(()=>{this.scrollToPicker()},50))}))}listenToRecipeInBasket(){return o.recipes.isRecipeInBasket(this.recipe.id).pipe(T(e=>{this.inBasket=e}))}scrollToPicker(){const e=this.querySelector(".mealz-products-picker");if(e){const t=this.querySelector(".mealz-recipe-details__title-container"),s=(t==null?void 0:t.offsetHeight)||0;e.style.scrollMarginTop=`${s}px`,e.scrollIntoView({behavior:"instant",block:"start"})}}scrollToReplacedItem(e){var s,a;const t=this.querySelectorAll("mealz-product-card-planner");for(const i of Array.from(t)){const n=i;if(((a=(s=n.product)==null?void 0:s.item)==null?void 0:a.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(){const e=this.getRecipeDetailsCloseIcon(),t=this.getRecipeDetailsStickyCloseIcon();return r`
|
|
540
538
|
<div class="mealz-recipe-details">
|
|
541
539
|
<!-- IF IS LOADING -->
|
|
542
540
|
${this.recipe?c:r`
|
|
@@ -704,4 +702,4 @@ import"../drawer/drawer.min.js";import"../recipe-pricing/recipe-pricing.min.js";
|
|
|
704
702
|
</div>
|
|
705
703
|
`:c}
|
|
706
704
|
</div>
|
|
707
|
-
`}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=
|
|
705
|
+
`}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=Ue([k("mealz-recipe-details")],j);customElements.get("mealz-recipe-details")||customElements.define("mealz-recipe-details",j);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as P,B as m}from"../assets/no-shadow-element-
|
|
1
|
+
import{N as P,B as m}from"../assets/no-shadow-element-D62BBu0I.js";import{V as b}from"../assets/viewport-listener-DsRHfwo4.js";import{t as f}from"../assets/custom-element-BhZVzxrc.js";import{w as I,m as n}from"../assets/mealz-sdk-E_fNZM-c.js";import{s as g}from"../assets/skipWhile-Beza3ws3.js";import{t as l}from"../assets/take-CpvJwza7.js";import{f as h}from"../assets/filter-q99GWcpD.js";import"../assets/debounceTime-Cf_7YmIn.js";import"../assets/async-C5Kj_SqM.js";import"../assets/OperatorSubscriber-DfCnFunn.js";import"../assets/empty-qrpgDBbc.js";class p{constructor(){this.priceMemorized=new Map,this.displayedPrices=new Set,this.cleanupInterval=null,this.MAX_MEMO_SIZE=500,this.CLEANUP_INTERVAL=600*1e3,this.handlePageUnload=()=>{this.destroy()},this.startAutoCleanup(),this.setupPageUnloadListener()}static getInstance(){return p.instance||(p.instance=new p),p.instance}getMemorizedPrice(e,r){const s=`${e}-${r}`;return this.priceMemorized.get(s)}memorizedPrice(e,r,s){const c=`${e}-${r}`;this.priceMemorized.size>=this.MAX_MEMO_SIZE&&this.cleanOldPrices(),this.priceMemorized.set(c,{price:s,guests:r})}isPriceDisplayed(e,r){const s=`${e}-${r}`;return this.displayedPrices.has(s)}markPriceAsDisplayed(e,r){const s=`${e}-${r}`;this.displayedPrices.add(s)}cleanOldPrices(){this.priceMemorized.size>this.MAX_MEMO_SIZE*.8&&Array.from(this.priceMemorized.entries()).slice(0,Math.floor(this.priceMemorized.size*.3)).forEach(([s])=>{this.priceMemorized.delete(s),this.displayedPrices.delete(s)})}clearAllPrices(){this.priceMemorized.clear(),this.displayedPrices.clear()}destroy(){window.removeEventListener("beforeunload",this.handlePageUnload),this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null),this.priceMemorized.clear(),this.displayedPrices.clear(),p.instance=null}startAutoCleanup(){this.cleanupInterval=window.setInterval(()=>{this.cleanOldPrices()},this.CLEANUP_INTERVAL)}setupPageUnloadListener(){window.addEventListener("beforeunload",this.handlePageUnload)}}var v=Object.getOwnPropertyDescriptor,y=(i,e,r,s)=>{for(var c=s>1?void 0:s?v(e,r):e,t=i.length-1,a;t>=0;t--)(a=i[t])&&(c=a(c)||c);return c};let o=class extends P{constructor(){super(...arguments),this.recipePricing=null,this.formattedPrice="",this.recipeId="",this.pricePerServe="",this.recipePricingValue=null,this.serves=0,this.posId="",this.extStoreId="",this.rendered=new m(!1),this.priceViewportObserver=null,this.priceFetched=!1,this.planner=!1,this.lastDisplayedRecipeId="",this.lastPlannerPrice=0,this.plannerPriceSubscription=null,this.lastAppliedPrice="",this.priceDisplayed=!1,this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.classList.add("re-rendering"),this.getInitialStatus(),this.listenInView(),I().then(()=>{this.setupSubscriptions()}).catch(i=>{console.warn("Failed to initialize SDK subscriptions:",i)}),requestAnimationFrame(()=>{this.classList.remove("re-rendering")})}disconnectedCallback(){var i;super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.plannerPriceSubscription&&(this.plannerPriceSubscription.unsubscribe(),this.plannerPriceSubscription=null),(i=this.priceViewportObserver)==null||i.disconnect()}setupSubscriptions(){const i=n;this.subscriptions.push(this.rendered.pipe(g(e=>!e),l(1)).subscribe(()=>{const e=i.basket.recipePricesInBasket$().subscribe(r=>{if(!r)return;const s=r.find(c=>c.id===this.recipeId);r.length>0&&s&&parseFloat(s.price)>0&&(this.serves=i.basket.guestsForRecipe(s.id),this.recipePricingValue={id:s.id,price:parseFloat(s.price),guests:this.serves},this.recalculatePrice(parseFloat(s.price),this.serves))});this.subscriptions.push(e)}),i.recipes.recipePriceUpdated().subscribe(e=>{e.recipeId===this.recipeId&&!e.inBasket&&this.recipePricingValue&&(this.recipePricingValue.price=e.remaining,this.recalculatePrice(e.remaining,this.serves))}),this.setupDisplayedRecipeSubscription(),this.setupGuestUpdatesSubscription(),this.setupMenuPriceSubscription())}setupDisplayedRecipeSubscription(){return n.recipes.displayedRecipe$.pipe(h(()=>this.planner&&!!this.recipeId)).subscribe(e=>{var r;((r=e==null?void 0:e.recipe)==null?void 0:r.id)===this.recipeId?(this.lastDisplayedRecipeId=this.recipeId,this.trackPlannerRecipePrice(),this.updateGuestCountFromMenu()):!(e!=null&&e.recipe)&&this.lastDisplayedRecipeId===this.recipeId&&(this.updatePriceFromCapturedPlannerPrice(),this.lastDisplayedRecipeId="",this.plannerPriceSubscription&&(this.plannerPriceSubscription.unsubscribe(),this.plannerPriceSubscription=null))})}setupGuestUpdatesSubscription(){return n.recipes.guestsUpdated().pipe(h(()=>!!this.recipeId)).subscribe(({guests:e,recipeId:r})=>{r===this.recipeId&&(this.serves=e,this.recipePricingValue&&this.recipePricingValue.price!==null&&this.recalculatePrice(this.recipePricingValue.price,this.serves))})}setupMenuPriceSubscription(){return n.planner.menuPrice$.pipe(h(()=>this.planner&&!!this.recipeId)).subscribe(()=>{if(this.lastPlannerPrice>0&&this.serves>0){const e=this.lastPlannerPrice/this.serves;this.applyCurrencyDisplay(e.toFixed(2))}})}fetchPrice(){const i=p.getInstance(),e=i.getMemorizedPrice(this.recipeId,this.serves);if(e){requestAnimationFrame(()=>{this.applyCurrencyDisplay(e.price),i.markPriceAsDisplayed(this.recipeId,this.serves)});return}this.fetchAndUpdatePrice()}render(){this.recipePricing=this.querySelector(".mealz-recipe-pricing"),this.recipePricing&&(this.recipeId&&this.pricePerServe&&p.getInstance().isPriceDisplayed(this.recipeId,this.serves)&&requestAnimationFrame(()=>{this.applyCurrencyDisplay(this.pricePerServe)}),this.rendered.next(!0),this.getInitialStatus())}getInitialStatus(){const i=this.attributes.getNamedItem("starting-data"),e=i==null?void 0:i.value;if(!e)return;const r=JSON.parse(e),{recipeId:s,extStoreId:c,posId:t,pricePerServe:a,serves:d,planner:u}=r;this.extStoreId=c||"",this.posId=t||"",this.recipeId=s,this.pricePerServe=(a==null?void 0:a.toString())??"",this.serves=d,this.planner=u||!1,this.recipePricingValue={id:this.recipeId,price:null,guests:this.serves},this.pricePerServe&&this.applyCurrencyDisplay(this.pricePerServe)}applyCurrencyDisplay(i){if(this.lastAppliedPrice===i)return;const e=parseFloat(i);isNaN(e)||(this.lastAppliedPrice=i,this.formattedPrice=e.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2}),this.recipePricing||(this.recipePricing=this.querySelector(".mealz-recipe-pricing")),this.updateDOM())}showPrice(){var r,s;if(this.priceDisplayed)return;const i=(r=this.recipePricing)==null?void 0:r.querySelector(".mealz-recipe-pricing__loading"),e=(s=this.recipePricing)==null?void 0:s.querySelector(".mealz-recipe-pricing__wrapper");i==null||i.classList.replace("active","hidden"),e==null||e.classList.replace("hidden","active"),this.priceDisplayed=!0}updateDOM(){var e;const i=(e=this.recipePricing)==null?void 0:e.querySelector(".mealz-recipe-pricing__wrapper__price");i&&(i.innerHTML=this.formattedPrice+" €",this.showPrice())}recalculatePrice(i,e){const r=(i/e).toString();this.applyCurrencyDisplay(r)}trackPlannerRecipePrice(){const i=n;this.plannerPriceSubscription&&(this.plannerPriceSubscription.unsubscribe(),this.plannerPriceSubscription=null),this.plannerPriceSubscription=i.planner.plannerRecipePrice$.subscribe(e=>{e>0&&(this.lastPlannerPrice=e)})}updateGuestCountFromMenu(){if(!this.planner||!this.recipeId)return;n.planner.getGuestsForRecipe(this.recipeId).pipe(l(1)).subscribe(e=>{e&&e>0&&(this.serves=e)})}updatePriceFromCapturedPlannerPrice(){if(!this.planner||!this.recipeId)return;n.planner.isRecipeInMenu$(this.recipeId).pipe(l(1)).subscribe(e=>{if(e&&this.lastPlannerPrice>0){if(this.serves>0){const r=this.lastPlannerPrice/this.serves;this.applyCurrencyDisplay(r.toFixed(2))}}else this.pricePerServe&&this.applyCurrencyDisplay(this.pricePerServe)})}listenInView(){this.priceViewportObserver=new b(this,()=>{var i;!this.priceFetched&&((i=this.recipePricingValue)==null?void 0:i.price)===null&&this.fetchPrice()})}fetchAndUpdatePrice(){const i=this.posId||this.extStoreId,e=!!this.extStoreId;if(!i||!this.recipeId||!this.serves)return;const c=n.recipes.fetchPricing(this.recipeId,i,this.serves,e).subscribe({next:t=>{t&&t["price-per-serve"]&&(this.pricePerServe=t["price-per-serve"].toString(),this.recipePricingValue={id:this.recipeId,price:t.price,guests:this.serves},this.recalculatePrice(t.price,this.serves),this.priceFetched=!0)},error:t=>{console.error("Failed to fetch recipe pricing:",t)}});this.subscriptions.push(c)}};o=y([f("mealz-recipe-pricing")],o);customElements.get("mealz-recipe-pricing")||customElements.define("mealz-recipe-pricing",o);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.mealz-recipe-to-basket{display:flex;flex-direction:column}.mealz-recipe-to-basket>*:not(:last-child){margin-bottom:16px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as p}from"../assets/custom-element-BhZVzxrc.js";import{N as h}from"../assets/no-shadow-element-D62BBu0I.js";import{w as d,m as o}from"../assets/mealz-sdk-E_fNZM-c.js";import{G as g}from"../assets/guestObserver-C5qvv1Ll.js";import"../assets/singleton-COF3iBbF.js";var m=Object.getOwnPropertyDescriptor,v=(t,e,a,i)=>{for(var s=i>1?void 0:i?m(e,a):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(s=n(s)||s);return s};let c=class extends h{constructor(){super(),this.plannerMode=!1,this.analyticsPath="",this.counterListener=t=>this.onCounterValueChange(t),this.guestObserverService=g.getInstance(),this.styleURL=new URL("./recipe-to-basket/recipe-to-basket.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.initializeFromStartingData(),this.addEventListener("valueChange",this.counterListener)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("valueChange",this.counterListener)}initializeFromStartingData(){const t=this.getAttribute("starting-data");if(t){try{const e=JSON.parse(t),a=typeof e.recipeId=="string"?e.recipeId:void 0,i=typeof e.guests=="number"?e.guests:void 0;this.plannerMode=!!e.planner,this.guests=i,a&&(this.analyticsPath=`/recipes/${a}/shopping`,d().then(()=>{var s,r;(r=(s=o)==null?void 0:s.recipes)==null||r.loadAndSetupRecipe(a,i).subscribe()}))}catch(e){console.warn("[mealz-recipe-to-basket] invalid starting-data attribute",e),this.removeAttribute("starting-data");return}this.removeAttribute("starting-data")}}onCounterValueChange(t){var s,r,n,u,l;const e=t.target;if(!(e!=null&&e.closest("mealz-counter")))return;const a=(s=t.detail)==null?void 0:s.value;if(typeof a!="number"||this.guests===a)return;this.guests=a,this.guestObserverService.updateGuests(this.guests);const i={originPath:this.analyticsPath,props:{}};this.plannerMode&&((n=(r=o)==null?void 0:r.planner)!=null&&n.updateGuests)?o.planner.updateGuests(this.guests,i):(l=(u=o)==null?void 0:u.recipes)==null||l.updateGuests(i,this.guests)}};c=v([p("mealz-recipe-to-basket")],c);customElements.get("mealz-recipe-to-basket")||customElements.define("mealz-recipe-to-basket",c);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../assets/promotion-badge-
|
|
1
|
+
import"../../assets/promotion-badge-B-er7bV2.js";import{N as n,k as s}from"../../assets/no-shadow-element-D62BBu0I.js";import{t as h}from"../../assets/custom-element-BhZVzxrc.js";import{n as p}from"../../assets/property-CoRN-Ln2.js";import{g as u,a as z}from"../../assets/price-utils-BRFZa-3D.js";import{m as o}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/price-D6RVRYHJ.js";import"../../assets/singleton-COF3iBbF.js";var b=Object.defineProperty,_=Object.getOwnPropertyDescriptor,l=(e,i,c,a)=>{for(var t=a>1?void 0:a?_(i,c):i,m=e.length-1,d;m>=0;m--)(d=e[m])&&(t=(a?d(i,c,t):d(t))||t);return a&&t&&b(i,c,t),t};let r=class extends n{constructor(){super(),this.noSupplier=o.supplier.isNoSupplier(),this.subscriptions=[],this.styleURL=new URL("./replace-item/replace-item-card/replace-item-card.css",this.getBaseURL()),this.subscriptions.push(o.replaceItem.replaceItemLoading$.subscribe(e=>{this.replaceItemLoading=e,this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}onSelectItem(e){const i={detail:{item:e},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("selectItem",i))}render(){var e,i,c,a,t,m;return s`
|
|
2
2
|
<div
|
|
3
3
|
class="
|
|
4
4
|
mealz-replace-item-card
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import"./replace-item-card/replace-item-card.min.js";import{N as
|
|
1
|
+
import"./replace-item-card/replace-item-card.min.js";import{N as g,n as b,D as d,k as l}from"../assets/no-shadow-element-D62BBu0I.js";import{t as _}from"../assets/custom-element-BhZVzxrc.js";import{c as v}from"../assets/capitalize-DUAqYmp4.js";import{m as c}from"../assets/mealz-sdk-E_fNZM-c.js";import{G as f}from"../assets/guestObserver-C5qvv1Ll.js";import{m as z}from"../assets/merge-DzIA6T0M.js";import{m}from"../assets/map-DT-7dkaR.js";import{d as I}from"../assets/debounceTime-Cf_7YmIn.js";import{f as S}from"../assets/filter-q99GWcpD.js";import{d as $}from"../assets/distinctUntilChanged-kXqVrZ5h.js";import{s as y}from"../assets/switchMap-BAdE9Uzw.js";import"../assets/promotion-badge-B-er7bV2.js";import"../assets/property-CoRN-Ln2.js";import"../assets/price-D6RVRYHJ.js";import"../assets/singleton-COF3iBbF.js";import"../assets/price-utils-BRFZa-3D.js";import"../assets/mergeAll-DpEYIxY3.js";import"../assets/mergeMap-D2yctTHQ.js";import"../assets/innerFrom-DePszgj9.js";import"../assets/OperatorSubscriber-DfCnFunn.js";import"../assets/executeSchedule-CEDvgTzM.js";import"../assets/empty-qrpgDBbc.js";import"../assets/args-DAL2bHut.js";import"../assets/isScheduler-CqHuyMwD.js";import"../assets/from-D8c5akO7.js";import"../assets/async-C5Kj_SqM.js";var E=Object.getOwnPropertyDescriptor,P=(e,t,r,s)=>{for(var i=s>1?void 0:s?E(t,r):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(i=n(i)||i);return i};let u=class extends g{constructor(){super(),this.addProductMode=!1,this.fromRecipeDetails=!1,this.isLoading=!1,this.subscriptions=[],this.searchString="",this.itemsWithPricesList=[],this.searchSubject=new b,this.guestObserverService=f.getInstance(),this.initialGuests=1,this.currentGuests=1,this.styleURL=new URL("./replace-item/replace-item.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(this.setupSearchObservable(),c.replaceItem.basketEntryToReplace$.subscribe(e=>{this.handleToReplace(e)}),z(c.recipes.displayedRecipe$.pipe(m(e=>{var r,s,i,a;const t=(r=e==null?void 0:e.recipe)==null?void 0:r.id;if(t){this.currentRecipeId=t,this.fromRecipeDetails=!0;const n=((i=(s=e==null?void 0:e.recipe)==null?void 0:s.attributes)==null?void 0:i["number-of-guests"])||1,o=(a=e==null?void 0:e.recipe)==null?void 0:a.modifiedGuests;this.initialGuests=Number(n)||1,this.currentGuests=Number(o||n)||1,this.calculateQty()}})),c.replaceItem.replaceProductFromPreviewOpen$.pipe(m(e=>{e&&(this.basketEntry=e)})),c.replaceItem.additionModalOpen$.pipe(m(e=>{this.addProductMode=e})),c.replaceItem.itemsWithPricesList$.pipe(m(e=>{this.itemsWithPricesList=e})),c.replaceItem.fetchingItemLoading$.pipe(m(e=>{this.isLoading=e}))).subscribe(()=>this.requestUpdate()),this.guestObserverService.guests$.subscribe(e=>{this.currentGuests=Number(e)||this.currentGuests||1,this.calculateQty()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}handleToReplace(e){var r;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,e.initialGuests&&(this.initialGuests=Number(e.initialGuests)||this.initialGuests),e.currentGuests&&(this.currentGuests=Number(e.currentGuests)||this.currentGuests);const t=this.basketEntry;if(t&&t.name&&!(t.attributes&&t.attributes.name)&&(t.attributes={...t.attributes||{},name:t.name}),this.ingredient&&(this.fromRecipeDetails=!0,!this.currentRecipeId)){const s=this.basketEntry,i=(s==null?void 0:s.recipesIds)&&s.recipesIds[0]||((r=s==null?void 0:s.attributes)==null?void 0:r["recipe-ids"])&&s.attributes["recipe-ids"][0];i&&(this.currentRecipeId=String(i))}this.calculateQty(),this.requestUpdate()}calculateQty(){var i,a,n;if(!this.ingredient)return;const e=((i=this.ingredient)==null?void 0:i.quantity)??((n=(a=this.ingredient)==null?void 0:a.attributes)==null?void 0:n.quantity),t=Number(e);if(!Number.isFinite(t))return;const r=this.initialGuests||1,s=t/r;this.modifiedIngQty=Number((s*(this.currentGuests||r)).toFixed(2))}onClose(){c.replaceItem.replaceItemLoading$.next(void 0),c.replaceItem.basketEntryToReplace$.next(void 0),c.productAddition.close()}onSearchInputChange(e){this.searchString=e.target.value,this.searchSubject.next(this.searchString)}setupSearchObservable(){return this.searchSubject.pipe(I(200),S(e=>e.length>=3),$(),y(e=>c.replaceItem.searchItem(e))).subscribe()}onSelectItem(e){var s;const t=(s=this.basketEntry)==null?void 0:s.id,r=this.fromRecipeDetails?`/recipes/${this.currentRecipeId}/shopping`:"/basket/products";c.replaceItem.onSelectItem(e.detail.item,this.searchString,()=>{this.onClose(),c.productAddition.productAdded$.next(t)},{originPath:`${r}/item-selector`,props:{}})}renderIssues(){var e,t;return l`
|
|
2
2
|
<!-- NO SUBSTITUTION PRODUCT -->
|
|
3
|
-
${!this.isLoading&&this.itemsWithPricesList.length===1&&!this.searchString?
|
|
3
|
+
${!this.isLoading&&this.itemsWithPricesList.length===1&&!this.searchString?l`
|
|
4
4
|
<div class="mealz-replace-item__error">
|
|
5
5
|
<div class="mealz-replace-item__error-image-container small-img">
|
|
6
6
|
<img class="mealz-replace-item__error-image"
|
|
@@ -13,10 +13,10 @@ import"./replace-item-card/replace-item-card.min.js";import{N as h,n as u,D as o
|
|
|
13
13
|
<span>Aucun produit de substitution trouvé</span>
|
|
14
14
|
</span>
|
|
15
15
|
</div>
|
|
16
|
-
`:
|
|
16
|
+
`:d}
|
|
17
17
|
|
|
18
18
|
<!-- NO PRODUCTS FOUND -->
|
|
19
|
-
${!this.addProductMode&&!this.isLoading&&this.itemsWithPricesList.length===0?
|
|
19
|
+
${!this.addProductMode&&!this.isLoading&&this.itemsWithPricesList.length===0?l`
|
|
20
20
|
<div class="mealz-replace-item__error">
|
|
21
21
|
<div class="mealz-replace-item__error-image-container">
|
|
22
22
|
<img class="mealz-replace-item__error-image"
|
|
@@ -27,8 +27,8 @@ import"./replace-item-card/replace-item-card.min.js";import{N as h,n as u,D as o
|
|
|
27
27
|
<span class="mealz-replace-item__issue-title mealz-replace-item__issue-title__not-found mealz-ds-text"><span>Aucun produit trouvé pour cette recherche</span></span>
|
|
28
28
|
<span class="mealz-replace-item__issue-description mealz-ds-text weight-xxl"><span>Essayez avec un autre mot-clé</span></span>
|
|
29
29
|
</div>
|
|
30
|
-
`:
|
|
31
|
-
`}render(){var e,t,
|
|
30
|
+
`:d}
|
|
31
|
+
`}render(){var e,t,r,s,i,a,n,o;return l`
|
|
32
32
|
<div class="mealz-replace-item">
|
|
33
33
|
<!-- HEADER -->
|
|
34
34
|
<div class="mealz-replace-item__header mealz-ds-text weight-xxl">
|
|
@@ -40,7 +40,7 @@ import"./replace-item-card/replace-item-card.min.js";import{N as h,n as u,D as o
|
|
|
40
40
|
class="mealz-replace-item__back-button-icon"
|
|
41
41
|
>
|
|
42
42
|
</button>
|
|
43
|
-
${(e=this.basketEntry)!=null&&e.selectedItem&&!this.ignoreSelected&&!this.addProductMode?
|
|
43
|
+
${(e=this.basketEntry)!=null&&e.selectedItem&&!this.ignoreSelected&&!this.addProductMode?l`<span>Remplacer un produit</span>`:l`<span>Ajouter un produit</span>`}
|
|
44
44
|
</div>
|
|
45
45
|
<div class="mealz-replace-item__top-container">
|
|
46
46
|
<!-- SEARCH -->
|
|
@@ -57,32 +57,32 @@ import"./replace-item-card/replace-item-card.min.js";import{N as h,n as u,D as o
|
|
|
57
57
|
<div class="mealz-ds-loader ${this.isLoading?"":"hidden"}"></div>
|
|
58
58
|
</div>
|
|
59
59
|
<!-- PRODUCT NEEDED BANNER -->
|
|
60
|
-
${this.fromRecipeDetails?
|
|
60
|
+
${this.fromRecipeDetails?l`
|
|
61
61
|
<div class="mealz-replace-item__product-banner">
|
|
62
62
|
<span class="mealz-replace-item__banner-product-name mealz-ds-text size-s">
|
|
63
|
-
<span>${
|
|
63
|
+
<span>${v(((r=(t=this.basketEntry)==null?void 0:t.attributes)==null?void 0:r.name)||"")} :</span>
|
|
64
64
|
<span class="mealz-replace-item__banner-quantity mealz-ds-text weight-xxl">
|
|
65
|
-
${this.modifiedIngQty||((a=this.ingredient)==null?void 0:a.quantity)} ${(
|
|
65
|
+
${this.modifiedIngQty||((s=this.ingredient)==null?void 0:s.quantity)||((a=(i=this.ingredient)==null?void 0:i.attributes)==null?void 0:a.quantity)} ${(o=(n=this.ingredient)==null?void 0:n.attributes)==null?void 0:o.unit}
|
|
66
66
|
</span>
|
|
67
67
|
</span>
|
|
68
68
|
</div>
|
|
69
|
-
`:
|
|
69
|
+
`:d}
|
|
70
70
|
</div>
|
|
71
71
|
<!-- PRODUCT LIST GRID -->
|
|
72
72
|
<div class="mealz-replace-item__product-list ${this.itemsWithPricesList.length<2?"full-width":""}">
|
|
73
73
|
<!-- PRODUCT CARD -->
|
|
74
|
-
${this.itemsWithPricesList.map((
|
|
74
|
+
${this.itemsWithPricesList.map((p,h)=>l`
|
|
75
75
|
<mealz-replace-item-card
|
|
76
|
-
.itemWithPrice=${
|
|
77
|
-
.index=${
|
|
76
|
+
.itemWithPrice=${p}
|
|
77
|
+
.index=${h}
|
|
78
78
|
.basketEntry=${this.basketEntry}
|
|
79
|
-
.ignoreSelected=${this.ignoreSelected}
|
|
79
|
+
.ignoreSelected=${!!this.ignoreSelected}
|
|
80
80
|
@selectItem=${this.onSelectItem}
|
|
81
81
|
></mealz-replace-item-card>`)}
|
|
82
82
|
<!-- ISSUES -->
|
|
83
83
|
${this.renderIssues()}
|
|
84
84
|
<!-- ADD PRODUCT DEFAULT VIEW -->
|
|
85
|
-
${this.addProductMode&&!this.isLoading&&this.itemsWithPricesList.length===0?
|
|
85
|
+
${this.addProductMode&&!this.isLoading&&this.itemsWithPricesList.length===0?l`
|
|
86
86
|
<div class="mealz-replace-item__add-product-default">
|
|
87
87
|
<div class="mealz-replace-item__add-product-image-container">
|
|
88
88
|
<img class="mealz-replace-item__add-product-image"
|
|
@@ -90,7 +90,7 @@ import"./replace-item-card/replace-item-card.min.js";import{N as h,n as u,D as o
|
|
|
90
90
|
alt="search icon"/>
|
|
91
91
|
</div>
|
|
92
92
|
<span class="mealz-replace-item__add-product-title mealz-ds-text">Trouver une liste de produit en effectuant votre recherche</span>
|
|
93
|
-
</div>`:
|
|
93
|
+
</div>`:d}
|
|
94
94
|
</div>
|
|
95
95
|
</div>
|
|
96
|
-
`}};
|
|
96
|
+
`}};u=P([_("mealz-replace-item")],u);customElements.get("mealz-replace-item")||customElements.define("mealz-replace-item",u);
|
package/dist/replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../assets/promotion-badge-
|
|
1
|
+
import"../../assets/promotion-badge-B-er7bV2.js";import{N as d,k as t}from"../../assets/no-shadow-element-D62BBu0I.js";import{t as o}from"../../assets/custom-element-BhZVzxrc.js";import{n}from"../../assets/property-CoRN-Ln2.js";import{g as h,a as u}from"../../assets/price-utils-BRFZa-3D.js";import{m as z}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/price-D6RVRYHJ.js";import"../../assets/singleton-COF3iBbF.js";var P=Object.defineProperty,_=Object.getOwnPropertyDescriptor,p=(a,r,l,s)=>{for(var e=s>1?void 0:s?_(r,l):r,c=a.length-1,m;c>=0;c--)(m=a[c])&&(e=(s?m(r,l,e):m(e))||e);return s&&e&&P(r,l,e),e};let i=class extends d{constructor(){super(),this.noSupplier=z.supplier.isNoSupplier(),this.styleURL=new URL("./replace-item-planner/replace-item-card-planner/replace-item-card-planner.css",this.getBaseURL())}onSelectItem(){this.itemWithPrice.status="ticked";const a={detail:{itemWithPrice:this.itemWithPrice},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("selectItem",a)),this.requestUpdate()}render(){return t`
|
|
2
2
|
<div class=" mealz-replace-item-card-planner
|
|
3
3
|
${this.itemWithPrice.status==="ticked"?"selected":""}"
|
|
4
4
|
>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as h,n as d,D as o,k as a}from"../assets/no-shadow-element-
|
|
1
|
+
import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as h,n as d,D as o,k as a}from"../assets/no-shadow-element-D62BBu0I.js";import{c as u}from"../assets/capitalize-DUAqYmp4.js";import{t as g}from"../assets/custom-element-BhZVzxrc.js";import{m as i}from"../assets/mealz-sdk-E_fNZM-c.js";import{m as _}from"../assets/merge-DzIA6T0M.js";import{m}from"../assets/map-DT-7dkaR.js";import{d as b}from"../assets/debounceTime-Cf_7YmIn.js";import{f as z}from"../assets/filter-q99GWcpD.js";import{d as v}from"../assets/distinctUntilChanged-kXqVrZ5h.js";import{s as S}from"../assets/switchMap-BAdE9Uzw.js";import"../assets/promotion-badge-B-er7bV2.js";import"../assets/property-CoRN-Ln2.js";import"../assets/price-D6RVRYHJ.js";import"../assets/singleton-COF3iBbF.js";import"../assets/price-utils-BRFZa-3D.js";import"../assets/mergeAll-DpEYIxY3.js";import"../assets/mergeMap-D2yctTHQ.js";import"../assets/innerFrom-DePszgj9.js";import"../assets/OperatorSubscriber-DfCnFunn.js";import"../assets/executeSchedule-CEDvgTzM.js";import"../assets/empty-qrpgDBbc.js";import"../assets/args-DAL2bHut.js";import"../assets/isScheduler-CqHuyMwD.js";import"../assets/from-D8c5akO7.js";import"../assets/async-C5Kj_SqM.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">
|