mealz-components 2.6.0 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/assets/accordion-BGFgJnk1.js +19 -0
  2. package/dist/assets/product-card-wIoU7Z_5.js +189 -0
  3. package/dist/assets/promotion-badge-CDaL7Tqv.js +12 -0
  4. package/dist/basket-transfer-modal/basket-transfer-modal.min.js +5 -5
  5. package/dist/catalog/basket-preview/basket-preview.min.js +14 -14
  6. package/dist/catalog/catalog-category/catalog-category.min.js +1 -1
  7. package/dist/catalog/catalog-favorites/catalog-favorites.min.js +1 -1
  8. package/dist/catalog/catalog-history/catalog-history.min.js +1 -1
  9. package/dist/catalog/catalog-home/catalog-home.min.js +1 -1
  10. package/dist/catalog/catalog-home-header/catalog-home-header.min.js +1 -1
  11. package/dist/catalog/catalog-list/catalog-list.min.js +1 -1
  12. package/dist/catalog/catalog-tabs/catalog-tabs.min.js +1 -1
  13. package/dist/catalog/catalog-toolbar/catalog-toolbar.min.js +1 -1
  14. package/dist/catalog/my-meals-button/my-meals-button.min.js +1 -1
  15. package/dist/counter/counter.min.js +2 -2
  16. package/dist/drawer/drawer.min.js +5 -5
  17. package/dist/drawer-view-swapper/drawer-view-swapper.min.js +23 -23
  18. package/dist/history-drawer/history-drawer.min.js +1 -1
  19. package/dist/history-order/history-order.min.js +1 -1
  20. package/dist/history-order-expanded/history-order-expanded.min.js +1 -1
  21. package/dist/last-order-badge/last-order-badge.min.js +2 -2
  22. package/dist/last-order-modal/last-order-modal.min.js +4 -4
  23. package/dist/like-button/like-button.min.js +1 -1
  24. package/dist/modal/modal.min.js +4 -4
  25. package/dist/no-supplier-add-to-cart-cta/no-supplier-add-to-cart-cta.min.js +2 -2
  26. package/dist/onboarding/onboarding.min.js +4 -4
  27. package/dist/order-again/order-again.min.js +2 -2
  28. package/dist/planner/helpers/get-planner-onboarding-modal-config.min.js +1 -1
  29. package/dist/planner/helpers/init-planner-onboarding-modal.min.js +1 -1
  30. package/dist/planner/helpers/open-onboarding-modal.min.js +1 -1
  31. package/dist/planner/helpers/planner-onboarding-storage.min.js +1 -0
  32. package/dist/planner/planner-abandon-modal/planner-abandon-modal.min.js +2 -2
  33. package/dist/planner/planner-budget-edit-modal/planner-budget-edit-modal.min.js +2 -2
  34. package/dist/planner/planner-budget-gauge/planner-budget-gauge.min.js +1 -1
  35. package/dist/planner/planner-catalog/planner-catalog.min.js +2 -2
  36. package/dist/planner/planner-current-menu/planner-current-menu.css +1 -1
  37. package/dist/planner/planner-current-menu/planner-current-menu.min.js +1 -1
  38. package/dist/planner/planner-current-menu-modal/planner-current-menu-modal.min.js +2 -2
  39. package/dist/planner/planner-form/planner-form.min.js +7 -7
  40. package/dist/planner/planner-menu-option/planner-menu-option.min.js +1 -1
  41. package/dist/planner/planner-onboarding/planner-onboarding.min.js +1 -1
  42. package/dist/planner/planner-onboarding-modal/planner-onboarding-modal.min.js +6 -6
  43. package/dist/planner/planner-open-catalog-modal/planner-open-catalog-modal.min.js +2 -2
  44. package/dist/planner/planner-quick-menu/planner-quick-menu.min.js +1 -1
  45. package/dist/planner/planner-recipe-card/planner-recipe-card.min.js +1 -1
  46. package/dist/planner/planner-recipe-list/planner-recipe-list.min.js +1 -1
  47. package/dist/planner/planner-recipe-suggestion/planner-recipe-suggestion.min.js +1 -1
  48. package/dist/planner/planner-welcome-modal/planner-welcome-modal.min.js +3 -3
  49. package/dist/planner/to-basket-loader/to-basket-loader.min.js +5 -5
  50. package/dist/planner-entry/planner-entry.min.js +1 -1
  51. package/dist/preferences/preferences.min.js +4 -4
  52. package/dist/price/price.min.js +3 -3
  53. package/dist/products-to-basket-cta/products-to-basket-cta.min.js +1 -1
  54. package/dist/recipe-card/recipe-card.min.js +1 -1
  55. package/dist/recipe-card-cta/recipe-card-cta.min.js +1 -1
  56. package/dist/recipe-details/recipe-details.min.js +111 -111
  57. package/dist/recipe-pricing/recipe-pricing.min.js +1 -1
  58. package/dist/recipe-to-basket/recipe-to-basket.min.js +1 -1
  59. package/dist/replace-item/replace-item-card/replace-item-card.min.js +11 -11
  60. package/dist/replace-item/replace-item.min.js +13 -13
  61. package/dist/replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js +4 -4
  62. package/dist/replace-item-planner/replace-item-planner.min.js +13 -13
  63. package/dist/select/select.min.js +6 -6
  64. package/dist/slider-tabs/slider-tabs.min.js +3 -3
  65. package/dist/store-indicator/store-indicator.min.js +2 -2
  66. package/dist/store-locator/store-locator.min.js +2 -2
  67. package/dist/store-locator-drawer/store-locator-drawer.min.js +2 -2
  68. package/dist/supplier-selector/supplier-selector.min.js +6 -6
  69. package/package.json +1 -1
  70. package/dist/assets/accordion-sjJSL32r.js +0 -19
  71. package/dist/assets/custom-element-BhZVzxrc.js +0 -5
  72. package/dist/assets/product-card-TLfT6URx.js +0 -189
  73. package/dist/assets/promotion-badge-B-er7bV2.js +0 -12
  74. package/dist/planner/planner-dashboard/planner-dashboard.css +0 -1
  75. package/dist/planner/planner-dashboard/planner-dashboard.min.js +0 -1
  76. package/dist/planner-banner/planner-banner.css +0 -1
  77. package/dist/planner-card-link/planner-card-link.css +0 -1
@@ -0,0 +1,19 @@
1
+ import{N as p,D as l,k as h}from"./no-shadow-element-D62BBu0I.js";import{n as i}from"./property-CoRN-Ln2.js";var u=Object.defineProperty,n=(a,t,e,c)=>{for(var o=void 0,r=a.length-1,d;r>=0;r--)(d=a[r])&&(o=d(t,e,o)||o);return o&&u(t,e,o),o};class s extends p{constructor(){super(),this.titleSlot=l,this.contentSlot=l,this.noStyling=!1,this.isCollapsed=!0,this.hasInitializedSlots=!1,this.styleURL=new URL("./accordion/accordion.css",this.getBaseURL())}connectedCallback(){if(super.connectedCallback(),this.hasInitializedSlots)return;const t=this.querySelector('[slot="title"]'),e=this.querySelector('[slot="content"]'),c=!!(t||e);t&&(t.removeAttribute("slot"),this.titleSlot=t),e&&(e.removeAttribute("slot"),this.contentSlot=e),c&&(this.innerHTML="",this.hasInitializedSlots=!0)}disconnectedCallback(){super.disconnectedCallback()}toggleAccordion(){this.isCollapsed=!this.isCollapsed,this.dispatchEvent(new CustomEvent("isCollapsedChange",{detail:{isCollapsed:this.isCollapsed},bubbles:!0,composed:!0})),this.requestUpdate()}updated(){this.classList.toggle("opened",!this.isCollapsed)}renderSlotContent(t){return t===l?l:typeof t=="string"?h`${t}`:t}render(){return h`
2
+ <button
3
+ class="mealz-accordion__header${this.noStyling?"-no-styling":""}"
4
+ @click=${()=>this.toggleAccordion()}
5
+ aria-expanded=${!this.isCollapsed}
6
+ >
7
+ ${this.renderSlotContent(this.titleSlot)}
8
+ <img
9
+ class="mealz-accordion__icon"
10
+ src=${this.iconUrl??"https://storage.googleapis.com/assets.miam.tech/generic/icons/chevron-down.svg"}
11
+ alt="open and close icon"
12
+ />
13
+ </button>
14
+ <div class="mealz-accordion__collapsable-container${this.noStyling?"-no-styling":""}">
15
+ <div class="mealz-accordion__collapsable-content">
16
+ ${this.renderSlotContent(this.contentSlot)}
17
+ </div>
18
+ </div>
19
+ `}}n([i({attribute:!1})],s.prototype,"titleSlot");n([i({attribute:!1})],s.prototype,"contentSlot");n([i({type:String})],s.prototype,"iconUrl");n([i({type:Boolean})],s.prototype,"noStyling");n([i({type:Boolean})],s.prototype,"isCollapsed");customElements.get("mealz-accordion")||customElements.define("mealz-accordion",s);
@@ -0,0 +1,189 @@
1
+ import"../price/price.min.js";import"../counter/counter.min.js";import"./promotion-badge-CDaL7Tqv.js";import{N as m,k as i,D as _}from"./no-shadow-element-D62BBu0I.js";import{n as l}from"./property-CoRN-Ln2.js";import{G as k}from"./guestObserver-C5qvv1Ll.js";import{c as $}from"./capitalize-DUAqYmp4.js";import{m as c}from"./mealz-sdk-E_fNZM-c.js";import{d as E}from"./delay-DHNms76g.js";import{P}from"./price-D6RVRYHJ.js";var I=Object.defineProperty,y=(d,t,e,n)=>{for(var s=void 0,a=d.length-1,r;a>=0;a--)(r=d[a])&&(s=r(t,e,s)||s);return s&&I(t,e,s),s};class h extends m{constructor(){super(),this.isSponsored=!1,this.priceService=P.getInstance(),this.styleURL=new URL("./product-badges/product-badges.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.applyStartingDataFromAttribute()}formatNumber(t){const e=c.user.getLanguage()||"fr";return new Intl.NumberFormat(e,{minimumFractionDigits:1,maximumFractionDigits:2}).format(t)}render(){var t,e,n,s,a;return i`
2
+ <div class="mealz-product-badges">
3
+ <!-- SPONSORED BADGE -->
4
+ ${this.isSponsored?i`
5
+ <div class="mealz-ds-badge mealz-ds-text size-xs weight-l">
6
+ <span>Sponsorisé</span>
7
+ </div>
8
+ `:i``}
9
+ <!-- PRODUCT CAPACITY -->
10
+ ${(t=this.item)!=null&&t.capacityVolume||(n=(e=this.item)==null?void 0:e.attributes)!=null&&n["capacity-volume"]?i`
11
+ <div class="mealz-ds-badge mealz-ds-text size-xs weight-l outline">
12
+ ${this.formatNumber(this.item.capacityVolume||this.item.attributes["capacity-volume"])}
13
+ ${this.item.capacityUnit||this.item.attributes["capacity-unit"]}
14
+ </div>
15
+ `:i``}
16
+ <!-- PRODUCT PRICE PER UNIT -->
17
+ ${(s=this.price)!=null&&s.pricePerUnit&&((a=this.price)!=null&&a.unitOfMeasurement)?i`
18
+ <span class="mealz-ds-text size-xs mealz-product-badges__details product-price-per-unit">
19
+ ${this.priceService.priceTemplate(this.price.pricePerUnit)}
20
+ /${this.price.unitOfMeasurement}
21
+ </span>
22
+ `:i``}
23
+ </div>
24
+ `}applyStartingDataFromAttribute(){const t=this.getAttribute("starting-data");if(t){try{const e=JSON.parse(t);typeof e.isSponsored=="boolean"&&(this.isSponsored=e.isSponsored)}catch(e){console.warn("[product-badges] starting-data parse error",e)}this.removeAttribute("starting-data")}}}y([l({type:Boolean})],h.prototype,"isSponsored");y([l({type:Object})],h.prototype,"item");y([l({type:Object})],h.prototype,"price");customElements.get("mealz-product-badges")||customElements.define("mealz-product-badges",h);var C=Object.defineProperty,x=(d,t,e,n)=>{for(var s=void 0,a=d.length-1,r;a>=0;a--)(r=d[a])&&(s=r(t,e,s)||s);return s&&C(t,e,s),s};class z extends m{constructor(){super(),this.styleURL=new URL("./unavailable-badge/unavailable-badge.css",this.getBaseURL())}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}clicked(){const t=new CustomEvent("clicked",{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return i`
25
+ <button
26
+ class="mealz-ds-badge mealz-unavailable-badge ${this.numberUnavailable?"pointer":""}"
27
+ ?disabled="${!this.numberUnavailable}"
28
+ @click="${()=>this.clicked()}">
29
+ <div class="mealz-unavailable-badge__icon">!</div>
30
+ ${this.numberUnavailable?"":i`<span>Indisponible</span>`}
31
+ ${this.numberUnavailable?i`<span>${this.numberUnavailable}</span>`:""}
32
+ ${this.numberUnavailable&&this.numberUnavailable<=1?i`<span>produit indisponible</span>`:""}
33
+ ${this.numberUnavailable&&this.numberUnavailable>1?i`<span>produits indisponible</span>`:""}
34
+ </button>
35
+ `}}x([l({type:Number})],z.prototype,"numberUnavailable");customElements.get("mealz-unavailable-badge")||customElements.define("mealz-unavailable-badge",z);var R=Object.defineProperty,U=(d,t,e,n)=>{for(var s=void 0,a=d.length-1,r;a>=0;a--)(r=d[a])&&(s=r(t,e,s)||s);return s&&R(t,e,s),s};class f extends m{constructor(){super(),this.styleURL=new URL("./out-of-stock-overlay/out-of-stock-overlay.css",this.getBaseURL())}replacedClicked(){const t=new CustomEvent("replacedClicked",{bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return i`
36
+ <div class="mealz-out-of-stock-overlay">
37
+ <div class="mealz-out-of-stock-overlay__container"></div>
38
+ <div class="mealz-out-of-stock-overlay__footer">
39
+ <mealz-unavailable-badge></mealz-unavailable-badge>
40
+ <button @click="${()=>this.replacedClicked()}"
41
+ class="mealz-ds-button mealz-ds-text weight-l small primary reverse">Remplacer</button>
42
+ </div>
43
+ </div>
44
+ `}}U([l()],f.prototype,"priceData");customElements.get("mealz-out-of-stock-overlay")||customElements.define("mealz-out-of-stock-overlay",f);var A=Object.defineProperty,b=(d,t,e,n)=>{for(var s=void 0,a=d.length-1,r;a>=0;a--)(r=d[a])&&(s=r(t,e,s)||s);return s&&A(t,e,s),s};const v=["ignored","deleted","often_deleted","unavailable"],g=["ignored","deleted","often_deleted"],S=["initial","active","out_of_stock"],B=["initial","out_of_stock"];class p extends m{constructor(){super(),this.recipeId="",this.initialGuests=0,this.currentGuests=0,this.inBasket=!1,this.isSponsored=!1,this.analyticsPath="",this.subscriptions=[],this.loadingAddToBasket=!1,this.ingredientIsRemoved=!1,this.guestObserverService=k.getInstance(),this.modifiedIngQty=0,this.styleURL=new URL("./product-card/product-card.css",this.getBaseURL())}get status(){var t,e;return(e=(t=this.product)==null?void 0:t.basketEntry)==null?void 0:e.status}set status(t){this.product.basketEntry.status=t}get productImage(){return this.product.basketEntry.selectedItem.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 props(){var a;const t=((a=this.product)==null?void 0:a.basketEntry)||{},e=t.attributes||{},n=t.selectedItem||t.relationships&&t.relationships["selected-item"]&&t.relationships["selected-item"].data||{},s=n&&n.attributes||{};return{entry_name:e.name??"",item_id:n.id??"",ext_item_id:s["ext-id"]??"",item_ean:s.ean??"",product_quantity:e.quantity!=null?String(e.quantity):""}}get selectors(){return{ignoreButton:".mealz-product-card__ignore-product",replaceButton:".mealz-product-card__replace-product",addProductButton:".mealz-product-card__add-product"}}updated(){var t,e;this.product&&(this.status==="deleted"&&(this.ingredientIsRemoved=!1),this.isSponsored=((e=(t=this.product.basketEntry.selectedItem)==null?void 0:t.attributes)==null?void 0:e.sponsored)===!0)}connectedCallback(){var t;super.connectedCallback(),this.listenGuestsChange(),this.productIsBeingAdded(),this.isRecipeInBasket(),(t=this.product)!=null&&t.ingredient&&this.calculateQty(),this.analyticsPath=`/recipes/${this.recipeId}/shopping`}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(t=>t.unsubscribe())}listenGuestsChange(){this.subscriptions.push(this.guestObserverService.guests$.subscribe(t=>{this.currentGuests=t,this.calculateQty()}))}calculateQty(){var a,r,o,u;if(!this.isConnected||!((a=this.product)!=null&&a.ingredient))return;const t=((r=this.product.ingredient)==null?void 0:r.quantity)??((u=(o=this.product.ingredient)==null?void 0:o.attributes)==null?void 0:u.quantity),e=Number(t),n=this.initialGuests||1;if(!Number.isFinite(e))return;const s=e/n;this.modifiedIngQty=Number((s*(this.currentGuests||n)).toFixed(2)),this.requestUpdate()}replaceProduct(t){var n,s,a,r;if(this.sendEntryReplaceEvent(),!!this.closest("mealz-recipe-details"))c.recipes.replaceBasketEntry(this.product.basketEntry,t);else{const o=(n=this.product)==null?void 0:n.basketEntry;o.name||(o.name=((r=(a=(s=this.product)==null?void 0:s.basketEntry)==null?void 0:a.attributes)==null?void 0:r.name)||""),c.replaceItem.basketEntryToReplace$.next({basketEntry:o,ignoreSelected:t,ingredient:this.product.ingredient,addProductMode:!1,initialGuests:this.initialGuests||4,currentGuests:this.currentGuests||this.initialGuests||4}),this.requestUpdate()}this.scrollBackWhenReplaced()}scrollBackWhenReplaced(){this.subscriptions.push(c.productAddition.productAdded$.pipe(E(200)).subscribe(()=>{this.isConnected&&(this.scrollIntoView({behavior:"smooth",block:"center"}),this.requestUpdate())}))}isInXRecipes(){var e;const t=(e=this.product)==null?void 0:e.basketEntry;return!t||t.status!=="active"?1:Array.isArray(t.recipesIds)?t.recipesIds.length:1}isRecipeInBasket(){this.subscriptions.push(c.recipes.recipePrice$.subscribe(t=>{this.inBasket=t.inBasket>0}))}ignoreProduct(){this.sendEntryIgnoreEvent(),c.recipes.ignoreProduct(this.product),this.requestUpdate()}updateQuantity(t){this.product.basketEntry.quantity!==t.detail.value&&(t.detail.value<1?(this.ingredientIsRemoved=!0,c.recipes.ingredientRemoved(this.product.ingredient,{originPath:this.analyticsPath,props:{}}),this.sendEntryDeleteEvent()):c.recipes.updateProductQuantity(this.product.basketEntry,t.detail.value,{originPath:this.analyticsPath,props:{}}),c.recipes.updateIngredientFromBasketLoading$.next(!0),this.requestUpdate())}addToBasket(){this.sendEntryAddEvent(),c.recipes.addToBasket(this.product,{props:{},originPath:this.analyticsPath}),this.requestUpdate()}productIsBeingAdded(){this.subscriptions.push(c.recipes.productIsBeingAdded(this.product.basketEntry).subscribe(t=>{this.loadingAddToBasket=t,this.requestUpdate()}))}render(){var t;return i`
45
+ ${(t=this.product)!=null&&t.basketEntry?this.renderProductCard():_}
46
+ `}renderProductCard(){return i`
47
+ <div
48
+ class="mealz-product-card
49
+ ${this.status==="active"?"added":""}
50
+ ${v.includes(this.status)?"disabled":""}
51
+ ${this.status==="out_of_stock"?"out_of_stock":""} ${this.status==="unavailable"?"unavailable":""}"
52
+ >
53
+ ${this.renderOutOfStockOverlay()}
54
+ ${this.renderHeader()}
55
+ <div
56
+ class="
57
+ mealz-product-card__content
58
+ ${g.includes(this.status)?"disabled":""}
59
+ ${this.status==="unavailable"?"unavailable":""}">
60
+ ${S.includes(this.status)?this.renderEnabledProductCard():this.renderDisabledOrUnavailableProduct()}
61
+ </div>
62
+ ${this.renderCalculatedForXRecipes()}
63
+ </div>
64
+ `}renderEnabledProductCard(){var t,e,n,s,a,r,o,u;return i`
65
+ <mealz-promotion-badge .priceData="${this.product.price}"></mealz-promotion-badge>
66
+ <div class="mealz-product-card__selected-product">
67
+ <div class="mealz-product-card__picture-column">
68
+ <img class="mealz-product-card__picture" alt="${((s=(n=(e=(t=this.product)==null?void 0:t.basketEntry)==null?void 0:e.selectedItem)==null?void 0:n.attributes)==null?void 0:s.brand)||""} ${((u=(o=(r=(a=this.product)==null?void 0:a.basketEntry)==null?void 0:r.selectedItem)==null?void 0:o.attributes)==null?void 0:u.name)||"product"}" src="${this.productImage}">
69
+ </div>
70
+ <div class="mealz-product-card__info-column">
71
+ <span class="mealz-ds-text size-xs weight-xl mealz-product-card__details product-brand">
72
+ ${this.product.basketEntry.selectedItem.attributes.brand}
73
+ </span>
74
+ <span class="mealz-ds-text size-xs mealz-product-card__details product-fullname">
75
+ ${this.product.basketEntry.selectedItem.attributes.name}
76
+ </span>
77
+ <mealz-product-badges
78
+ .isSponsored="${this.isSponsored}"
79
+ .item="${this.product.basketEntry.selectedItem}"
80
+ .price="${this.product.price}"
81
+ ></mealz-product-badges>
82
+ </div>
83
+ </div>
84
+ <div class="mealz-product-card__lower-action">
85
+ <mealz-price
86
+ class="mealz-product-card__price mealz-ds-text size-l weight-xxl"
87
+ .price="${this.product.price.unit}">
88
+ </mealz-price>
89
+ <div class="mealz-product-card__cta">
90
+ ${this.renderCTA()}
91
+ </div>
92
+ </div>
93
+ ${this.renderFooterActions()}
94
+ `}renderOutOfStockOverlay(){return this.status==="out_of_stock"?i`
95
+ <mealz-out-of-stock-overlay
96
+ @replacedClicked="${()=>this.replaceProduct(!0)}"></mealz-out-of-stock-overlay>
97
+ `:_}renderHeader(){return i`
98
+ <div
99
+ class="mealz-product-card__header
100
+ ${this.status==="active"?"added":""}
101
+ ${g.includes(this.status)?"disabled":""}
102
+ ${this.status==="unavailable"?"unavailable":""}">
103
+ <span
104
+ class="
105
+ mealz-product-card__header-name
106
+ mealz-ds-text weight-xl
107
+ ${v.includes(this.status)?"mealz-product-card__disabled-text":""}"
108
+ >
109
+ ${$(this.product.basketEntry.name)}
110
+ </span>
111
+ <span
112
+ class="
113
+ mealz-product-card__header-quantity
114
+ mealz-ds-text size-s weight-l
115
+ ${v.includes(this.status)?"mealz-product-card__disabled-text":""}"
116
+ >
117
+ <span>${this.modifiedIngQty?this.modifiedIngQty:this.product.ingredient.quantity}</span>
118
+ <span>${this.product.ingredient.attributes.unit}</span>
119
+ </span>
120
+ </div>
121
+ `}renderCalculatedForXRecipes(){var t;return i`
122
+ ${(t=this.product)!=null&&t.basketEntry&&this.isInXRecipes()>1&&this.status==="active"?i`
123
+ <div class="mealz-product-card__footer">
124
+ <div class="mealz-ds-text size-xs weight-xl light-text">
125
+ <span>Calculé pour </span>
126
+ <span>${this.isInXRecipes()}</span>
127
+ <span> repas</span>
128
+ </div>
129
+ </div>
130
+ `:""}
131
+ `}renderFooterActions(){return i`
132
+ <div class="mealz-product-card__footer__actions">
133
+ ${this.status==="initial"?i`
134
+ <button
135
+ class="mealz-ds-button mealz-ds-text weight-l mealz-product-card__ignore-product ghost small"
136
+ @click="${()=>this.ignoreProduct()}">
137
+ <span class="mealz-product-card__disabled-text">Ignorer produit</span>
138
+ </button>
139
+ `:""}
140
+ <button
141
+ @click="${()=>this.replaceProduct(this.status==="initial")}"
142
+ class="mealz-product-card__replace-product mealz-ds-button ghost mealz-ds-text size-s weight-xl"
143
+ >
144
+ <span>Remplacer</span>
145
+ </button>
146
+ </div>
147
+ `}renderCTA(){return B.includes(this.status)?i`
148
+ ${this.loadingAddToBasket?i`
149
+ <button class="mealz-ds-button mealz-product-card__loading-button square primary">
150
+ <div class="mealz-ds-loader"></div>
151
+ </button>
152
+ `:i`
153
+ <!-- TODO: add disabled state -->
154
+ <button class="mealz-ds-button mealz-product-card__add-product square primary"
155
+ @click="${()=>this.addToBasket()}">
156
+ <img alt="basket icon"
157
+ src="https://storage.googleapis.com/assets.miam.tech/generic/icons/Basket.svg"/>
158
+ </button>
159
+ `}
160
+ `:this.status==="active"?i`
161
+ <mealz-counter
162
+ .value="${this.product.basketEntry.quantity}"
163
+ .min="${0}"
164
+ .biColor="${!0}"
165
+ .debounce="${300}"
166
+ .minusLoading="${this.ingredientIsRemoved}"
167
+ @valueChange="${t=>this.updateQuantity(t)}"
168
+ ></mealz-counter>
169
+ `:i``}renderDisabledOrUnavailableProduct(){return i`
170
+ ${g.includes(this.status)?i`
171
+ <span class="mealz-ds-text mealz-product-card__disabled-text">
172
+ Cet ingrédient ne sera pas ajouté à votre panier
173
+ </span>
174
+ <button
175
+ class="mealz-product-card__replace-product-from-disabled mealz-ds-button mealz-ds-text size-s weight-xl primary reverse small"
176
+ @click="${()=>this.replaceProduct(!0)}">
177
+ <span>Ajouter un produit</span>
178
+ </button>
179
+ `:""}
180
+ ${this.status==="unavailable"?i`
181
+ <img class="mealz-ds-avatar" src="${this.ingredientPicture}" alt="ingredient picture">
182
+ <mealz-unavailable-badge></mealz-unavailable-badge>
183
+ <button
184
+ class="mealz-product-card__replace-product-from-unavailable mealz-ds-button mealz-ds-text size-s weight-xl primary reverse small"
185
+ @click="${()=>this.replaceProduct(!0)}">
186
+ <span>Remplacer</span>
187
+ </button>
188
+ `:""}
189
+ `}sendEntryAddEvent(){c.analytics.sendEvent("entry.add",this.analyticsPath,this.props)}sendEntryReplaceEvent(){c.analytics.sendEvent("entry.replace",this.analyticsPath,this.props)}sendEntryIgnoreEvent(){c.analytics.sendEvent("entry.ignore",this.analyticsPath,this.props)}sendEntryDeleteEvent(){c.analytics.sendEvent("entry.delete",this.analyticsPath,this.props)}}b([l({type:Object})],p.prototype,"product");b([l({type:String})],p.prototype,"recipeId");b([l({type:Number})],p.prototype,"initialGuests");b([l({type:Number})],p.prototype,"currentGuests");customElements.get("mealz-product-card")||customElements.define("mealz-product-card",p);
@@ -0,0 +1,12 @@
1
+ import{N as m,k as a}from"./no-shadow-element-D62BBu0I.js";import{n as p}from"./property-CoRN-Ln2.js";import{P as d}from"./price-D6RVRYHJ.js";var c=Object.defineProperty,l=(o,e,r,u)=>{for(var t=void 0,i=o.length-1,s;i>=0;i--)(s=o[i])&&(t=s(e,r,t)||t);return t&&c(e,r,t),t};class n extends m{constructor(){super(),this.priceService=d.getInstance(),this.styleURL=new URL("./promotion-badge/promotion-badge.css",this.getBaseURL())}getPriceAmountSuffix(){var e;return(e=this.priceData.discountType)!=null&&e.endsWith("_perc")?"%":this.priceService.currencySymbol()}render(){var e;return a`
2
+ <div class="mealz-promotion-badge">
3
+ ${((e=this.priceData)==null?void 0:e.discountAmount)>0?a`
4
+ <div class="mealz-ds-badge mealz-promotion-badge__promotion">
5
+ <span class="mealz-promotion-badge__promotion-value mealz-ds-text size-s weight-l">
6
+ ${this.priceData.discountAmount}${this.getPriceAmountSuffix()}
7
+ </span>
8
+ <span class="mealz-promotion-badge__promotion-text mealz-ds-text size-s weight-l">de remise immédiate</span>
9
+ </div>
10
+ `:""}
11
+ </div>
12
+ `}}l([p()],n.prototype,"priceData");customElements.get("mealz-promotion-badge")||customElements.define("mealz-promotion-badge",n);
@@ -1,10 +1,10 @@
1
- import{i as d,O as f,N as h,k as o}from"../assets/no-shadow-element-D62BBu0I.js";import{t as m}from"../assets/custom-element-BhZVzxrc.js";import{m as i,w as b}from"../assets/mealz-sdk-E_fNZM-c.js";import{s as S}from"../assets/skip-Bup0JB81.js";import{t as T}from"../assets/take-CpvJwza7.js";import"../assets/filter-q99GWcpD.js";import"../assets/OperatorSubscriber-DfCnFunn.js";import"../assets/empty-qrpgDBbc.js";function u(s){return!!s&&(s instanceof f||d(s.lift)&&d(s.subscribe))}var k=Object.getOwnPropertyDescriptor,z=(s,e,t,a)=>{for(var r=a>1?void 0:a?k(e,t):e,n=s.length-1,l;n>=0;n--)(l=s[n])&&(r=l(r)||r);return r};let p=class extends h{constructor(){super(),this.supplierName=null,this.displayFirstStep=!1,this.displaySecondStep=!1,this.subscriptions=[],this.close=()=>{this.displayFirstStep=!1,this.displaySecondStep=!1,this.requestUpdate()},this.openFirstStep=()=>{this.displayFirstStep=!0,this.displaySecondStep=!1,this.requestUpdate()},this.goToSecondStep=()=>{var s,e;this.subscriptions.push((e=(s=i)==null?void 0:s.basket)==null?void 0:e.refreshCurrentBasket().pipe(S(1),T(1)).subscribe(t=>{var r;((r=t==null?void 0:t.attributes)==null?void 0:r.status)==="transferring"&&(this.displayFirstStep=!1,this.displaySecondStep=!0,this.requestUpdate())}))},this.cancelTransfer=()=>{var e;const s=(e=i)==null?void 0:e.basketTransfer.abortTransfer();if(u(s)){this.subscriptions.push(s.subscribe(()=>this.close()));return}this.close()},this.continueTransfer=()=>{var s,e,t,a;this.displayFirstStep=!0,this.displaySecondStep=!1,this.requestUpdate(),typeof((e=(s=i)==null?void 0:s.basket)==null?void 0:e.transfer)=="function"&&i.basketTransfer.transfer(),typeof((a=(t=i)==null?void 0:t.basketTransfer)==null?void 0:a.navigateToTransferUrl)=="function"&&i.basketTransfer.navigateToTransferUrl()},this.styleURL=new URL("./basket-transfer-modal/basket-transfer-modal.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),b().then(()=>{this.listenToPos(),this.listenToTransferState()}).catch(s=>console.error("[basket-transfer-modal] Mealz SDK unavailable",s))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(s=>s.unsubscribe())}render(){return!this.displayFirstStep&&!this.displaySecondStep?o``:o`
1
+ import{O as h,i as d,N as f,k as l}from"../assets/no-shadow-element-D62BBu0I.js";import{m as a,w as m}from"../assets/mealz-sdk-E_fNZM-c.js";import{s as b}from"../assets/skip-Bup0JB81.js";import{t as S}from"../assets/take-CpvJwza7.js";import"../assets/filter-q99GWcpD.js";import"../assets/OperatorSubscriber-DfCnFunn.js";import"../assets/empty-qrpgDBbc.js";function u(i){return!!i&&(i instanceof h||d(i.lift)&&d(i.subscribe))}class T extends f{constructor(){super(),this.supplierName=null,this.displayFirstStep=!1,this.displaySecondStep=!1,this.subscriptions=[],this.close=()=>{this.displayFirstStep=!1,this.displaySecondStep=!1,this.requestUpdate()},this.openFirstStep=()=>{this.displayFirstStep=!0,this.displaySecondStep=!1,this.requestUpdate()},this.goToSecondStep=()=>{var s,e;this.subscriptions.push((e=(s=a)==null?void 0:s.basket)==null?void 0:e.refreshCurrentBasket().pipe(b(1),S(1)).subscribe(t=>{var n;((n=t==null?void 0:t.attributes)==null?void 0:n.status)==="transferring"&&(this.displayFirstStep=!1,this.displaySecondStep=!0,this.requestUpdate())}))},this.cancelTransfer=()=>{var e;const s=(e=a)==null?void 0:e.basketTransfer.abortTransfer();if(u(s)){this.subscriptions.push(s.subscribe(()=>this.close()));return}this.close()},this.continueTransfer=()=>{var s,e,t,r;this.displayFirstStep=!0,this.displaySecondStep=!1,this.requestUpdate(),typeof((e=(s=a)==null?void 0:s.basket)==null?void 0:e.transfer)=="function"&&a.basketTransfer.transfer(),typeof((r=(t=a)==null?void 0:t.basketTransfer)==null?void 0:r.navigateToTransferUrl)=="function"&&a.basketTransfer.navigateToTransferUrl()},this.styleURL=new URL("./basket-transfer-modal/basket-transfer-modal.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),m().then(()=>{this.listenToPos(),this.listenToTransferState()}).catch(s=>console.error("[basket-transfer-modal] Mealz SDK unavailable",s))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(s=>s.unsubscribe())}render(){return!this.displayFirstStep&&!this.displaySecondStep?l``:l`
2
2
  <mealz-modal
3
- .titleSlot=${o`<span class="mealz-ds-text weight-xxl">Transfert du panier</span>`}
3
+ .titleSlot=${l`<span class="mealz-ds-text weight-xxl">Transfert du panier</span>`}
4
4
  .contentSlot=${this.displaySecondStep?this.renderTransferModalConfirm():this.renderTransferModalInitial()}
5
5
  @modalClosed=${this.close}
6
6
  ></mealz-modal>
7
- `}renderTransferModalInitial(){return o`
7
+ `}renderTransferModalInitial(){return l`
8
8
  <div class="mealz-basket-transfer-modal__text">
9
9
  <p class="mealz-ds-text size-s">
10
10
  Nous transférons votre panier${this.supplierName?` vers ${this.supplierName}`:""}.
@@ -17,7 +17,7 @@ import{i as d,O as f,N as h,k as o}from"../assets/no-shadow-element-D62BBu0I.js"
17
17
  </span>
18
18
  </button>
19
19
  </div>
20
- `}renderTransferModalConfirm(){return o`
20
+ `}renderTransferModalConfirm(){return l`
21
21
  <div class="mealz-basket-transfer-modal__text">
22
22
  <p class="mealz-ds-text size-s">
23
23
  Votre panier est toujours en cours de transfert${this.supplierName?` vers ${this.supplierName}`:""}.
@@ -37,4 +37,4 @@ import{i as d,O as f,N as h,k as o}from"../assets/no-shadow-element-D62BBu0I.js"
37
37
  <span class="mealz-ds-text weight-l">Continuer</span>
38
38
  </button>
39
39
  </div>
40
- `}listenToPos(){var e,t;const s=(t=(e=i.pos)==null?void 0:e.currentPos)==null?void 0:t.call(e);u(s)&&this.subscriptions.push(s.subscribe(a=>{var r,n,l,c;this.supplierName=((c=(l=(n=(r=a==null?void 0:a.relationships)==null?void 0:r.supplier)==null?void 0:n.data)==null?void 0:l.attributes)==null?void 0:c.name)??null,this.requestUpdate()}))}listenToTransferState(){this.subscriptions.push(i.basketTransfer.basketIsBeingTransferred.subscribe(s=>{if(!this.displayFirstStep&&!this.displaySecondStep&&s){this.displayFirstStep=!0,this.requestUpdate();return}s||this.close()}))}};p=z([m("mealz-basket-transfer-modal")],p);customElements.get("mealz-basket-transfer-modal")||customElements.define("mealz-basket-preview",p);
40
+ `}listenToPos(){var e,t;const s=(t=(e=a.pos)==null?void 0:e.currentPos)==null?void 0:t.call(e);u(s)&&this.subscriptions.push(s.subscribe(r=>{var n,o,p,c;this.supplierName=((c=(p=(o=(n=r==null?void 0:r.relationships)==null?void 0:n.supplier)==null?void 0:o.data)==null?void 0:p.attributes)==null?void 0:c.name)??null,this.requestUpdate()}))}listenToTransferState(){this.subscriptions.push(a.basketTransfer.basketIsBeingTransferred.subscribe(s=>{if(!this.displayFirstStep&&!this.displaySecondStep&&s){this.displayFirstStep=!0,this.requestUpdate();return}s||this.close()}))}}customElements.get("mealz-basket-transfer-modal")||customElements.define("mealz-basket-preview",T);
@@ -1,4 +1,4 @@
1
- import"../../store-indicator/store-indicator.min.js";import"../../slider-tabs/slider-tabs.min.js";import"../../store-locator/store-locator.min.js";import{N as R,k as l,D as _,s as M,R as O}from"../../assets/no-shadow-element-D62BBu0I.js";import{t as x}from"../../assets/custom-element-BhZVzxrc.js";import{n as f}from"../../assets/property-CoRN-Ln2.js";import{m as c,a as B}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../counter/counter.min.js";import"../../price/price.min.js";import"../../modal/modal.min.js";import{P as N}from"../../assets/price-D6RVRYHJ.js";import{c as D}from"../../assets/capitalize-DUAqYmp4.js";import{e as q,i as L,t as V}from"../../assets/unsafe-html-DWUMaK1p.js";import{d as F}from"../../assets/debounceTime-Cf_7YmIn.js";import{d as j}from"../../assets/delay-DHNms76g.js";import{s as H}from"../../assets/switchMap-BAdE9Uzw.js";import"../../assets/state-DDIoBQp5.js";import"../../assets/query-BApjzB0v.js";import"../../onboarding/events.min.js";import"../../assets/singleton-COF3iBbF.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";import"../../assets/take-CpvJwza7.js";import"../../assets/empty-qrpgDBbc.js";import"../../assets/map-DT-7dkaR.js";import"../../assets/mergeMap-D2yctTHQ.js";import"../../assets/innerFrom-DePszgj9.js";import"../../assets/executeSchedule-CEDvgTzM.js";import"../../assets/timer-3Kpx74mt.js";import"../../assets/isScheduler-CqHuyMwD.js";import"../../assets/isDate-BwHtzZM4.js";var G=Object.defineProperty,K=Object.getOwnPropertyDescriptor,U=(e,s,i,a)=>{for(var t=a>1?void 0:a?K(s,i):s,n=e.length-1,r;n>=0;n--)(r=e[n])&&(t=(a?r(s,i,t):r(t))||t);return a&&t&&G(s,i,t),t};let g=class extends R{constructor(){super(),this.analyticsPath="",this.styleURL=new URL("./product-addition/product-addition.css",this.getBaseURL())}render(){return l`
1
+ import"../../store-indicator/store-indicator.min.js";import"../../slider-tabs/slider-tabs.min.js";import"../../store-locator/store-locator.min.js";import{N as $,k as l,D as _,s as B,R as N}from"../../assets/no-shadow-element-D62BBu0I.js";import{n as y}from"../../assets/property-CoRN-Ln2.js";import{m as c,a as S}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../counter/counter.min.js";import"../../price/price.min.js";import"../../modal/modal.min.js";import{P as T}from"../../assets/price-D6RVRYHJ.js";import{c as U}from"../../assets/capitalize-DUAqYmp4.js";import{e as M,i as D,t as q}from"../../assets/unsafe-html-DWUMaK1p.js";import{d as O}from"../../assets/debounceTime-Cf_7YmIn.js";import{d as L}from"../../assets/delay-DHNms76g.js";import{s as V}from"../../assets/switchMap-BAdE9Uzw.js";import"../../assets/state-DDIoBQp5.js";import"../../assets/query-BApjzB0v.js";import"../../onboarding/events.min.js";import"../../assets/singleton-COF3iBbF.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";import"../../assets/take-CpvJwza7.js";import"../../assets/empty-qrpgDBbc.js";import"../../assets/map-DT-7dkaR.js";import"../../assets/mergeMap-D2yctTHQ.js";import"../../assets/innerFrom-DePszgj9.js";import"../../assets/executeSchedule-CEDvgTzM.js";import"../../assets/timer-3Kpx74mt.js";import"../../assets/isScheduler-CqHuyMwD.js";import"../../assets/isDate-BwHtzZM4.js";var F=Object.defineProperty,H=(s,e,i,r)=>{for(var t=void 0,a=s.length-1,n;a>=0;a--)(n=s[a])&&(t=n(e,i,t)||t);return t&&F(e,i,t),t};class A extends ${constructor(){super(),this.analyticsPath="",this.styleURL=new URL("./product-addition/product-addition.css",this.getBaseURL())}render(){return l`
2
2
  <div class="mealz-product-addition">
3
3
  <span class="mealz-product-addition__title mealz-ds-text weight-l">Besoin de compléter votre panier ?</span>
4
4
  <button @click=${()=>this.openProductAdditionModal()}
@@ -6,7 +6,7 @@ import"../../store-indicator/store-indicator.min.js";import"../../slider-tabs/sl
6
6
  Ajouter un produit
7
7
  </button>
8
8
  </div>
9
- `}openProductAdditionModal(){this.sendbasketEntryAddEvent(),c.productAddition.open()}sendbasketEntryAddEvent(){c.analytics.sendEvent("basket.entry.add",this.analyticsPath,{})}};U([f({type:String})],g.prototype,"analyticsPath",2);g=U([x("mealz-product-addition")],g);customElements.get("mealz-product-addition")||customElements.define("mealz-product-addition",g);var Q=Object.defineProperty,W=Object.getOwnPropertyDescriptor,E=(e,s,i,a)=>{for(var t=a>1?void 0:a?W(s,i):s,n=e.length-1,r;n>=0;n--)(r=e[n])&&(t=(a?r(s,i,t):r(t))||t);return a&&t&&Q(s,i,t),t};let w=class extends R{constructor(){super(),this.analyticsPath="",this.loading=!1,this.isRecipeModalDisplayed=!1,this.subscriptions=[],this.priceService=N.getInstance(),this.styleURL=new URL("./catalog/basket-preview/basket-preview-product/basket-preview-product.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(c.products.entryIsBeingUpdated(this.basketEntry.id).subscribe(e=>this.loading=e))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}renderSponsorisedBadge(){return l`
9
+ `}openProductAdditionModal(){this.sendbasketEntryAddEvent(),c.productAddition.open()}sendbasketEntryAddEvent(){c.analytics.sendEvent("basket.entry.add",this.analyticsPath,{})}}H([y({type:String})],A.prototype,"analyticsPath");customElements.get("mealz-product-addition")||customElements.define("mealz-product-addition",A);var G=Object.defineProperty,P=(s,e,i,r)=>{for(var t=void 0,a=s.length-1,n;a>=0;a--)(n=s[a])&&(t=n(e,i,t)||t);return t&&G(e,i,t),t};class g extends ${constructor(){super(),this.analyticsPath="",this.loading=!1,this.isRecipeModalDisplayed=!1,this.subscriptions=[],this.priceService=T.getInstance(),this.styleURL=new URL("./catalog/basket-preview/basket-preview-product/basket-preview-product.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(c.products.entryIsBeingUpdated(this.basketEntry.id).subscribe(e=>this.loading=e))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}renderSponsorisedBadge(){return l`
10
10
  <div class="mealz-basket-preview-product__sponsorised mealz-ds-badge mealz-ds-text size-s weight-l">
11
11
  <span>Sponsorisé</span>
12
12
  </div>
@@ -44,7 +44,7 @@ import"../../store-indicator/store-indicator.min.js";import"../../slider-tabs/sl
44
44
  </div>
45
45
  <!-- TITLE -->
46
46
  <div class="mealz-basket-preview-product__title mealz-ds-text size-xs">
47
- <span>${D(this.basketEntry.selectedItem.attributes.name)}</span>
47
+ <span>${U(this.basketEntry.selectedItem.attributes.name)}</span>
48
48
  </div>
49
49
  <div class="mealz-basket-preview-product__badges">
50
50
  <!-- SPONSORISED BADGE -->
@@ -99,21 +99,21 @@ import"../../store-indicator/store-indicator.min.js";import"../../slider-tabs/sl
99
99
  </div>
100
100
  `}displayRecipesModal(){const e=document.createElement("mealz-modal");e.titleSlot=l`Recette${this.recipeNames.length>1?"s":_} avec ce produit`,e.contentSlot=l`
101
101
  <div class="mealz-modal__recipe-name-badge-list">
102
- ${this.recipeNames.map(s=>l`
102
+ ${this.recipeNames.map(i=>l`
103
103
  <div class="mealz-modal__recipe-name-badge mealz-ds-badge mealz-ds-text size-s">
104
- ${s}
104
+ ${i}
105
105
  </div>
106
106
  `)}
107
107
  </div>
108
- `,document.body.appendChild(e),e.addEventListener("modalClosed",()=>this.displayRecipesFromProduct())}removeProduct(){this.sendDeleteEvent(),c.products.removeProduct(this.basketEntry,this.analyticsPath),this.loading=!0,this.requestUpdate()}replaceProduct(){this.sendReplaceEvent(),c.productReplacement.open(this.basketEntry)}counterChanged(e){e.detail.value!==this.basketEntry.attributes.quantity&&(c.products.changeQuantity(this.basketEntry,e.detail.value,""),this.loading=!0,this.requestUpdate())}addDefaultProductImage(e){e.target.src=B.defaultIngredientPicture,e.target.onerror=null}displayRecipesFromProduct(){this.isRecipeModalDisplayed=!this.isRecipeModalDisplayed,this.requestUpdate()}sendReplaceEvent(){c.analytics.sendEvent("entry.replace",this.analyticsPath,{entry_name:this.basketEntry.attributes.name,product_quantity:this.basketEntry.attributes.quantity,item_id:this.basketEntry.selectedItem.id,ext_item_id:this.basketEntry.selectedItem.attributes["ext-id"],item_ean:this.basketEntry.selectedItem.attributes.ean,recipe_id:this.basketEntry.recipesIds[0],status:this.basketEntry.attributes.status})}sendDeleteEvent(){c.analytics.sendEvent("entry.delete",this.analyticsPath,{entry_name:this.basketEntry.attributes.name,product_quantity:this.basketEntry.attributes.quantity,item_id:this.basketEntry.selectedItem.id,ext_item_id:this.basketEntry.selectedItem.attributes["ext-id"],item_ean:this.basketEntry.selectedItem.attributes.ean,recipe_id:this.basketEntry.recipesIds[0]})}};E([f({type:Object})],w.prototype,"basketEntry",2);E([f({type:Array})],w.prototype,"recipeNames",2);E([f({type:String})],w.prototype,"analyticsPath",2);w=E([x("mealz-basket-preview-product")],w);customElements.get("mealz-basket-preview-product")||customElements.define("mealz-basket-preview-product",w);/**
108
+ `,document.body.appendChild(e),e.addEventListener("modalClosed",()=>this.displayRecipesFromProduct())}removeProduct(){this.sendDeleteEvent(),c.products.removeProduct(this.basketEntry,this.analyticsPath),this.loading=!0,this.requestUpdate()}replaceProduct(){this.sendReplaceEvent(),c.productReplacement.open(this.basketEntry)}counterChanged(e){e.detail.value!==this.basketEntry.attributes.quantity&&(c.products.changeQuantity(this.basketEntry,e.detail.value,""),this.loading=!0,this.requestUpdate())}addDefaultProductImage(e){e.target.src=S.defaultIngredientPicture,e.target.onerror=null}displayRecipesFromProduct(){this.isRecipeModalDisplayed=!this.isRecipeModalDisplayed,this.requestUpdate()}sendReplaceEvent(){c.analytics.sendEvent("entry.replace",this.analyticsPath,{entry_name:this.basketEntry.attributes.name,product_quantity:this.basketEntry.attributes.quantity,item_id:this.basketEntry.selectedItem.id,ext_item_id:this.basketEntry.selectedItem.attributes["ext-id"],item_ean:this.basketEntry.selectedItem.attributes.ean,recipe_id:this.basketEntry.recipesIds[0],status:this.basketEntry.attributes.status})}sendDeleteEvent(){c.analytics.sendEvent("entry.delete",this.analyticsPath,{entry_name:this.basketEntry.attributes.name,product_quantity:this.basketEntry.attributes.quantity,item_id:this.basketEntry.selectedItem.id,ext_item_id:this.basketEntry.selectedItem.attributes["ext-id"],item_ean:this.basketEntry.selectedItem.attributes.ean,recipe_id:this.basketEntry.recipesIds[0]})}}P([y({type:Object})],g.prototype,"basketEntry");P([y({type:Array})],g.prototype,"recipeNames");P([y({type:String})],g.prototype,"analyticsPath");customElements.get("mealz-basket-preview-product")||customElements.define("mealz-basket-preview-product",g);/**
109
109
  * @license
110
110
  * Copyright 2020 Google LLC
111
111
  * SPDX-License-Identifier: BSD-3-Clause
112
- */const{I:J}=M,T=()=>document.createComment(""),y=(e,s,i)=>{var n;const a=e._$AA.parentNode,t=s===void 0?e._$AB:s._$AA;if(i===void 0){const r=a.insertBefore(T(),t),o=a.insertBefore(T(),t);i=new J(r,o,e,e.options)}else{const r=i._$AB.nextSibling,o=i._$AM,p=o!==e;if(p){let m;(n=i._$AQ)==null||n.call(i,e),i._$AM=e,i._$AP!==void 0&&(m=e._$AU)!==o._$AU&&i._$AP(m)}if(r!==t||p){let m=i._$AA;for(;m!==r;){const v=m.nextSibling;a.insertBefore(m,t),m=v}}}return i},z=(e,s,i=e)=>(e._$AI(s,i),e),Y={},Z=(e,s=Y)=>e._$AH=s,X=e=>e._$AH,P=e=>{var a;(a=e._$AP)==null||a.call(e,!1,!0);let s=e._$AA;const i=e._$AB.nextSibling;for(;s!==i;){const t=s.nextSibling;s.remove(),s=t}};/**
112
+ */const{I:j}=B,x=()=>document.createComment(""),w=(s,e,i)=>{var a;const r=s._$AA.parentNode,t=e===void 0?s._$AB:e._$AA;if(i===void 0){const n=r.insertBefore(x(),t),p=r.insertBefore(x(),t);i=new j(n,p,s,s.options)}else{const n=i._$AB.nextSibling,p=i._$AM,u=p!==s;if(u){let h;(a=i._$AQ)==null||a.call(i,s),i._$AM=s,i._$AP!==void 0&&(h=s._$AU)!==p._$AU&&i._$AP(h)}if(n!==t||u){let h=i._$AA;for(;h!==n;){const v=h.nextSibling;r.insertBefore(h,t),h=v}}}return i},z=(s,e,i=s)=>(s._$AI(e,i),s),K={},Q=(s,e=K)=>s._$AH=e,W=s=>s._$AH,E=s=>{var r;(r=s._$AP)==null||r.call(s,!1,!0);let e=s._$AA;const i=s._$AB.nextSibling;for(;e!==i;){const t=e.nextSibling;e.remove(),e=t}};/**
113
113
  * @license
114
114
  * Copyright 2017 Google LLC
115
115
  * SPDX-License-Identifier: BSD-3-Clause
116
- */const A=(e,s,i)=>{const a=new Map;for(let t=s;t<=i;t++)a.set(e[t],t);return a},ee=q(class extends L{constructor(e){if(super(e),e.type!==V.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,i){let a;i===void 0?i=s:s!==void 0&&(a=s);const t=[],n=[];let r=0;for(const o of e)t[r]=a?a(o,r):r,n[r]=i(o,r),r++;return{values:n,keys:t}}render(e,s,i){return this.dt(e,s,i).values}update(e,[s,i,a]){const t=X(e),{values:n,keys:r}=this.dt(s,i,a);if(!Array.isArray(t))return this.ut=r,n;const o=this.ut??(this.ut=[]),p=[];let m,v,d=0,h=t.length-1,u=0,b=n.length-1;for(;d<=h&&u<=b;)if(t[d]===null)d++;else if(t[h]===null)h--;else if(o[d]===r[u])p[u]=z(t[d],n[u]),d++,u++;else if(o[h]===r[b])p[b]=z(t[h],n[b]),h--,b--;else if(o[d]===r[b])p[b]=z(t[d],n[b]),y(e,p[b+1],t[d]),d++,b--;else if(o[h]===r[u])p[u]=z(t[h],n[u]),y(e,t[d],t[h]),h--,u++;else if(m===void 0&&(m=A(r,u,b),v=A(o,d,h)),m.has(o[d]))if(m.has(o[h])){const k=v.get(r[u]),$=k!==void 0?t[k]:null;if($===null){const S=y(e,t[d]);z(S,n[u]),p[u]=S}else p[u]=z($,n[u]),y(e,t[d],$),t[k]=null;u++}else P(t[h]),h--;else P(t[d]),d++;for(;u<=b;){const k=y(e,p[b+1]);z(k,n[u]),p[u++]=k}for(;d<=h;){const k=t[d++];k!==null&&P(k)}return this.ut=r,Z(e,p),O}}),C={isRecipeDetailsVisible:{paramName:"displayRecipe",getValue:()=>{var s;const e=c.recipes.displayedRecipe$.value;return((s=e==null?void 0:e.recipe)==null?void 0:s.id)||null},openDrawer:e=>{c.recipes.openDetails(e)}},isBasketPreviewVisible:{paramName:"myMeals",getValue:()=>{const{activeTabIndex:e}=c.basket.basketPreviewState$.getValue();return e===1?"products":"recipes"},openDrawer:e=>{c.basket.basketPreviewState$.next({isOpen:!0,activeTabIndex:e==="products"?1:0})}}};function te(){return Object.values(C).map(e=>e.paramName)}function Ue(){const e=new URL(window.location.href);for(const s of Object.values(C)){const i=e.searchParams.get(s.paramName);if(i&&s.openDrawer){s.openDrawer(i);return}}}function Me(e){e.subscribe(s=>{const i=new URL(window.location.href);te().forEach(t=>{i.searchParams.delete(t)});const a=C[s];if(a){const t=a.getValue();t&&i.searchParams.set(a.paramName,t)}window.history.replaceState({},"",i.toString())})}function se(e){const s=new URL(window.location.href);s.searchParams.delete("myMeals"),e===0?s.searchParams.append("myMeals","recipes"):e===1&&s.searchParams.append("myMeals","products"),window.history.replaceState({},"",s.toString())}var ie=Object.getOwnPropertyDescriptor,ae=(e,s,i,a)=>{for(var t=a>1?void 0:a?ie(s,i):s,n=e.length-1,r;n>=0;n--)(r=e[n])&&(t=r(t)||t);return t};let I=class extends R{constructor(){super(),this.priceService=N.getInstance(),this.subscriptions=[],this.recipePrices=[],this.recipePreviews=[],this.products=[],this.tabs=["Recettes","Produits"],this.selectedTabIndex=0,this.analyticsPath="/basket/recipes",this.drawerStoreIndicator=null,this.styleURL=new URL("./catalog/basket-preview/basket-preview.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.pageview(),this.listenToActiveTab(),this.listenToCloseEvent(),this.priceService.initFormatter(),this.noSupplier=c.supplier.isNoSupplier(),this.noSupplier&&this.appendStoreIndicatorToDrawerHeader(),this.subscriptions.push(B.basket.recipeCount().subscribe(e=>{this.recipesCount=e,this.requestUpdate()}),c.basket.entries$().pipe(F(200)).subscribe(e=>{this.products=e.filter(s=>s.attributes.status==="active"),this.updateRecipeView()}),c.productAddition.productAdded$.pipe(j(200)).subscribe(e=>{this.selectedTabIndex=1,setTimeout(()=>this.scrollToAddedProduct(e),0),this.requestUpdate()}),c.basket.recipePricesInBasket$().subscribe(e=>{this.recipePrices=e,this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}updated(){this.drawerStoreIndicator&&this.drawerStoreIndicator.setAttribute("analyticsPath",this.analyticsPath)}render(){return l`
116
+ */const C=(s,e,i)=>{const r=new Map;for(let t=e;t<=i;t++)r.set(s[t],t);return r},J=M(class extends D{constructor(s){if(super(s),s.type!==q.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,i){let r;i===void 0?i=e:e!==void 0&&(r=e);const t=[],a=[];let n=0;for(const p of s)t[n]=r?r(p,n):n,a[n]=i(p,n),n++;return{values:a,keys:t}}render(s,e,i){return this.dt(s,e,i).values}update(s,[e,i,r]){const t=W(s),{values:a,keys:n}=this.dt(e,i,r);if(!Array.isArray(t))return this.ut=n,a;const p=this.ut??(this.ut=[]),u=[];let h,v,d=0,o=t.length-1,m=0,b=a.length-1;for(;d<=o&&m<=b;)if(t[d]===null)d++;else if(t[o]===null)o--;else if(p[d]===n[m])u[m]=z(t[d],a[m]),d++,m++;else if(p[o]===n[b])u[b]=z(t[o],a[b]),o--,b--;else if(p[d]===n[b])u[b]=z(t[d],a[b]),w(s,u[b+1],t[d]),d++,b--;else if(p[o]===n[m])u[m]=z(t[o],a[m]),w(s,t[d],t[o]),o--,m++;else if(h===void 0&&(h=C(n,m,b),v=C(p,d,o)),h.has(p[d]))if(h.has(p[o])){const k=v.get(n[m]),f=k!==void 0?t[k]:null;if(f===null){const R=w(s,t[d]);z(R,a[m]),u[m]=R}else u[m]=z(f,a[m]),w(s,t[d],f),t[k]=null;m++}else E(t[o]),o--;else E(t[d]),d++;for(;m<=b;){const k=w(s,u[b+1]);z(k,a[m]),u[m++]=k}for(;d<=o;){const k=t[d++];k!==null&&E(k)}return this.ut=n,Q(s,u),N}}),I={isRecipeDetailsVisible:{paramName:"displayRecipe",getValue:()=>{var e;const s=c.recipes.displayedRecipe$.value;return((e=s==null?void 0:s.recipe)==null?void 0:e.id)||null},openDrawer:s=>{c.recipes.openDetails(s)}},isBasketPreviewVisible:{paramName:"myMeals",getValue:()=>{const{activeTabIndex:s}=c.basket.basketPreviewState$.getValue();return s===1?"products":"recipes"},openDrawer:s=>{c.basket.basketPreviewState$.next({isOpen:!0,activeTabIndex:s==="products"?1:0})}}};function Y(){return Object.values(I).map(s=>s.paramName)}function Ce(){const s=new URL(window.location.href);for(const e of Object.values(I)){const i=s.searchParams.get(e.paramName);if(i&&e.openDrawer){e.openDrawer(i);return}}}function Se(s){s.subscribe(e=>{const i=new URL(window.location.href);Y().forEach(t=>{i.searchParams.delete(t)});const r=I[e];if(r){const t=r.getValue();t&&i.searchParams.set(r.paramName,t)}window.history.replaceState({},"",i.toString())})}function Z(s){const e=new URL(window.location.href);e.searchParams.delete("myMeals"),s===0?e.searchParams.append("myMeals","recipes"):s===1&&e.searchParams.append("myMeals","products"),window.history.replaceState({},"",e.toString())}class X extends ${constructor(){super(),this.priceService=T.getInstance(),this.subscriptions=[],this.recipePrices=[],this.recipePreviews=[],this.products=[],this.tabs=["Recettes","Produits"],this.selectedTabIndex=0,this.analyticsPath="/basket/recipes",this.drawerStoreIndicator=null,this.styleURL=new URL("./catalog/basket-preview/basket-preview.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.pageview(),this.listenToActiveTab(),this.listenToCloseEvent(),this.priceService.initFormatter(),this.noSupplier=c.supplier.isNoSupplier(),this.noSupplier&&this.appendStoreIndicatorToDrawerHeader(),this.subscriptions.push(S.basket.recipeCount().subscribe(e=>{this.recipesCount=e,this.requestUpdate()}),c.basket.entries$().pipe(O(200)).subscribe(e=>{this.products=e.filter(i=>i.attributes.status==="active"),this.updateRecipeView()}),c.productAddition.productAdded$.pipe(L(200)).subscribe(e=>{this.selectedTabIndex=1,setTimeout(()=>this.scrollToAddedProduct(e),0),this.requestUpdate()}),c.basket.recipePricesInBasket$().subscribe(e=>{this.recipePrices=e,this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}updated(){this.drawerStoreIndicator&&this.drawerStoreIndicator.setAttribute("analyticsPath",this.analyticsPath)}render(){return l`
117
117
  <div class="mealz-basket-preview">
118
118
  ${this.noSupplier?l`
119
119
  <mealz-store-indicator .analyticsPath=${this.analyticsPath}></mealz-store-indicator>`:_}
@@ -139,15 +139,15 @@ import"../../store-indicator/store-indicator.min.js";import"../../slider-tabs/sl
139
139
  </div>
140
140
  `:l`
141
141
  <div class="mealz-basket-preview__products">
142
- ${ee(this.products,e=>e.id,(e,s)=>this.renderProductCard(e,s===this.products.length-1))}
142
+ ${J(this.products,e=>e.id,(e,i)=>this.renderProductCard(e,i===this.products.length-1))}
143
143
  </div>
144
- `}renderProductCard(e,s=!1){if(e.selectedItem){const i=this.recipePreviews.reduce((a,t)=>(e.recipesIds.includes(+t.id)&&a.push(t.title),a),[]);return l`
144
+ `}renderProductCard(e,i=!1){if(e.selectedItem){const r=this.recipePreviews.reduce((t,a)=>(e.recipesIds.includes(+a.id)&&t.push(a.title),t),[]);return l`
145
145
  <mealz-basket-preview-product
146
146
  .basketEntry=${e}
147
- .recipeNames=${i}
147
+ .recipeNames=${r}
148
148
  .analyticsPath=${this.analyticsPath}
149
149
  ></mealz-basket-preview-product>
150
- ${s?_:l`
150
+ ${i?_:l`
151
151
  <hr class="mealz-basket-preview__products-separator"/>`}
152
152
  `}}renderMealPreview(e){return l`
153
153
  <!-- RECIPE CARD CONTAINER -->
@@ -198,7 +198,7 @@ import"../../store-indicator/store-indicator.min.js";import"../../slider-tabs/sl
198
198
  </div>
199
199
  </div>
200
200
  </div>
201
- `}calculateTotalPrice(){var i;const e=((i=this.recipePrices)==null?void 0:i.reduce((a,t)=>a+ +t.price,0))||0,s=(this.products||[]).filter(a=>{var o,p,m,v,d;const t=!((m=(p=(o=a.relationships)==null?void 0:o.recipes)==null?void 0:p.data)!=null&&m.length),n=!((v=a==null?void 0:a.recipesIds)!=null&&v.length),r=!((d=a==null?void 0:a["recipe-ids"])!=null&&d.length);return t&&n&&r}).reduce((a,t)=>{var p,m,v,d;const n=((p=t.attributes)==null?void 0:p.quantity)??1,r=((m=t.attributes)==null?void 0:m.price)??((v=t.attributes)==null?void 0:v.discountedPrice)??((d=t.attributes)==null?void 0:d["unit-price"]),o=Number(r);return a+(Number.isFinite(o)?o*n:0)},0);return e+s}renderPlaceOrderFooter(){return l`
201
+ `}calculateTotalPrice(){var r;const e=((r=this.recipePrices)==null?void 0:r.reduce((t,a)=>t+ +a.price,0))||0,i=(this.products||[]).filter(t=>{var u,h,v,d,o;const a=!((v=(h=(u=t.relationships)==null?void 0:u.recipes)==null?void 0:h.data)!=null&&v.length),n=!((d=t==null?void 0:t.recipesIds)!=null&&d.length),p=!((o=t==null?void 0:t["recipe-ids"])!=null&&o.length);return a&&n&&p}).reduce((t,a)=>{var h,v,d,o;const n=((h=a.attributes)==null?void 0:h.quantity)??1,p=((v=a.attributes)==null?void 0:v.price)??((d=a.attributes)==null?void 0:d.discountedPrice)??((o=a.attributes)==null?void 0:o["unit-price"]),u=Number(p);return t+(Number.isFinite(u)?u*n:0)},0);return e+i}renderPlaceOrderFooter(){return l`
202
202
  <div class="mealz-basket-preview__footer mealz-basket-preview__place-order-footer">
203
203
  <div class="mealz-basket-preview__basket-price">
204
204
  <span class="mealz-basket-preview__basket-price-label mealz-ds-text weight-xl size-l">
@@ -230,4 +230,4 @@ import"../../store-indicator/store-indicator.min.js";import"../../slider-tabs/sl
230
230
  panier
231
231
  </h2>
232
232
  </div>
233
- `}appendStoreIndicatorToDrawerHeader(){const e=document.querySelector("mealz-drawer"),s=document.querySelector("mealz-store-indicator");if(!e||s)return;const i=e.getElementsByClassName("mealz-drawer__content-container")[0];i!=null&&i.querySelector("mealz-supplier-selector")||(this.drawerStoreIndicator=document.createElement("mealz-store-indicator"),this.drawerStoreIndicator.setAttribute("analyticsPath",this.analyticsPath),e.appendToHeaderComponent(this.drawerStoreIndicator))}placeOrder(){this.openBasketTransferModal(),c.basketTransfer.transfer()}openBasketTransferModal(){let e=document.querySelector("mealz-basket-transfer-modal");e||(e=document.createElement("mealz-basket-transfer-modal"),document.body.appendChild(e))}recipeCardClick(e){c.recipes.openDetails(e.id,e.guests,this.analyticsPath)}removeRecipeClick(e){e.isGettingRemoved=!0,this.requestUpdate(),c.basket.removeRecipe(e.id,this.analyticsPath).subscribe(()=>{e.isGettingRemoved=!1,this.recipePreviews=this.recipePreviews.filter(s=>s.id!==e.id),this.requestUpdate()})}updateTabIndex(e){this.selectedTabIndex=e,se(e),this.selectedTabIndex===0?(this.analyticsPath="/basket/recipes",this.pageview()):(this.analyticsPath="/basket/products",this.pageview()),this.requestUpdate()}updateRecipeView(){const e=c.basket,s=e.buildPreview(),i=typeof e.waitForBasketEntries=="function"?e.waitForBasketEntries().pipe(H(()=>s)):s;this.subscriptions.push(i.subscribe(a=>{a.map(t=>t.isGettingRemoved=!1),this.recipePreviews=a,console.log("this.recipePreviews",this.recipePreviews),this.requestUpdate()}))}scrollToAddedProduct(e){var i;const s=document.querySelector(`#mealz-basket-preview-product-${e}`);if(s)s.scrollIntoView({block:"center",behavior:"smooth"});else{const a=this.getElementsByTagName("MEALZ-BASKET-PREVIEW-PRODUCT");(i=a.item(a.length-1))==null||i.scrollIntoView({block:"center",behavior:"smooth"})}}listenToActiveTab(){this.subscriptions.push(c.basket.basketPreviewState$.subscribe(({activeTabIndex:e})=>{e!==void 0&&(this.selectedTabIndex=e)}))}listenToCloseEvent(){const e=document.querySelector("mealz-drawer");e&&e.addEventListener("drawerClosed",this.sendCloseEvent.bind(this))}isHidden(){return this.classList.contains("hidden")}pageview(){this.isHidden()||c.analytics.sendEvent("pageview",this.analyticsPath,{})}sendCloseEvent(){this.isHidden()||c.analytics.sendEvent("basket.close",this.analyticsPath,{})}};I=ae([x("mealz-basket-preview")],I);customElements.get("mealz-basket-preview")||customElements.define("mealz-basket-preview",I);export{Me as l,Ue as o};
233
+ `}appendStoreIndicatorToDrawerHeader(){const e=document.querySelector("mealz-drawer"),i=document.querySelector("mealz-store-indicator");if(!e||i)return;const r=e.getElementsByClassName("mealz-drawer__content-container")[0];r!=null&&r.querySelector("mealz-supplier-selector")||(this.drawerStoreIndicator=document.createElement("mealz-store-indicator"),this.drawerStoreIndicator.setAttribute("analyticsPath",this.analyticsPath),e.appendToHeaderComponent(this.drawerStoreIndicator))}placeOrder(){this.openBasketTransferModal(),c.basketTransfer.transfer()}openBasketTransferModal(){let e=document.querySelector("mealz-basket-transfer-modal");e||(e=document.createElement("mealz-basket-transfer-modal"),document.body.appendChild(e))}recipeCardClick(e){c.recipes.openDetails(e.id,e.guests,this.analyticsPath)}removeRecipeClick(e){e.isGettingRemoved=!0,this.requestUpdate(),c.basket.removeRecipe(e.id,this.analyticsPath).subscribe(()=>{e.isGettingRemoved=!1,this.recipePreviews=this.recipePreviews.filter(i=>i.id!==e.id),this.requestUpdate()})}updateTabIndex(e){this.selectedTabIndex=e,Z(e),this.selectedTabIndex===0?(this.analyticsPath="/basket/recipes",this.pageview()):(this.analyticsPath="/basket/products",this.pageview()),this.requestUpdate()}updateRecipeView(){const e=c.basket,i=e.buildPreview(),r=typeof e.waitForBasketEntries=="function"?e.waitForBasketEntries().pipe(V(()=>i)):i;this.subscriptions.push(r.subscribe(t=>{t.map(a=>a.isGettingRemoved=!1),this.recipePreviews=t,console.log("this.recipePreviews",this.recipePreviews),this.requestUpdate()}))}scrollToAddedProduct(e){var r;const i=document.querySelector(`#mealz-basket-preview-product-${e}`);if(i)i.scrollIntoView({block:"center",behavior:"smooth"});else{const t=this.getElementsByTagName("MEALZ-BASKET-PREVIEW-PRODUCT");(r=t.item(t.length-1))==null||r.scrollIntoView({block:"center",behavior:"smooth"})}}listenToActiveTab(){this.subscriptions.push(c.basket.basketPreviewState$.subscribe(({activeTabIndex:e})=>{e!==void 0&&(this.selectedTabIndex=e)}))}listenToCloseEvent(){const e=document.querySelector("mealz-drawer");e&&e.addEventListener("drawerClosed",this.sendCloseEvent.bind(this))}isHidden(){return this.classList.contains("hidden")}pageview(){this.isHidden()||c.analytics.sendEvent("pageview",this.analyticsPath,{})}sendCloseEvent(){this.isHidden()||c.analytics.sendEvent("basket.close",this.analyticsPath,{})}}customElements.get("mealz-basket-preview")||customElements.define("mealz-basket-preview",X);export{Se as l,Ce as o};
@@ -1 +1 @@
1
- import{t as h}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/no-shadow-element-D62BBu0I.js";import{C as g}from"../catalog-load-more.min.js";import{h as u}from"../../assets/session-handler-BZFnRy_K.js";import{w as f,m as o}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/http-Bepz6wA4.js";import"../../assets/innerFrom-DePszgj9.js";import"../../assets/mergeMap-D2yctTHQ.js";import"../../assets/map-DT-7dkaR.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";import"../../assets/executeSchedule-CEDvgTzM.js";import"../../assets/mapOneOrManyArgs-CHGhEDCk.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/timer-3Kpx74mt.js";import"../../assets/isScheduler-CqHuyMwD.js";import"../../assets/isDate-BwHtzZM4.js";var C=Object.getOwnPropertyDescriptor,y=(e,t,n,s)=>{for(var a=s>1?void 0:s?C(t,n):t,r=e.length-1,i;r>=0;r--)(i=e[r])&&(a=i(a)||a);return a};let c=class extends g{constructor(){super(...arguments),this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),f().then(()=>{var e,t;(t=(e=o)==null?void 0:e.preferences)!=null&&t.preferencesChanged$&&this.subscriptions.push(o.preferences.preferencesChanged$().subscribe(()=>this.reloadPage()))}).catch(e=>{console.warn("Failed to initialize preferences subscription:",e)})}disconnectedCallback(){super.disconnectedCallback()}render(){var p;const e=(p=this.attributes["starting-data"])==null?void 0:p.value;if(!e||(this.recipeCardListHTML=this.querySelector(".mealz-catalog__list"),!this.recipeCardListHTML))return;const{batchSize:t,packageId:n,posId:s,loadMoreURL:a,displayRecipeVariant:r,search:i,sessionId:l,path:d}=JSON.parse(e);u(l),this.analyticsPath=d;const m=window.location.search.includes("from=header");this.sendPageViewEvent(m),this.loadMoreRecipesOnScroll({displayRecipeVariant:r,loadMoreURL:a,sessionId:l,pageSize:t,storeId:s,packageId:n,search:i,listHTML:this.recipeCardListHTML}),this.removeAttribute("starting-data")}reloadPage(){location.reload()}sendPageViewEvent(e=!1){o?(o.analytics.sendEvent("pageview",this.analyticsPath,{},e?"meals-space-header":void 0),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(e),10))}};c=y([h("mealz-catalog-category")],c);customElements.get("mealz-catalog-category")||customElements.define("mealz-catalog-category",c);
1
+ import{C as h}from"../catalog-load-more.min.js";import{h as m}from"../../assets/session-handler-BZFnRy_K.js";import{w as g,m as a}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/no-shadow-element-D62BBu0I.js";import"../../assets/http-Bepz6wA4.js";import"../../assets/innerFrom-DePszgj9.js";import"../../assets/mergeMap-D2yctTHQ.js";import"../../assets/map-DT-7dkaR.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";import"../../assets/executeSchedule-CEDvgTzM.js";import"../../assets/mapOneOrManyArgs-CHGhEDCk.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/timer-3Kpx74mt.js";import"../../assets/isScheduler-CqHuyMwD.js";import"../../assets/isDate-BwHtzZM4.js";class u extends h{constructor(){super(...arguments),this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),g().then(()=>{var e,t;(t=(e=a)==null?void 0:e.preferences)!=null&&t.preferencesChanged$&&this.subscriptions.push(a.preferences.preferencesChanged$().subscribe(()=>this.reloadPage()))}).catch(e=>{console.warn("Failed to initialize preferences subscription:",e)})}disconnectedCallback(){super.disconnectedCallback()}render(){var s;const e=(s=this.attributes["starting-data"])==null?void 0:s.value;if(!e||(this.recipeCardListHTML=this.querySelector(".mealz-catalog__list"),!this.recipeCardListHTML))return;const{batchSize:t,packageId:r,posId:o,loadMoreURL:n,displayRecipeVariant:c,search:l,sessionId:i,path:p}=JSON.parse(e);m(i),this.analyticsPath=p;const d=window.location.search.includes("from=header");this.sendPageViewEvent(d),this.loadMoreRecipesOnScroll({displayRecipeVariant:c,loadMoreURL:n,sessionId:i,pageSize:t,storeId:o,packageId:r,search:l,listHTML:this.recipeCardListHTML}),this.removeAttribute("starting-data")}reloadPage(){location.reload()}sendPageViewEvent(e=!1){a?(a.analytics.sendEvent("pageview",this.analyticsPath,{},e?"meals-space-header":void 0),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(e),10))}}customElements.get("mealz-catalog-category")||customElements.define("mealz-catalog-category",u);
@@ -1 +1 @@
1
- import{t as m}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/no-shadow-element-D62BBu0I.js";import{C as g}from"../catalog-load-more.min.js";import{h}from"../../assets/session-handler-BZFnRy_K.js";import{m as l}from"../../assets/mealz-sdk-E_fNZM-c.js";import{s as u}from"../../assets/skip-Bup0JB81.js";import"../../assets/http-Bepz6wA4.js";import"../../assets/innerFrom-DePszgj9.js";import"../../assets/mergeMap-D2yctTHQ.js";import"../../assets/map-DT-7dkaR.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";import"../../assets/executeSchedule-CEDvgTzM.js";import"../../assets/mapOneOrManyArgs-CHGhEDCk.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/timer-3Kpx74mt.js";import"../../assets/isScheduler-CqHuyMwD.js";import"../../assets/isDate-BwHtzZM4.js";import"../../assets/filter-q99GWcpD.js";var f=Object.getOwnPropertyDescriptor,v=(e,t,s,o)=>{for(var i=o>1?void 0:o?f(t,s):t,a=e.length-1,r;a>=0;a--)(r=e[a])&&(i=r(i)||i);return i};let n=class extends g{constructor(){super(...arguments),this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),this.subscriptions.push(l.user.isAuthenticated().pipe(u(1)).subscribe(e=>{this.isLogged=e,this.updateDOM()}),this.handleLikedRecipe())}disconnectedCallback(){super.disconnectedCallback()}render(){var d;const e=(d=this.attributes["starting-data"])==null?void 0:d.value;if(!e)return;const{pageSize:t,storeId:s,loadMoreURL:o,displayRecipeVariant:i,search:a,sessionId:r,path:p}=JSON.parse(e);if(this.analyticsPath=p,this.sendPageViewEvent(),this.favorites=this.querySelector(".mealz-catalog-favorites__list"),!this.favorites)return;const c=this.querySelector(".mealz-catalog__list");c&&(h(r),this.loadMoreRecipesOnScroll({displayRecipeVariant:i,loadMoreURL:o,sessionId:r,pageSize:t,storeId:s,packageId:null,search:a,listHTML:c}),this.removeAttribute("starting-data"))}updateDOM(){const e=this.querySelector(".mealz-catalog-favorites__list__not-logged"),t=this.querySelector(".mealz-catalog-favorites__list__logged");!e||!t||(e.classList.toggle("hidden",this.isLogged),t.classList.toggle("hidden",!this.isLogged))}sendPageViewEvent(){var e;l?((e=l.analytics)==null||e.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}handleLikedRecipe(){return l.recipes.recipeLikeUpdated().subscribe(({id:e,isPast:t})=>{const s=document.getElementById("mealz-recipe-card-"+e);s&&s.classList.toggle("hidden",t),this.requestUpdate()})}};n=v([m("mealz-catalog-favorites")],n);customElements.get("mealz-catalog-favorites")||customElements.define("mealz-catalog-favorites",n);
1
+ import{C as p}from"../catalog-load-more.min.js";import{h as m}from"../../assets/session-handler-BZFnRy_K.js";import{m as s}from"../../assets/mealz-sdk-E_fNZM-c.js";import{s as g}from"../../assets/skip-Bup0JB81.js";import"../../assets/no-shadow-element-D62BBu0I.js";import"../../assets/http-Bepz6wA4.js";import"../../assets/innerFrom-DePszgj9.js";import"../../assets/mergeMap-D2yctTHQ.js";import"../../assets/map-DT-7dkaR.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";import"../../assets/executeSchedule-CEDvgTzM.js";import"../../assets/mapOneOrManyArgs-CHGhEDCk.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/timer-3Kpx74mt.js";import"../../assets/isScheduler-CqHuyMwD.js";import"../../assets/isDate-BwHtzZM4.js";import"../../assets/filter-q99GWcpD.js";class h extends p{constructor(){super(...arguments),this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),this.subscriptions.push(s.user.isAuthenticated().pipe(g(1)).subscribe(e=>{this.isLogged=e,this.updateDOM()}),this.handleLikedRecipe())}disconnectedCallback(){super.disconnectedCallback()}render(){var o;const e=(o=this.attributes["starting-data"])==null?void 0:o.value;if(!e)return;const{pageSize:t,storeId:i,loadMoreURL:l,displayRecipeVariant:n,search:c,sessionId:a,path:d}=JSON.parse(e);if(this.analyticsPath=d,this.sendPageViewEvent(),this.favorites=this.querySelector(".mealz-catalog-favorites__list"),!this.favorites)return;const r=this.querySelector(".mealz-catalog__list");r&&(m(a),this.loadMoreRecipesOnScroll({displayRecipeVariant:n,loadMoreURL:l,sessionId:a,pageSize:t,storeId:i,packageId:null,search:c,listHTML:r}),this.removeAttribute("starting-data"))}updateDOM(){const e=this.querySelector(".mealz-catalog-favorites__list__not-logged"),t=this.querySelector(".mealz-catalog-favorites__list__logged");!e||!t||(e.classList.toggle("hidden",this.isLogged),t.classList.toggle("hidden",!this.isLogged))}sendPageViewEvent(){var e;s?((e=s.analytics)==null||e.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}handleLikedRecipe(){return s.recipes.recipeLikeUpdated().subscribe(({id:e,isPast:t})=>{const i=document.getElementById("mealz-recipe-card-"+e);i&&i.classList.toggle("hidden",t),this.requestUpdate()})}}customElements.get("mealz-catalog-favorites")||customElements.define("mealz-catalog-favorites",h);
@@ -1 +1 @@
1
- import{C as y}from"../catalog-load-more.min.js";import{t as c}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/no-shadow-element-D62BBu0I.js";import{h as p}from"../../assets/session-handler-BZFnRy_K.js";import{m as h}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/http-Bepz6wA4.js";import"../../assets/innerFrom-DePszgj9.js";import"../../assets/mergeMap-D2yctTHQ.js";import"../../assets/map-DT-7dkaR.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";import"../../assets/executeSchedule-CEDvgTzM.js";import"../../assets/mapOneOrManyArgs-CHGhEDCk.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/timer-3Kpx74mt.js";import"../../assets/isScheduler-CqHuyMwD.js";import"../../assets/isDate-BwHtzZM4.js";var m=Object.getOwnPropertyDescriptor,g=(t,e,r,i)=>{for(var s=i>1?void 0:i?m(e,r):e,a=t.length-1,o;a>=0;a--)(o=t[a])&&(s=o(s)||s);return s};let n=class extends y{constructor(){super(),this.retryCount=0,this.maxRetries=30,this.isHandlingHistory=!1,this.styleURL=new URL("./catalog/catalog-history/catalog-history.css",this.getBaseURL()),this.handleHistoryDrawer=this.handleHistoryDrawer.bind(this)}connectedCallback(){super.connectedCallback();const t=this.getAttribute("starting-data");if(!t)return;const{loadMoreURL:e,drawerDataURL:r,sessionId:i,pageSize:s,storeId:a,orders:o,path:l,historyStyle:d}=JSON.parse(t);this.historyDrawerData=JSON.stringify({storeId:a,sessionId:i,drawerDataURL:r}),this.loadMoreURL=e,this.sessionId=i,this.pageSize=s,this.storeId=a,this.orders=o,this.analyticsPath=l,this.historyStyle=d,p(this.sessionId),this.removeAttribute("starting-data"),this.sendPageViewEvent(),this.initURLListener(),this.handleHistoryDrawer()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handleHistoryDrawer)}render(){const t=this.querySelector(".mealz-catalog__list");t&&(this.historyOrderListHTML=t,this.loadMoreRecipesOnScroll({displayRecipeVariant:"",loadMoreURL:this.loadMoreURL,sessionId:this.sessionId,pageSize:+this.pageSize,storeId:this.storeId,packageId:void 0,search:"",listHTML:this.historyOrderListHTML,historyStyle:this.historyStyle}))}handleHistoryDrawer(){if(!this.isHandlingHistory){this.isHandlingHistory=!0;try{const t=new URL(window.location.href),e=t.searchParams.get("order"),r=t.searchParams.get("displayRecipe");if(!e||!this.orders||r)return;const i=document.querySelector("mealz-drawer-view-swapper"),s=this.orders.find(o=>o.id===e),a=(s==null?void 0:s.updatedAt)||"";i&&i.displayHistoryDrawer$.next({historyDrawerData:this.historyDrawerData,orderId:e,orderDate:a})}finally{setTimeout(()=>{this.isHandlingHistory=!1},0)}}}initURLListener(){window.addEventListener("popstate",this.handleHistoryDrawer);const t=history.pushState,e=history.replaceState;history.pushState=(...r)=>{t.apply(history,r),this.handleHistoryDrawer()},history.replaceState=(...r)=>{e.apply(history,r),this.handleHistoryDrawer()}}sendPageViewEvent(){h?(h.analytics.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}};n=g([c("mealz-catalog-history")],n);customElements.get("mealz-catalog-history")||customElements.define("mealz-catalog-history",n);
1
+ import{C as d}from"../catalog-load-more.min.js";import{h as y}from"../../assets/session-handler-BZFnRy_K.js";import{m as n}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/no-shadow-element-D62BBu0I.js";import"../../assets/http-Bepz6wA4.js";import"../../assets/innerFrom-DePszgj9.js";import"../../assets/mergeMap-D2yctTHQ.js";import"../../assets/map-DT-7dkaR.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";import"../../assets/executeSchedule-CEDvgTzM.js";import"../../assets/mapOneOrManyArgs-CHGhEDCk.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/timer-3Kpx74mt.js";import"../../assets/isScheduler-CqHuyMwD.js";import"../../assets/isDate-BwHtzZM4.js";class c extends d{constructor(){super(),this.retryCount=0,this.maxRetries=30,this.isHandlingHistory=!1,this.styleURL=new URL("./catalog/catalog-history/catalog-history.css",this.getBaseURL()),this.handleHistoryDrawer=this.handleHistoryDrawer.bind(this)}connectedCallback(){super.connectedCallback();const t=this.getAttribute("starting-data");if(!t)return;const{loadMoreURL:e,drawerDataURL:s,sessionId:i,pageSize:r,storeId:a,orders:o,path:h,historyStyle:l}=JSON.parse(t);this.historyDrawerData=JSON.stringify({storeId:a,sessionId:i,drawerDataURL:s}),this.loadMoreURL=e,this.sessionId=i,this.pageSize=r,this.storeId=a,this.orders=o,this.analyticsPath=h,this.historyStyle=l,y(this.sessionId),this.removeAttribute("starting-data"),this.sendPageViewEvent(),this.initURLListener(),this.handleHistoryDrawer()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handleHistoryDrawer)}render(){const t=this.querySelector(".mealz-catalog__list");t&&(this.historyOrderListHTML=t,this.loadMoreRecipesOnScroll({displayRecipeVariant:"",loadMoreURL:this.loadMoreURL,sessionId:this.sessionId,pageSize:+this.pageSize,storeId:this.storeId,packageId:void 0,search:"",listHTML:this.historyOrderListHTML,historyStyle:this.historyStyle}))}handleHistoryDrawer(){if(!this.isHandlingHistory){this.isHandlingHistory=!0;try{const t=new URL(window.location.href),e=t.searchParams.get("order"),s=t.searchParams.get("displayRecipe");if(!e||!this.orders||s)return;const i=document.querySelector("mealz-drawer-view-swapper"),r=this.orders.find(o=>o.id===e),a=(r==null?void 0:r.updatedAt)||"";i&&i.displayHistoryDrawer$.next({historyDrawerData:this.historyDrawerData,orderId:e,orderDate:a})}finally{setTimeout(()=>{this.isHandlingHistory=!1},0)}}}initURLListener(){window.addEventListener("popstate",this.handleHistoryDrawer);const t=history.pushState,e=history.replaceState;history.pushState=(...s)=>{t.apply(history,s),this.handleHistoryDrawer()},history.replaceState=(...s)=>{e.apply(history,s),this.handleHistoryDrawer()}}sendPageViewEvent(){n?(n.analytics.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}}customElements.get("mealz-catalog-history")||customElements.define("mealz-catalog-history",c);
@@ -1 +1 @@
1
- import{t as h}from"../../assets/custom-element-BhZVzxrc.js";import{N as l}from"../../assets/no-shadow-element-D62BBu0I.js";import{h as d}from"../../assets/session-handler-BZFnRy_K.js";import{V as m}from"../../assets/viewport-listener-DsRHfwo4.js";import{w as g,m as r}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/debounceTime-Cf_7YmIn.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";var p=Object.getOwnPropertyDescriptor,y=(e,t,s,i)=>{for(var a=i>1?void 0:i?p(t,s):t,n=e.length-1,c;n>=0;n--)(c=e[n])&&(a=c(a)||a);return a};let o=class extends l{constructor(){super(...arguments),this.categories=[],this.viewportListeners=[],this.subscriptions=[],this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),g().then(()=>{var e,t;(t=(e=r)==null?void 0:e.preferences)!=null&&t.preferencesChanged$&&this.subscriptions.push(r.preferences.preferencesChanged$().subscribe(()=>this.reloadPage()))}).catch(e=>{console.warn("Failed to initialize preferences subscription:",e)})}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.viewportListeners.forEach(e=>e.disconnect()),this.viewportListeners=[]}render(){var a;const e=(a=this.attributes["starting-data"])==null?void 0:a.value;if(!e)return;const{categories:t,path:s,sessionId:i}=JSON.parse(e);d(i),this.analyticsPath=s,this.categories=t,this.sendPageViewEvent(),this.addEventListeners(),this.listenCategoriesInView(),this.removeAttribute("starting-data")}addEventListeners(){Array.from(this.getElementsByClassName("mealz-catalog__link")).forEach((t,s)=>{t==null||t.addEventListener("click",()=>this.sendCategoryDisplay(s))})}listenCategoriesInView(){Array.from(this.getElementsByClassName("mealz-catalog-home__category")).forEach((t,s)=>{const i=new m(t,()=>this.sendCategoryShow(s),{threshold:.8,debounce:1e3});this.viewportListeners.push(i)})}reloadPage(){location.reload()}sendPageViewEvent(){r?(r.analytics.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}sendCategoryDisplay(e){var t;r.analytics.sendEvent("category.display",this.analyticsPath,{category_id:(t=this.categories[Math.floor(e/2)])==null?void 0:t.id})}sendCategoryShow(e){var t;r.analytics.sendEvent("category.show",this.analyticsPath,{category_id:(t=this.categories[e])==null?void 0:t.id})}};o=y([h("mealz-catalog-home")],o);customElements.get("mealz-catalog-home")||customElements.define("mealz-catalog-home",o);
1
+ import{h as n}from"../../assets/session-handler-BZFnRy_K.js";import{N as o}from"../../assets/no-shadow-element-D62BBu0I.js";import{V as c}from"../../assets/viewport-listener-DsRHfwo4.js";import{w as h,m as s}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/debounceTime-Cf_7YmIn.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";class l extends o{constructor(){super(...arguments),this.categories=[],this.viewportListeners=[],this.subscriptions=[],this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),h().then(()=>{var e,t;(t=(e=s)==null?void 0:e.preferences)!=null&&t.preferencesChanged$&&this.subscriptions.push(s.preferences.preferencesChanged$().subscribe(()=>this.reloadPage()))}).catch(e=>{console.warn("Failed to initialize preferences subscription:",e)})}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.viewportListeners.forEach(e=>e.disconnect()),this.viewportListeners=[]}render(){var r;const e=(r=this.attributes["starting-data"])==null?void 0:r.value;if(!e)return;const{categories:t,path:a,sessionId:i}=JSON.parse(e);n(i),this.analyticsPath=a,this.categories=t,this.sendPageViewEvent(),this.addEventListeners(),this.listenCategoriesInView(),this.removeAttribute("starting-data")}addEventListeners(){Array.from(this.getElementsByClassName("mealz-catalog__link")).forEach((t,a)=>{t==null||t.addEventListener("click",()=>this.sendCategoryDisplay(a))})}listenCategoriesInView(){Array.from(this.getElementsByClassName("mealz-catalog-home__category")).forEach((t,a)=>{const i=new c(t,()=>this.sendCategoryShow(a),{threshold:.8,debounce:1e3});this.viewportListeners.push(i)})}reloadPage(){location.reload()}sendPageViewEvent(){s?(s.analytics.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}sendCategoryDisplay(e){var t;s.analytics.sendEvent("category.display",this.analyticsPath,{category_id:(t=this.categories[Math.floor(e/2)])==null?void 0:t.id})}sendCategoryShow(e){var t;s.analytics.sendEvent("category.show",this.analyticsPath,{category_id:(t=this.categories[e])==null?void 0:t.id})}}customElements.get("mealz-catalog-home")||customElements.define("mealz-catalog-home",l);
@@ -1 +1 @@
1
- import{t as l}from"../../assets/custom-element-BhZVzxrc.js";import{N as c}from"../../assets/no-shadow-element-D62BBu0I.js";import{m as d}from"../../assets/mealz-sdk-E_fNZM-c.js";var h=Object.getOwnPropertyDescriptor,m=(t,a,s,e)=>{for(var r=e>1?void 0:e?h(a,s):a,n=t.length-1,i;n>=0;n--)(i=t[n])&&(r=i(r)||r);return r};let o=class extends c{constructor(){super(...arguments),this.categoryId="",this.analyticsPath=""}render(){var e;const t=(e=this.attributes["starting-data"])==null?void 0:e.value;if(!t)return;const{categoryId:a,path:s}=JSON.parse(t);this.categoryId=a,this.analyticsPath=s,this.addBannerButtonListener(),this.removeAttribute("starting-data")}addBannerButtonListener(){const t=this.querySelector(".mealz-catalog-home-header__banner-button");t&&t.addEventListener("click",()=>{this.sendCategoryDisplayEvent()})}sendCategoryDisplayEvent(){d.analytics.sendEvent("category.display",this.analyticsPath,{category_id:this.categoryId},"meals-space-header")}};o=m([l("mealz-catalog-home-header")],o);customElements.get("mealz-catalog-home-header")||customElements.define("mealz-catalog-home-header",o);
1
+ import{N as n}from"../../assets/no-shadow-element-D62BBu0I.js";import{m as r}from"../../assets/mealz-sdk-E_fNZM-c.js";class o extends n{constructor(){super(...arguments),this.categoryId="",this.analyticsPath=""}render(){var e;const t=(e=this.attributes["starting-data"])==null?void 0:e.value;if(!t)return;const{categoryId:a,path:s}=JSON.parse(t);this.categoryId=a,this.analyticsPath=s,this.addBannerButtonListener(),this.removeAttribute("starting-data")}addBannerButtonListener(){const t=this.querySelector(".mealz-catalog-home-header__banner-button");t&&t.addEventListener("click",()=>{this.sendCategoryDisplayEvent()})}sendCategoryDisplayEvent(){r.analytics.sendEvent("category.display",this.analyticsPath,{category_id:this.categoryId},"meals-space-header")}}customElements.get("mealz-catalog-home-header")||customElements.define("mealz-catalog-home-header",o);
@@ -1 +1 @@
1
- import{t as o}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/no-shadow-element-D62BBu0I.js";import{C as c}from"../catalog-load-more.min.js";import{h}from"../../assets/session-handler-BZFnRy_K.js";import{w as d,m as p}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/http-Bepz6wA4.js";import"../../assets/innerFrom-DePszgj9.js";import"../../assets/mergeMap-D2yctTHQ.js";import"../../assets/map-DT-7dkaR.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";import"../../assets/executeSchedule-CEDvgTzM.js";import"../../assets/mapOneOrManyArgs-CHGhEDCk.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/timer-3Kpx74mt.js";import"../../assets/isScheduler-CqHuyMwD.js";import"../../assets/isDate-BwHtzZM4.js";var u=Object.getOwnPropertyDescriptor,y=(e,t,i,s)=>{for(var r=s>1?void 0:s?u(t,i):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(r=n(r)||r);return r};let l=class extends c{constructor(){super(...arguments),this.planner=!1,this.recipeTypeFilter=!1}connectedCallback(){super.connectedCallback(),d().then(()=>{var e,t;(t=(e=p)==null?void 0:e.preferences)!=null&&t.preferencesChanged$&&this.subscriptions.push(p.preferences.preferencesChanged$().subscribe(()=>this.reloadPage()))}).catch(e=>{console.warn("Failed to initialize preferences subscription:",e)})}disconnectedCallback(){super.disconnectedCallback()}render(){const e=this.getStartingData();if(!e||!this.initializeRecipeCardListElement())return;const t=this.parseStartingData(e);t&&this.validateAndHandleSession(t.sessionId)&&(this.setFilterFlags(t.planner,t.recipeTypeFilter,t.recipeTypeId),this.initDishTypeFilter(),this.initializeCatalog(t),this.removeAttribute("starting-data"))}getStartingData(){return this.getAttribute("starting-data")}initializeRecipeCardListElement(){const e=this.querySelector(".mealz-catalog__list");return e?(this.recipeCardListHTML=e,!0):!1}parseStartingData(e){try{return JSON.parse(e)}catch(t){return console.warn("Invalid catalog list starting-data:",t),null}}validateAndHandleSession(e){return e?(h(e),!0):!1}setFilterFlags(e,t,i){this.planner=e===!0||e==="true",this.recipeTypeFilter=t===!0||t==="true",this.recipeTypeId=i||void 0}initializeCatalog(e){this.loadMoreRecipesOnScroll({displayRecipeVariant:e.displayRecipeVariant,loadMoreURL:e.loadMoreURL,sessionId:e.sessionId,pageSize:e.pageSize,storeId:e.storeId,search:e.search,listHTML:this.recipeCardListHTML,promotions:e.promotions,planner:this.planner,recipeTypeFilter:this.recipeTypeFilter,recipeTypeId:e.recipeTypeId})}initDishTypeFilter(){const e=this.getDishTypeFilterChips();!e||e.length===0||(this.applyActiveStateToChips(e,this.recipeTypeId),this.attachChipClickHandlers(e))}getDishTypeFilterChips(){const e=this.querySelector(".mealz-catalog-list__dish-type-filter");return!e||!this.recipeTypeFilter?null:Array.from(e.querySelectorAll(".mealz-catalog-list__dish-type-filter__chip"))}applyActiveStateToChips(e,t){e.forEach(i=>{const r=(i.getAttribute("data-recipe-type-id")||"")===(t||"");i.classList.toggle("active",r),i.setAttribute("aria-selected",r?"true":"false")})}attachChipClickHandlers(e){e.forEach(t=>{t.addEventListener("click",()=>this.handleDishTypeChipClick(t,e),{passive:!0})})}handleDishTypeChipClick(e,t){const i=e.getAttribute("data-recipe-type-id")||"";i!==(this.recipeTypeId||"")&&(this.recipeTypeId=i||void 0,this.applyActiveStateToChips(t,this.recipeTypeId),this.showLoader(),this.planner?this.handlePlannerDishTypeChange(i):this.handleNonPlannerDishTypeChange())}showLoader(){const e=this.querySelector(".mealz-ds-loader");e&&(e.style.display="block")}handlePlannerDishTypeChange(e){const t=new CustomEvent("dishTypeEvent",{detail:{mealType:e},bubbles:!0,composed:!0});this.dispatchEvent(t)}handleNonPlannerDishTypeChange(){const e=new URL(window.location.href);this.recipeTypeId?e.searchParams.set("recipe_type_id",this.recipeTypeId):e.searchParams.delete("recipe_type_id"),window.location.href=e.toString()}reloadPage(){location.reload()}};l=y([o("mealz-catalog-list")],l);customElements.get("mealz-catalog-list")||customElements.define("mealz-catalog-list",l);
1
+ import{C as a}from"../catalog-load-more.min.js";import{h as n}from"../../assets/session-handler-BZFnRy_K.js";import{w as l,m as s}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/no-shadow-element-D62BBu0I.js";import"../../assets/http-Bepz6wA4.js";import"../../assets/innerFrom-DePszgj9.js";import"../../assets/mergeMap-D2yctTHQ.js";import"../../assets/map-DT-7dkaR.js";import"../../assets/OperatorSubscriber-DfCnFunn.js";import"../../assets/executeSchedule-CEDvgTzM.js";import"../../assets/mapOneOrManyArgs-CHGhEDCk.js";import"../../assets/async-C5Kj_SqM.js";import"../../assets/timer-3Kpx74mt.js";import"../../assets/isScheduler-CqHuyMwD.js";import"../../assets/isDate-BwHtzZM4.js";class p extends a{constructor(){super(...arguments),this.planner=!1,this.recipeTypeFilter=!1}connectedCallback(){super.connectedCallback(),l().then(()=>{var e,t;(t=(e=s)==null?void 0:e.preferences)!=null&&t.preferencesChanged$&&this.subscriptions.push(s.preferences.preferencesChanged$().subscribe(()=>this.reloadPage()))}).catch(e=>{console.warn("Failed to initialize preferences subscription:",e)})}disconnectedCallback(){super.disconnectedCallback()}render(){const e=this.getStartingData();if(!e||!this.initializeRecipeCardListElement())return;const t=this.parseStartingData(e);t&&this.validateAndHandleSession(t.sessionId)&&(this.setFilterFlags(t.planner,t.recipeTypeFilter,t.recipeTypeId),this.initDishTypeFilter(),this.initializeCatalog(t),this.removeAttribute("starting-data"))}getStartingData(){return this.getAttribute("starting-data")}initializeRecipeCardListElement(){const e=this.querySelector(".mealz-catalog__list");return e?(this.recipeCardListHTML=e,!0):!1}parseStartingData(e){try{return JSON.parse(e)}catch(t){return console.warn("Invalid catalog list starting-data:",t),null}}validateAndHandleSession(e){return e?(n(e),!0):!1}setFilterFlags(e,t,i){this.planner=e===!0||e==="true",this.recipeTypeFilter=t===!0||t==="true",this.recipeTypeId=i||void 0}initializeCatalog(e){this.loadMoreRecipesOnScroll({displayRecipeVariant:e.displayRecipeVariant,loadMoreURL:e.loadMoreURL,sessionId:e.sessionId,pageSize:e.pageSize,storeId:e.storeId,search:e.search,listHTML:this.recipeCardListHTML,promotions:e.promotions,planner:this.planner,recipeTypeFilter:this.recipeTypeFilter,recipeTypeId:e.recipeTypeId})}initDishTypeFilter(){const e=this.getDishTypeFilterChips();!e||e.length===0||(this.applyActiveStateToChips(e,this.recipeTypeId),this.attachChipClickHandlers(e))}getDishTypeFilterChips(){const e=this.querySelector(".mealz-catalog-list__dish-type-filter");return!e||!this.recipeTypeFilter?null:Array.from(e.querySelectorAll(".mealz-catalog-list__dish-type-filter__chip"))}applyActiveStateToChips(e,t){e.forEach(i=>{const r=(i.getAttribute("data-recipe-type-id")||"")===(t||"");i.classList.toggle("active",r),i.setAttribute("aria-selected",r?"true":"false")})}attachChipClickHandlers(e){e.forEach(t=>{t.addEventListener("click",()=>this.handleDishTypeChipClick(t,e),{passive:!0})})}handleDishTypeChipClick(e,t){const i=e.getAttribute("data-recipe-type-id")||"";i!==(this.recipeTypeId||"")&&(this.recipeTypeId=i||void 0,this.applyActiveStateToChips(t,this.recipeTypeId),this.showLoader(),this.planner?this.handlePlannerDishTypeChange(i):this.handleNonPlannerDishTypeChange())}showLoader(){const e=this.querySelector(".mealz-ds-loader");e&&(e.style.display="block")}handlePlannerDishTypeChange(e){const t=new CustomEvent("dishTypeEvent",{detail:{mealType:e},bubbles:!0,composed:!0});this.dispatchEvent(t)}handleNonPlannerDishTypeChange(){const e=new URL(window.location.href);this.recipeTypeId?e.searchParams.set("recipe_type_id",this.recipeTypeId):e.searchParams.delete("recipe_type_id"),window.location.href=e.toString()}reloadPage(){location.reload()}}customElements.get("mealz-catalog-list")||customElements.define("mealz-catalog-list",p);
@@ -1 +1 @@
1
- import{t as n}from"../../assets/custom-element-BhZVzxrc.js";import{N as m}from"../../assets/no-shadow-element-D62BBu0I.js";import"../../assets/mealz-sdk-E_fNZM-c.js";var b=Object.getOwnPropertyDescriptor,d=(l,c,r,s)=>{for(var e=s>1?void 0:s?b(c,r):c,a=l.length-1,o;a>=0;a--)(o=l[a])&&(e=o(e)||e);return e};let t=class extends m{connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){}};t=d([n("mealz-catalog-tabs")],t);customElements.get("mealz-catalog-tabs")||customElements.define("mealz-catalog-tabs",t);
1
+ import{N as e}from"../../assets/no-shadow-element-D62BBu0I.js";import"../../assets/mealz-sdk-E_fNZM-c.js";class a extends e{connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){}}customElements.get("mealz-catalog-tabs")||customElements.define("mealz-catalog-tabs",a);
@@ -1 +1 @@
1
- import{N as c}from"../../assets/no-shadow-element-D62BBu0I.js";import{t as h}from"../../assets/custom-element-BhZVzxrc.js";import{w as u,m as i}from"../../assets/mealz-sdk-E_fNZM-c.js";var p=Object.getOwnPropertyDescriptor,d=(e,t,s,r)=>{for(var a=r>1?void 0:r?p(t,s):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(a=n(a)||a);return a};let l=class extends c{constructor(){super(...arguments),this.subscriptions=[],this.supplierHeaderHeight=0,this.searchUrl="",this.path="",this.planner=!1}get selectors(){return{preferencesButton:".mealz-catalog-toolbar__controls__preferences",favoritesButton:".mealz-catalog-toolbar__controls__favorites",searchInput:".mealz-catalog-toolbar__searchbar-input",clearButton:".mealz-catalog-toolbar__clear-button",backButton:".mealz-recipe-toolbar__return-button"}}connectedCallback(){super.connectedCallback(),u().then(()=>{var e,t,s;(e=i)!=null&&e.getStickyHeaderHeight&&this.subscriptions.push(i.getStickyHeaderHeight().subscribe(r=>{this.supplierHeaderHeight=r,this.setStickyObserver()})),(s=(t=i)==null?void 0:t.preferences)!=null&&s.preferencesChanged$&&this.subscriptions.push(i.preferences.preferencesChanged$().subscribe(()=>{var o,n;const r=(o=this.preferencesButton)==null?void 0:o.querySelector(".mealz-catalog-toolbar__controls__filter-badge"),a=(n=this.preferencesButton)==null?void 0:n.querySelector(".mealz-catalog-toolbar__loader");r&&r.classList.add("hidden"),a&&a.classList.remove("hidden")}))}).catch(e=>{console.warn("Failed to initialize SDK subscriptions:",e)})}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.toolbarObserver.unobserve(this.anchorElement)}render(){var a;const e=(a=this.attributes["starting-data"])==null?void 0:a.value;if(!e)return;const{searchUrl:t,path:s,planner:r}=JSON.parse(e);this.searchUrl=t,this.path=s,r&&(this.planner=r),this.findElementsInDocument(),this.addEveryEventListeners(),this.updateClearButtonVisibility(),this.removeAttribute("starting-data")}firstUpdated(){this.setStickyObserver()}setStickyObserver(){var t;if(this.toolbar=document.querySelector(".mealz-catalog-toolbar"),this.anchorElement=document.querySelector(".mealz-catalog-toolbar__anchor"),!this.anchorElement||!this.toolbar)return;const e={rootMargin:`-${this.supplierHeaderHeight}px 0px 0px 0px`,threshold:1};(t=this.toolbarObserver)==null||t.unobserve(this),setTimeout(()=>this.setStickyToolbarStyle(),50),this.toolbarObserver=new IntersectionObserver(()=>{this.setStickyToolbarStyle()},e),this.toolbarObserver.observe(this.anchorElement)}setStickyToolbarStyle(){const t=this.anchorElement.getBoundingClientRect().top<this.supplierHeaderHeight;this.anchorElement.style.height=t?this.toolbar.clientHeight+"px":"0px",this.toolbar.classList.toggle("sticking",t),this.toolbar.style.top=(t?this.supplierHeaderHeight:0)+"px",this.updateDOM(t)}findElementsInDocument(){this.initSelectors(),this.preferencesButton=this.elements.preferencesButton,this.favoritesButton=this.elements.favoritesButton,this.searchInput=this.elements.searchInput,this.clearButton=this.elements.clearButton,this.backButton=this.elements.backButton}addEveryEventListeners(){var e,t;this.addClickListener("preferencesButton",this.openPreferences.bind(this)),this.addClickListener("favoritesButton",this.sendFavoritesDisplay.bind(this)),this.addClickListener("clearButton",this.clearSearch.bind(this)),(e=this.searchInput)==null||e.addEventListener("keypress",s=>{s.key==="Enter"&&this.performSearch()}),(t=this.searchInput)==null||t.addEventListener("input",()=>{this.updateClearButtonVisibility()})}updateClearButtonVisibility(){if(this.clearButton){const e=this.searchInput.value.trim().length>0;this.clearButton.classList.toggle("hidden",!e)}}clearSearch(){this.searchInput&&(this.searchInput.value="",this.updateClearButtonVisibility(),this.performSearch())}performSearch(){const e=this.searchInput.value.trim();if(i.analytics.sendEvent("search",this.path,{search_term:e}),this.planner){const t=new CustomEvent("searchEvent",{detail:{searchQuery:e},bubbles:!0,composed:!0});this.dispatchEvent(t)}else{const t=this.searchUrl.includes("?")?"&":"?",s=e?`search=${encodeURIComponent(e)}`:"";window.location.href=e?`${this.searchUrl}${t}${s}`:this.searchUrl}}updateDOM(e){var r;const t=e?["ghost","square"]:["full"],s=e?["full"]:["ghost","square"];this.toggleClasses(this.favoritesButton,t,s),this.toggleClasses(this.preferencesButton,t,s),(r=this.backButton)==null||r.classList.toggle("hidden",!e)}toggleClasses(e,t,s){e==null||e.classList.remove(...s),e==null||e.classList.add(...t)}async openPreferences(){i.analytics.sendEvent("preferences.display",this.path,{});const e=document.querySelector("mealz-drawer-view-swapper");e.displayPreferences$.next(!0),await e.updateComplete}sendFavoritesDisplay(){i.analytics.sendEvent("liked.display",this.path,{})}};l=d([h("mealz-catalog-toolbar")],l);customElements.get("mealz-catalog-toolbar")||customElements.define("mealz-catalog-toolbar",l);
1
+ import{N as l}from"../../assets/no-shadow-element-D62BBu0I.js";import{w as c,m as a}from"../../assets/mealz-sdk-E_fNZM-c.js";class h extends l{constructor(){super(...arguments),this.subscriptions=[],this.supplierHeaderHeight=0,this.searchUrl="",this.path="",this.planner=!1}get selectors(){return{preferencesButton:".mealz-catalog-toolbar__controls__preferences",favoritesButton:".mealz-catalog-toolbar__controls__favorites",searchInput:".mealz-catalog-toolbar__searchbar-input",clearButton:".mealz-catalog-toolbar__clear-button",backButton:".mealz-recipe-toolbar__return-button"}}connectedCallback(){super.connectedCallback(),c().then(()=>{var e,t,s;(e=a)!=null&&e.getStickyHeaderHeight&&this.subscriptions.push(a.getStickyHeaderHeight().subscribe(r=>{this.supplierHeaderHeight=r,this.setStickyObserver()})),(s=(t=a)==null?void 0:t.preferences)!=null&&s.preferencesChanged$&&this.subscriptions.push(a.preferences.preferencesChanged$().subscribe(()=>{var o,n;const r=(o=this.preferencesButton)==null?void 0:o.querySelector(".mealz-catalog-toolbar__controls__filter-badge"),i=(n=this.preferencesButton)==null?void 0:n.querySelector(".mealz-catalog-toolbar__loader");r&&r.classList.add("hidden"),i&&i.classList.remove("hidden")}))}).catch(e=>{console.warn("Failed to initialize SDK subscriptions:",e)})}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.toolbarObserver.unobserve(this.anchorElement)}render(){var i;const e=(i=this.attributes["starting-data"])==null?void 0:i.value;if(!e)return;const{searchUrl:t,path:s,planner:r}=JSON.parse(e);this.searchUrl=t,this.path=s,r&&(this.planner=r),this.findElementsInDocument(),this.addEveryEventListeners(),this.updateClearButtonVisibility(),this.removeAttribute("starting-data")}firstUpdated(){this.setStickyObserver()}setStickyObserver(){var t;if(this.toolbar=document.querySelector(".mealz-catalog-toolbar"),this.anchorElement=document.querySelector(".mealz-catalog-toolbar__anchor"),!this.anchorElement||!this.toolbar)return;const e={rootMargin:`-${this.supplierHeaderHeight}px 0px 0px 0px`,threshold:1};(t=this.toolbarObserver)==null||t.unobserve(this),setTimeout(()=>this.setStickyToolbarStyle(),50),this.toolbarObserver=new IntersectionObserver(()=>{this.setStickyToolbarStyle()},e),this.toolbarObserver.observe(this.anchorElement)}setStickyToolbarStyle(){const t=this.anchorElement.getBoundingClientRect().top<this.supplierHeaderHeight;this.anchorElement.style.height=t?this.toolbar.clientHeight+"px":"0px",this.toolbar.classList.toggle("sticking",t),this.toolbar.style.top=(t?this.supplierHeaderHeight:0)+"px",this.updateDOM(t)}findElementsInDocument(){this.initSelectors(),this.preferencesButton=this.elements.preferencesButton,this.favoritesButton=this.elements.favoritesButton,this.searchInput=this.elements.searchInput,this.clearButton=this.elements.clearButton,this.backButton=this.elements.backButton}addEveryEventListeners(){var e,t;this.addClickListener("preferencesButton",this.openPreferences.bind(this)),this.addClickListener("favoritesButton",this.sendFavoritesDisplay.bind(this)),this.addClickListener("clearButton",this.clearSearch.bind(this)),(e=this.searchInput)==null||e.addEventListener("keypress",s=>{s.key==="Enter"&&this.performSearch()}),(t=this.searchInput)==null||t.addEventListener("input",()=>{this.updateClearButtonVisibility()})}updateClearButtonVisibility(){if(this.clearButton){const e=this.searchInput.value.trim().length>0;this.clearButton.classList.toggle("hidden",!e)}}clearSearch(){this.searchInput&&(this.searchInput.value="",this.updateClearButtonVisibility(),this.performSearch())}performSearch(){const e=this.searchInput.value.trim();if(a.analytics.sendEvent("search",this.path,{search_term:e}),this.planner){const t=new CustomEvent("searchEvent",{detail:{searchQuery:e},bubbles:!0,composed:!0});this.dispatchEvent(t)}else{const t=this.searchUrl.includes("?")?"&":"?",s=e?`search=${encodeURIComponent(e)}`:"";window.location.href=e?`${this.searchUrl}${t}${s}`:this.searchUrl}}updateDOM(e){var r;const t=e?["ghost","square"]:["full"],s=e?["full"]:["ghost","square"];this.toggleClasses(this.favoritesButton,t,s),this.toggleClasses(this.preferencesButton,t,s),(r=this.backButton)==null||r.classList.toggle("hidden",!e)}toggleClasses(e,t,s){e==null||e.classList.remove(...s),e==null||e.classList.add(...t)}async openPreferences(){a.analytics.sendEvent("preferences.display",this.path,{});const e=document.querySelector("mealz-drawer-view-swapper");e.displayPreferences$.next(!0),await e.updateComplete}sendFavoritesDisplay(){a.analytics.sendEvent("liked.display",this.path,{})}}customElements.get("mealz-catalog-toolbar")||customElements.define("mealz-catalog-toolbar",h);