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.
- package/dist/assets/accordion-BGFgJnk1.js +19 -0
- package/dist/assets/product-card-wIoU7Z_5.js +189 -0
- package/dist/assets/promotion-badge-CDaL7Tqv.js +12 -0
- package/dist/basket-transfer-modal/basket-transfer-modal.min.js +5 -5
- package/dist/catalog/basket-preview/basket-preview.min.js +14 -14
- package/dist/catalog/catalog-category/catalog-category.min.js +1 -1
- package/dist/catalog/catalog-favorites/catalog-favorites.min.js +1 -1
- package/dist/catalog/catalog-history/catalog-history.min.js +1 -1
- package/dist/catalog/catalog-home/catalog-home.min.js +1 -1
- package/dist/catalog/catalog-home-header/catalog-home-header.min.js +1 -1
- package/dist/catalog/catalog-list/catalog-list.min.js +1 -1
- package/dist/catalog/catalog-tabs/catalog-tabs.min.js +1 -1
- package/dist/catalog/catalog-toolbar/catalog-toolbar.min.js +1 -1
- package/dist/catalog/my-meals-button/my-meals-button.min.js +1 -1
- package/dist/counter/counter.min.js +2 -2
- package/dist/drawer/drawer.min.js +5 -5
- package/dist/drawer-view-swapper/drawer-view-swapper.min.js +23 -23
- package/dist/history-drawer/history-drawer.min.js +1 -1
- package/dist/history-order/history-order.min.js +1 -1
- package/dist/history-order-expanded/history-order-expanded.min.js +1 -1
- package/dist/last-order-badge/last-order-badge.min.js +2 -2
- package/dist/last-order-modal/last-order-modal.min.js +4 -4
- package/dist/like-button/like-button.min.js +1 -1
- package/dist/modal/modal.min.js +4 -4
- package/dist/no-supplier-add-to-cart-cta/no-supplier-add-to-cart-cta.min.js +2 -2
- package/dist/onboarding/onboarding.min.js +4 -4
- package/dist/order-again/order-again.min.js +2 -2
- package/dist/planner/helpers/get-planner-onboarding-modal-config.min.js +1 -1
- package/dist/planner/helpers/init-planner-onboarding-modal.min.js +1 -1
- package/dist/planner/helpers/open-onboarding-modal.min.js +1 -1
- package/dist/planner/helpers/planner-onboarding-storage.min.js +1 -0
- package/dist/planner/planner-abandon-modal/planner-abandon-modal.min.js +2 -2
- package/dist/planner/planner-budget-edit-modal/planner-budget-edit-modal.min.js +2 -2
- package/dist/planner/planner-budget-gauge/planner-budget-gauge.min.js +1 -1
- package/dist/planner/planner-catalog/planner-catalog.min.js +2 -2
- package/dist/planner/planner-current-menu/planner-current-menu.css +1 -1
- package/dist/planner/planner-current-menu/planner-current-menu.min.js +1 -1
- package/dist/planner/planner-current-menu-modal/planner-current-menu-modal.min.js +2 -2
- package/dist/planner/planner-form/planner-form.min.js +7 -7
- package/dist/planner/planner-menu-option/planner-menu-option.min.js +1 -1
- package/dist/planner/planner-onboarding/planner-onboarding.min.js +1 -1
- package/dist/planner/planner-onboarding-modal/planner-onboarding-modal.min.js +6 -6
- package/dist/planner/planner-open-catalog-modal/planner-open-catalog-modal.min.js +2 -2
- package/dist/planner/planner-quick-menu/planner-quick-menu.min.js +1 -1
- package/dist/planner/planner-recipe-card/planner-recipe-card.min.js +1 -1
- package/dist/planner/planner-recipe-list/planner-recipe-list.min.js +1 -1
- package/dist/planner/planner-recipe-suggestion/planner-recipe-suggestion.min.js +1 -1
- package/dist/planner/planner-welcome-modal/planner-welcome-modal.min.js +3 -3
- package/dist/planner/to-basket-loader/to-basket-loader.min.js +5 -5
- package/dist/planner-entry/planner-entry.min.js +1 -1
- package/dist/preferences/preferences.min.js +4 -4
- package/dist/price/price.min.js +3 -3
- package/dist/products-to-basket-cta/products-to-basket-cta.min.js +1 -1
- package/dist/recipe-card/recipe-card.min.js +1 -1
- package/dist/recipe-card-cta/recipe-card-cta.min.js +1 -1
- package/dist/recipe-details/recipe-details.min.js +111 -111
- package/dist/recipe-pricing/recipe-pricing.min.js +1 -1
- package/dist/recipe-to-basket/recipe-to-basket.min.js +1 -1
- package/dist/replace-item/replace-item-card/replace-item-card.min.js +11 -11
- package/dist/replace-item/replace-item.min.js +13 -13
- package/dist/replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js +4 -4
- package/dist/replace-item-planner/replace-item-planner.min.js +13 -13
- package/dist/select/select.min.js +6 -6
- package/dist/slider-tabs/slider-tabs.min.js +3 -3
- package/dist/store-indicator/store-indicator.min.js +2 -2
- package/dist/store-locator/store-locator.min.js +2 -2
- package/dist/store-locator-drawer/store-locator-drawer.min.js +2 -2
- package/dist/supplier-selector/supplier-selector.min.js +6 -6
- package/package.json +1 -1
- package/dist/assets/accordion-sjJSL32r.js +0 -19
- package/dist/assets/custom-element-BhZVzxrc.js +0 -5
- package/dist/assets/product-card-TLfT6URx.js +0 -189
- package/dist/assets/promotion-badge-B-er7bV2.js +0 -12
- package/dist/planner/planner-dashboard/planner-dashboard.css +0 -1
- package/dist/planner/planner-dashboard/planner-dashboard.min.js +0 -1
- package/dist/planner-banner/planner-banner.css +0 -1
- package/dist/planner-card-link/planner-card-link.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as
|
|
1
|
+
import{N as u,B as P}from"../assets/no-shadow-element-D62BBu0I.js";import{V as m}from"../assets/viewport-listener-DsRHfwo4.js";import{w as b,m as c}from"../assets/mealz-sdk-E_fNZM-c.js";import{s as f}from"../assets/skipWhile-Beza3ws3.js";import{t as l}from"../assets/take-CpvJwza7.js";import{f as h}from"../assets/filter-q99GWcpD.js";import"../assets/debounceTime-Cf_7YmIn.js";import"../assets/async-C5Kj_SqM.js";import"../assets/OperatorSubscriber-DfCnFunn.js";import"../assets/empty-qrpgDBbc.js";class n{constructor(){this.priceMemorized=new Map,this.displayedPrices=new Set,this.cleanupInterval=null,this.MAX_MEMO_SIZE=500,this.CLEANUP_INTERVAL=600*1e3,this.handlePageUnload=()=>{this.destroy()},this.startAutoCleanup(),this.setupPageUnloadListener()}static getInstance(){return n.instance||(n.instance=new n),n.instance}getMemorizedPrice(i,e){const s=`${i}-${e}`;return this.priceMemorized.get(s)}memorizedPrice(i,e,s){const r=`${i}-${e}`;this.priceMemorized.size>=this.MAX_MEMO_SIZE&&this.cleanOldPrices(),this.priceMemorized.set(r,{price:s,guests:e})}isPriceDisplayed(i,e){const s=`${i}-${e}`;return this.displayedPrices.has(s)}markPriceAsDisplayed(i,e){const s=`${i}-${e}`;this.displayedPrices.add(s)}cleanOldPrices(){this.priceMemorized.size>this.MAX_MEMO_SIZE*.8&&Array.from(this.priceMemorized.entries()).slice(0,Math.floor(this.priceMemorized.size*.3)).forEach(([s])=>{this.priceMemorized.delete(s),this.displayedPrices.delete(s)})}clearAllPrices(){this.priceMemorized.clear(),this.displayedPrices.clear()}destroy(){window.removeEventListener("beforeunload",this.handlePageUnload),this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null),this.priceMemorized.clear(),this.displayedPrices.clear(),n.instance=null}startAutoCleanup(){this.cleanupInterval=window.setInterval(()=>{this.cleanOldPrices()},this.CLEANUP_INTERVAL)}setupPageUnloadListener(){window.addEventListener("beforeunload",this.handlePageUnload)}}class I extends u{constructor(){super(...arguments),this.recipePricing=null,this.formattedPrice="",this.recipeId="",this.pricePerServe="",this.recipePricingValue=null,this.serves=0,this.posId="",this.extStoreId="",this.rendered=new P(!1),this.priceViewportObserver=null,this.priceFetched=!1,this.planner=!1,this.lastDisplayedRecipeId="",this.lastPlannerPrice=0,this.plannerPriceSubscription=null,this.lastAppliedPrice="",this.priceDisplayed=!1,this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.classList.add("re-rendering"),this.getInitialStatus(),this.listenInView(),b().then(()=>{this.setupSubscriptions()}).catch(i=>{console.warn("Failed to initialize SDK subscriptions:",i)}),requestAnimationFrame(()=>{this.classList.remove("re-rendering")})}disconnectedCallback(){var i;super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.plannerPriceSubscription&&(this.plannerPriceSubscription.unsubscribe(),this.plannerPriceSubscription=null),(i=this.priceViewportObserver)==null||i.disconnect()}setupSubscriptions(){const i=c;this.subscriptions.push(this.rendered.pipe(f(e=>!e),l(1)).subscribe(()=>{const e=i.basket.recipePricesInBasket$().subscribe(s=>{if(!s)return;const r=s.find(p=>p.id===this.recipeId);s.length>0&&r&&parseFloat(r.price)>0&&(this.serves=i.basket.guestsForRecipe(r.id),this.recipePricingValue={id:r.id,price:parseFloat(r.price),guests:this.serves},this.recalculatePrice(parseFloat(r.price),this.serves))});this.subscriptions.push(e)}),i.recipes.recipePriceUpdated().subscribe(e=>{e.recipeId===this.recipeId&&!e.inBasket&&this.recipePricingValue&&(this.recipePricingValue.price=e.remaining,this.recalculatePrice(e.remaining,this.serves))}),this.setupDisplayedRecipeSubscription(),this.setupGuestUpdatesSubscription(),this.setupMenuPriceSubscription())}setupDisplayedRecipeSubscription(){return c.recipes.displayedRecipe$.pipe(h(()=>this.planner&&!!this.recipeId)).subscribe(e=>{var s;((s=e==null?void 0:e.recipe)==null?void 0:s.id)===this.recipeId?(this.lastDisplayedRecipeId=this.recipeId,this.trackPlannerRecipePrice(),this.updateGuestCountFromMenu()):!(e!=null&&e.recipe)&&this.lastDisplayedRecipeId===this.recipeId&&(this.updatePriceFromCapturedPlannerPrice(),this.lastDisplayedRecipeId="",this.plannerPriceSubscription&&(this.plannerPriceSubscription.unsubscribe(),this.plannerPriceSubscription=null))})}setupGuestUpdatesSubscription(){return c.recipes.guestsUpdated().pipe(h(()=>!!this.recipeId)).subscribe(({guests:e,recipeId:s})=>{s===this.recipeId&&(this.serves=e,this.recipePricingValue&&this.recipePricingValue.price!==null&&this.recalculatePrice(this.recipePricingValue.price,this.serves))})}setupMenuPriceSubscription(){return c.planner.menuPrice$.pipe(h(()=>this.planner&&!!this.recipeId)).subscribe(()=>{if(this.lastPlannerPrice>0&&this.serves>0){const e=this.lastPlannerPrice/this.serves;this.applyCurrencyDisplay(e.toFixed(2))}})}fetchPrice(){const i=n.getInstance(),e=i.getMemorizedPrice(this.recipeId,this.serves);if(e){requestAnimationFrame(()=>{this.applyCurrencyDisplay(e.price),i.markPriceAsDisplayed(this.recipeId,this.serves)});return}this.fetchAndUpdatePrice()}render(){this.recipePricing=this.querySelector(".mealz-recipe-pricing"),this.recipePricing&&(this.recipeId&&this.pricePerServe&&n.getInstance().isPriceDisplayed(this.recipeId,this.serves)&&requestAnimationFrame(()=>{this.applyCurrencyDisplay(this.pricePerServe)}),this.rendered.next(!0),this.getInitialStatus())}getInitialStatus(){const i=this.attributes.getNamedItem("starting-data"),e=i==null?void 0:i.value;if(!e)return;const s=JSON.parse(e),{recipeId:r,extStoreId:p,posId:t,pricePerServe:a,serves:o,planner:d}=s;this.extStoreId=p||"",this.posId=t||"",this.recipeId=r,this.pricePerServe=(a==null?void 0:a.toString())??"",this.serves=o,this.planner=d||!1,this.recipePricingValue={id:this.recipeId,price:null,guests:this.serves},this.pricePerServe&&this.applyCurrencyDisplay(this.pricePerServe)}applyCurrencyDisplay(i){if(this.lastAppliedPrice===i)return;const e=parseFloat(i);isNaN(e)||(this.lastAppliedPrice=i,this.formattedPrice=e.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2}),this.recipePricing||(this.recipePricing=this.querySelector(".mealz-recipe-pricing")),this.updateDOM())}showPrice(){var s,r;if(this.priceDisplayed)return;const i=(s=this.recipePricing)==null?void 0:s.querySelector(".mealz-recipe-pricing__loading"),e=(r=this.recipePricing)==null?void 0:r.querySelector(".mealz-recipe-pricing__wrapper");i==null||i.classList.replace("active","hidden"),e==null||e.classList.replace("hidden","active"),this.priceDisplayed=!0}updateDOM(){var e;const i=(e=this.recipePricing)==null?void 0:e.querySelector(".mealz-recipe-pricing__wrapper__price");i&&(i.innerHTML=this.formattedPrice+" €",this.showPrice())}recalculatePrice(i,e){const s=(i/e).toString();this.applyCurrencyDisplay(s)}trackPlannerRecipePrice(){const i=c;this.plannerPriceSubscription&&(this.plannerPriceSubscription.unsubscribe(),this.plannerPriceSubscription=null),this.plannerPriceSubscription=i.planner.plannerRecipePrice$.subscribe(e=>{e>0&&(this.lastPlannerPrice=e)})}updateGuestCountFromMenu(){if(!this.planner||!this.recipeId)return;c.planner.getGuestsForRecipe(this.recipeId).pipe(l(1)).subscribe(e=>{e&&e>0&&(this.serves=e)})}updatePriceFromCapturedPlannerPrice(){if(!this.planner||!this.recipeId)return;c.planner.isRecipeInMenu$(this.recipeId).pipe(l(1)).subscribe(e=>{if(e&&this.lastPlannerPrice>0){if(this.serves>0){const s=this.lastPlannerPrice/this.serves;this.applyCurrencyDisplay(s.toFixed(2))}}else this.pricePerServe&&this.applyCurrencyDisplay(this.pricePerServe)})}listenInView(){this.priceViewportObserver=new m(this,()=>{var i;!this.priceFetched&&((i=this.recipePricingValue)==null?void 0:i.price)===null&&this.fetchPrice()})}fetchAndUpdatePrice(){const i=this.posId||this.extStoreId,e=!!this.extStoreId;if(!i||!this.recipeId||!this.serves)return;const p=c.recipes.fetchPricing(this.recipeId,i,this.serves,e).subscribe({next:t=>{t&&t["price-per-serve"]&&(this.pricePerServe=t["price-per-serve"].toString(),this.recipePricingValue={id:this.recipeId,price:t.price,guests:this.serves},this.recalculatePrice(t.price,this.serves),this.priceFetched=!0)},error:t=>{console.error("Failed to fetch recipe pricing:",t)}});this.subscriptions.push(p)}}customElements.get("mealz-recipe-pricing")||customElements.define("mealz-recipe-pricing",I);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{N as l}from"../assets/no-shadow-element-D62BBu0I.js";import{w as p,m as n}from"../assets/mealz-sdk-E_fNZM-c.js";import{G as h}from"../assets/guestObserver-C5qvv1Ll.js";import"../assets/singleton-COF3iBbF.js";class d extends l{constructor(){super(),this.plannerMode=!1,this.analyticsPath="",this.counterListener=t=>this.onCounterValueChange(t),this.guestObserverService=h.getInstance(),this.styleURL=new URL("./recipe-to-basket/recipe-to-basket.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.initializeFromStartingData(),this.addEventListener("valueChange",this.counterListener)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("valueChange",this.counterListener)}initializeFromStartingData(){const t=this.getAttribute("starting-data");if(t){try{const e=JSON.parse(t),s=typeof e.recipeId=="string"?e.recipeId:void 0,a=typeof e.guests=="number"?e.guests:void 0;this.plannerMode=!!e.planner,this.guests=a,s&&(this.analyticsPath=`/recipes/${s}/shopping`,p().then(()=>{var i,r;(r=(i=n)==null?void 0:i.recipes)==null||r.loadAndSetupRecipe(s,a).subscribe()}))}catch(e){console.warn("[mealz-recipe-to-basket] invalid starting-data attribute",e),this.removeAttribute("starting-data");return}this.removeAttribute("starting-data")}}onCounterValueChange(t){var i,r,o,c,u;const e=t.target;if(!(e!=null&&e.closest("mealz-counter")))return;const s=(i=t.detail)==null?void 0:i.value;if(typeof s!="number"||this.guests===s)return;this.guests=s,this.guestObserverService.updateGuests(this.guests);const a={originPath:this.analyticsPath,props:{}};this.plannerMode&&((o=(r=n)==null?void 0:r.planner)!=null&&o.updateGuests)?n.planner.updateGuests(this.guests,a):(u=(c=n)==null?void 0:c.recipes)==null||u.updateGuests(a,this.guests)}}customElements.get("mealz-recipe-to-basket")||customElements.define("mealz-recipe-to-basket",d);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import"../../assets/promotion-badge-
|
|
1
|
+
import"../../assets/promotion-badge-CDaL7Tqv.js";import{N as o,k as i}from"../../assets/no-shadow-element-D62BBu0I.js";import{n as m}from"../../assets/property-CoRN-Ln2.js";import{g as h,a as u}from"../../assets/price-utils-BRFZa-3D.js";import{m as n}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/price-D6RVRYHJ.js";import"../../assets/singleton-COF3iBbF.js";var z=Object.defineProperty,l=(d,e,s,p)=>{for(var t=void 0,a=d.length-1,r;a>=0;a--)(r=d[a])&&(t=r(e,s,t)||t);return t&&z(e,s,t),t};class c extends o{constructor(){super(),this.noSupplier=n.supplier.isNoSupplier(),this.subscriptions=[],this.styleURL=new URL("./replace-item/replace-item-card/replace-item-card.css",this.getBaseURL()),this.subscriptions.push(n.replaceItem.replaceItemLoading$.subscribe(e=>{this.replaceItemLoading=e,this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}onSelectItem(e){const s={detail:{item:e},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("selectItem",s))}render(){var e,s,p,t,a,r;return i`
|
|
2
2
|
<div
|
|
3
3
|
class="
|
|
4
4
|
mealz-replace-item-card
|
|
5
|
-
${((
|
|
5
|
+
${((s=(e=this.basketEntry)==null?void 0:e.selectedItem)==null?void 0:s.id)===this.itemWithPrice.item.id&&!this.ignoreSelected&&this.index===0?"selected":""}"
|
|
6
6
|
>
|
|
7
7
|
<mealz-promotion-badge
|
|
8
8
|
.priceData=${this.itemWithPrice.price}
|
|
@@ -37,24 +37,24 @@ ${((i=(e=this.basketEntry)==null?void 0:e.selectedItem)==null?void 0:i.id)===thi
|
|
|
37
37
|
<!-- PRODUCT PRICE -->
|
|
38
38
|
<mealz-price
|
|
39
39
|
class="mealz-replace-item__product-price mealz-ds-text size-m weight-xxl"
|
|
40
|
-
.oldPrice=${
|
|
41
|
-
.price=${
|
|
40
|
+
.oldPrice=${h(this.itemWithPrice.price)}
|
|
41
|
+
.price=${u(this.itemWithPrice.price)}>
|
|
42
42
|
</mealz-price>
|
|
43
43
|
<!-- PRODUCT CTA -->
|
|
44
44
|
<button
|
|
45
45
|
class="mealz-replace-item-card__cta mealz-ds-button small primary mealz-ds-text size-m weight-xl"
|
|
46
|
-
.disabled=${((
|
|
46
|
+
.disabled=${((t=(p=this.basketEntry)==null?void 0:p.selectedItem)==null?void 0:t.id)===this.itemWithPrice.item.id&&!this.ignoreSelected&&this.index===0}
|
|
47
47
|
@click=${()=>this.onSelectItem(this.itemWithPrice.item)}>
|
|
48
|
-
${this.replaceItemLoading===this.itemWithPrice.item?
|
|
49
|
-
${this.noSupplier?
|
|
48
|
+
${this.replaceItemLoading===this.itemWithPrice.item?i`<div class="mealz-ds-loader mealz-replace-item-card__loader"></div>`:i`<!-- NO SUPPLIER CTA LABEL -->
|
|
49
|
+
${this.noSupplier?i`<span>Ajouter</span>`:i`
|
|
50
50
|
<!-- WITH SUPPLIER CTA LABEL -->
|
|
51
|
-
${(
|
|
51
|
+
${(a=this.basketEntry)!=null&&a.selectedItem&&!this.ignoreSelected?i`
|
|
52
52
|
<div>
|
|
53
|
-
${this.index===0&&((
|
|
53
|
+
${this.index===0&&((r=this.basketEntry)==null?void 0:r.selectedItem.id)===this.itemWithPrice.item.id?i`<span>Dans le panier</span>`:i`<span>Remplacer</span>`}
|
|
54
54
|
</div>
|
|
55
|
-
`:
|
|
55
|
+
`:i`<span>Ajouter au panier</span>`}
|
|
56
56
|
`}`}
|
|
57
57
|
</button>
|
|
58
58
|
</div>
|
|
59
59
|
</div>
|
|
60
|
-
`}}
|
|
60
|
+
`}}l([m()],c.prototype,"itemWithPrice");l([m()],c.prototype,"index");l([m()],c.prototype,"basketEntry");l([m()],c.prototype,"ignoreSelected");customElements.get("mealz-replace-item-card")||customElements.define("mealz-replace-item-card",c);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import"./replace-item-card/replace-item-card.min.js";import{N as
|
|
1
|
+
import"./replace-item-card/replace-item-card.min.js";import{N as h,n as g,D as d,k as c}from"../assets/no-shadow-element-D62BBu0I.js";import{c as b}from"../assets/capitalize-DUAqYmp4.js";import{m as r}from"../assets/mealz-sdk-E_fNZM-c.js";import{G as _}from"../assets/guestObserver-C5qvv1Ll.js";import{m as z}from"../assets/merge-DzIA6T0M.js";import{m}from"../assets/map-DT-7dkaR.js";import{d as v}from"../assets/debounceTime-Cf_7YmIn.js";import{f}from"../assets/filter-q99GWcpD.js";import{d as I}from"../assets/distinctUntilChanged-kXqVrZ5h.js";import{s as S}from"../assets/switchMap-BAdE9Uzw.js";import"../assets/promotion-badge-CDaL7Tqv.js";import"../assets/property-CoRN-Ln2.js";import"../assets/price-D6RVRYHJ.js";import"../assets/singleton-COF3iBbF.js";import"../assets/price-utils-BRFZa-3D.js";import"../assets/mergeAll-DpEYIxY3.js";import"../assets/mergeMap-D2yctTHQ.js";import"../assets/innerFrom-DePszgj9.js";import"../assets/OperatorSubscriber-DfCnFunn.js";import"../assets/executeSchedule-CEDvgTzM.js";import"../assets/empty-qrpgDBbc.js";import"../assets/args-DAL2bHut.js";import"../assets/isScheduler-CqHuyMwD.js";import"../assets/from-D8c5akO7.js";import"../assets/async-C5Kj_SqM.js";class $ extends h{constructor(){super(),this.addProductMode=!1,this.fromRecipeDetails=!1,this.isLoading=!1,this.subscriptions=[],this.searchString="",this.itemsWithPricesList=[],this.searchSubject=new g,this.guestObserverService=_.getInstance(),this.initialGuests=1,this.currentGuests=1,this.styleURL=new URL("./replace-item/replace-item.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(this.setupSearchObservable(),r.replaceItem.basketEntryToReplace$.subscribe(e=>{this.handleToReplace(e)}),z(r.recipes.displayedRecipe$.pipe(m(e=>{var i,s,a,n;const t=(i=e==null?void 0:e.recipe)==null?void 0:i.id;if(t){this.currentRecipeId=t,this.fromRecipeDetails=!0;const l=((a=(s=e==null?void 0:e.recipe)==null?void 0:s.attributes)==null?void 0:a["number-of-guests"])||1,o=(n=e==null?void 0:e.recipe)==null?void 0:n.modifiedGuests;this.initialGuests=Number(l)||1,this.currentGuests=Number(o||l)||1,this.calculateQty()}})),r.replaceItem.replaceProductFromPreviewOpen$.pipe(m(e=>{e&&(this.basketEntry=e)})),r.replaceItem.additionModalOpen$.pipe(m(e=>{this.addProductMode=e})),r.replaceItem.itemsWithPricesList$.pipe(m(e=>{this.itemsWithPricesList=e})),r.replaceItem.fetchingItemLoading$.pipe(m(e=>{this.isLoading=e}))).subscribe(()=>this.requestUpdate()),this.guestObserverService.guests$.subscribe(e=>{this.currentGuests=Number(e)||this.currentGuests||1,this.calculateQty()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}handleToReplace(e){var i;if(this.searchString="",!e){this.basketEntry=void 0,this.ingredient=void 0,this.ignoreSelected=!1;return}this.basketEntry=e.basketEntry,this.ingredient=e.ingredient,this.ignoreSelected=e.ignoreSelected||!1,e.initialGuests&&(this.initialGuests=Number(e.initialGuests)||this.initialGuests),e.currentGuests&&(this.currentGuests=Number(e.currentGuests)||this.currentGuests);const t=this.basketEntry;if(t&&t.name&&!(t.attributes&&t.attributes.name)&&(t.attributes={...t.attributes||{},name:t.name}),this.ingredient&&(this.fromRecipeDetails=!0,!this.currentRecipeId)){const s=this.basketEntry,a=(s==null?void 0:s.recipesIds)&&s.recipesIds[0]||((i=s==null?void 0:s.attributes)==null?void 0:i["recipe-ids"])&&s.attributes["recipe-ids"][0];a&&(this.currentRecipeId=String(a))}this.calculateQty(),this.requestUpdate()}calculateQty(){var a,n,l;if(!this.ingredient)return;const e=((a=this.ingredient)==null?void 0:a.quantity)??((l=(n=this.ingredient)==null?void 0:n.attributes)==null?void 0:l.quantity),t=Number(e);if(!Number.isFinite(t))return;const i=this.initialGuests||1,s=t/i;this.modifiedIngQty=Number((s*(this.currentGuests||i)).toFixed(2))}onClose(){r.replaceItem.replaceItemLoading$.next(void 0),r.replaceItem.basketEntryToReplace$.next(void 0),r.productAddition.close()}onSearchInputChange(e){this.searchString=e.target.value,this.searchSubject.next(this.searchString)}setupSearchObservable(){return this.searchSubject.pipe(v(200),f(e=>e.length>=3),I(),S(e=>r.replaceItem.searchItem(e))).subscribe()}onSelectItem(e){var s;const t=(s=this.basketEntry)==null?void 0:s.id,i=this.fromRecipeDetails?`/recipes/${this.currentRecipeId}/shopping`:"/basket/products";r.replaceItem.onSelectItem(e.detail.item,this.searchString,()=>{this.onClose(),r.productAddition.productAdded$.next(t)},{originPath:`${i}/item-selector`,props:{}})}renderIssues(){var e,t;return c`
|
|
2
2
|
<!-- NO SUBSTITUTION PRODUCT -->
|
|
3
|
-
${!this.isLoading&&this.itemsWithPricesList.length===1&&!this.searchString?
|
|
3
|
+
${!this.isLoading&&this.itemsWithPricesList.length===1&&!this.searchString?c`
|
|
4
4
|
<div class="mealz-replace-item__error">
|
|
5
5
|
<div class="mealz-replace-item__error-image-container small-img">
|
|
6
6
|
<img class="mealz-replace-item__error-image"
|
|
@@ -16,7 +16,7 @@ import"./replace-item-card/replace-item-card.min.js";import{N as g,n as b,D as d
|
|
|
16
16
|
`:d}
|
|
17
17
|
|
|
18
18
|
<!-- NO PRODUCTS FOUND -->
|
|
19
|
-
${!this.addProductMode&&!this.isLoading&&this.itemsWithPricesList.length===0?
|
|
19
|
+
${!this.addProductMode&&!this.isLoading&&this.itemsWithPricesList.length===0?c`
|
|
20
20
|
<div class="mealz-replace-item__error">
|
|
21
21
|
<div class="mealz-replace-item__error-image-container">
|
|
22
22
|
<img class="mealz-replace-item__error-image"
|
|
@@ -28,7 +28,7 @@ import"./replace-item-card/replace-item-card.min.js";import{N as g,n as b,D as d
|
|
|
28
28
|
<span class="mealz-replace-item__issue-description mealz-ds-text weight-xxl"><span>Essayez avec un autre mot-clé</span></span>
|
|
29
29
|
</div>
|
|
30
30
|
`:d}
|
|
31
|
-
`}render(){var e,t,
|
|
31
|
+
`}render(){var e,t,i,s,a,n,l,o;return c`
|
|
32
32
|
<div class="mealz-replace-item">
|
|
33
33
|
<!-- HEADER -->
|
|
34
34
|
<div class="mealz-replace-item__header mealz-ds-text weight-xxl">
|
|
@@ -40,7 +40,7 @@ import"./replace-item-card/replace-item-card.min.js";import{N as g,n as b,D as d
|
|
|
40
40
|
class="mealz-replace-item__back-button-icon"
|
|
41
41
|
>
|
|
42
42
|
</button>
|
|
43
|
-
${(e=this.basketEntry)!=null&&e.selectedItem&&!this.ignoreSelected&&!this.addProductMode?
|
|
43
|
+
${(e=this.basketEntry)!=null&&e.selectedItem&&!this.ignoreSelected&&!this.addProductMode?c`<span>Remplacer un produit</span>`:c`<span>Ajouter un produit</span>`}
|
|
44
44
|
</div>
|
|
45
45
|
<div class="mealz-replace-item__top-container">
|
|
46
46
|
<!-- SEARCH -->
|
|
@@ -57,12 +57,12 @@ import"./replace-item-card/replace-item-card.min.js";import{N as g,n as b,D as d
|
|
|
57
57
|
<div class="mealz-ds-loader ${this.isLoading?"":"hidden"}"></div>
|
|
58
58
|
</div>
|
|
59
59
|
<!-- PRODUCT NEEDED BANNER -->
|
|
60
|
-
${this.fromRecipeDetails?
|
|
60
|
+
${this.fromRecipeDetails?c`
|
|
61
61
|
<div class="mealz-replace-item__product-banner">
|
|
62
62
|
<span class="mealz-replace-item__banner-product-name mealz-ds-text size-s">
|
|
63
|
-
<span>${
|
|
63
|
+
<span>${b(((i=(t=this.basketEntry)==null?void 0:t.attributes)==null?void 0:i.name)||"")} :</span>
|
|
64
64
|
<span class="mealz-replace-item__banner-quantity mealz-ds-text weight-xxl">
|
|
65
|
-
${this.modifiedIngQty||((s=this.ingredient)==null?void 0:s.quantity)||((
|
|
65
|
+
${this.modifiedIngQty||((s=this.ingredient)==null?void 0:s.quantity)||((n=(a=this.ingredient)==null?void 0:a.attributes)==null?void 0:n.quantity)} ${(o=(l=this.ingredient)==null?void 0:l.attributes)==null?void 0:o.unit}
|
|
66
66
|
</span>
|
|
67
67
|
</span>
|
|
68
68
|
</div>
|
|
@@ -71,10 +71,10 @@ import"./replace-item-card/replace-item-card.min.js";import{N as g,n as b,D as d
|
|
|
71
71
|
<!-- PRODUCT LIST GRID -->
|
|
72
72
|
<div class="mealz-replace-item__product-list ${this.itemsWithPricesList.length<2?"full-width":""}">
|
|
73
73
|
<!-- PRODUCT CARD -->
|
|
74
|
-
${this.itemsWithPricesList.map((p
|
|
74
|
+
${this.itemsWithPricesList.map((u,p)=>c`
|
|
75
75
|
<mealz-replace-item-card
|
|
76
|
-
.itemWithPrice=${
|
|
77
|
-
.index=${
|
|
76
|
+
.itemWithPrice=${u}
|
|
77
|
+
.index=${p}
|
|
78
78
|
.basketEntry=${this.basketEntry}
|
|
79
79
|
.ignoreSelected=${!!this.ignoreSelected}
|
|
80
80
|
@selectItem=${this.onSelectItem}
|
|
@@ -82,7 +82,7 @@ import"./replace-item-card/replace-item-card.min.js";import{N as g,n as b,D as d
|
|
|
82
82
|
<!-- ISSUES -->
|
|
83
83
|
${this.renderIssues()}
|
|
84
84
|
<!-- ADD PRODUCT DEFAULT VIEW -->
|
|
85
|
-
${this.addProductMode&&!this.isLoading&&this.itemsWithPricesList.length===0?
|
|
85
|
+
${this.addProductMode&&!this.isLoading&&this.itemsWithPricesList.length===0?c`
|
|
86
86
|
<div class="mealz-replace-item__add-product-default">
|
|
87
87
|
<div class="mealz-replace-item__add-product-image-container">
|
|
88
88
|
<img class="mealz-replace-item__add-product-image"
|
|
@@ -93,4 +93,4 @@ import"./replace-item-card/replace-item-card.min.js";import{N as g,n as b,D as d
|
|
|
93
93
|
</div>`:d}
|
|
94
94
|
</div>
|
|
95
95
|
</div>
|
|
96
|
-
`}}
|
|
96
|
+
`}}customElements.get("mealz-replace-item")||customElements.define("mealz-replace-item",$);
|
package/dist/replace-item-planner/replace-item-card-planner/replace-item-card-planner.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../assets/promotion-badge-
|
|
1
|
+
import"../../assets/promotion-badge-CDaL7Tqv.js";import{N as n,k as t}from"../../assets/no-shadow-element-D62BBu0I.js";import{n as m}from"../../assets/property-CoRN-Ln2.js";import{g as d,a as o}from"../../assets/price-utils-BRFZa-3D.js";import{m as h}from"../../assets/mealz-sdk-E_fNZM-c.js";import"../../assets/price-D6RVRYHJ.js";import"../../assets/singleton-COF3iBbF.js";var u=Object.defineProperty,p=(a,i,l,z)=>{for(var e=void 0,r=a.length-1,c;r>=0;r--)(c=a[r])&&(e=c(i,l,e)||e);return e&&u(i,l,e),e};class s extends n{constructor(){super(),this.noSupplier=h.supplier.isNoSupplier(),this.styleURL=new URL("./replace-item-planner/replace-item-card-planner/replace-item-card-planner.css",this.getBaseURL())}onSelectItem(){this.itemWithPrice.status="ticked";const i={detail:{itemWithPrice:this.itemWithPrice},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("selectItem",i)),this.requestUpdate()}render(){return t`
|
|
2
2
|
<div class=" mealz-replace-item-card-planner
|
|
3
3
|
${this.itemWithPrice.status==="ticked"?"selected":""}"
|
|
4
4
|
>
|
|
@@ -35,8 +35,8 @@ import"../../assets/promotion-badge-B-er7bV2.js";import{N as d,k as t}from"../..
|
|
|
35
35
|
<!-- PRODUCT PRICE -->
|
|
36
36
|
<mealz-price
|
|
37
37
|
class="mealz-replace-item__product-price mealz-ds-text size-m weight-xxl"
|
|
38
|
-
.oldPrice=${
|
|
39
|
-
.price=${
|
|
38
|
+
.oldPrice=${d(this.itemWithPrice.price)}
|
|
39
|
+
.price=${o(this.itemWithPrice.price)}>
|
|
40
40
|
</mealz-price>
|
|
41
41
|
<!-- PRODUCT CTA -->
|
|
42
42
|
<button
|
|
@@ -53,4 +53,4 @@ import"../../assets/promotion-badge-B-er7bV2.js";import{N as d,k as t}from"../..
|
|
|
53
53
|
</button>
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
|
-
`}}
|
|
56
|
+
`}}p([m()],s.prototype,"itemWithPrice");p([m()],s.prototype,"index");customElements.get("mealz-replace-item-card-planner")||customElements.define("mealz-replace-item-card-planner",s);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as
|
|
1
|
+
import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as c,n as o,D as l,k as s}from"../assets/no-shadow-element-D62BBu0I.js";import{c as h}from"../assets/capitalize-DUAqYmp4.js";import{m as i}from"../assets/mealz-sdk-E_fNZM-c.js";import{m as d}from"../assets/merge-DzIA6T0M.js";import{m as r}from"../assets/map-DT-7dkaR.js";import{d as u}from"../assets/debounceTime-Cf_7YmIn.js";import{f as g}from"../assets/filter-q99GWcpD.js";import{d as _}from"../assets/distinctUntilChanged-kXqVrZ5h.js";import{s as b}from"../assets/switchMap-BAdE9Uzw.js";import"../assets/promotion-badge-CDaL7Tqv.js";import"../assets/property-CoRN-Ln2.js";import"../assets/price-D6RVRYHJ.js";import"../assets/singleton-COF3iBbF.js";import"../assets/price-utils-BRFZa-3D.js";import"../assets/mergeAll-DpEYIxY3.js";import"../assets/mergeMap-D2yctTHQ.js";import"../assets/innerFrom-DePszgj9.js";import"../assets/OperatorSubscriber-DfCnFunn.js";import"../assets/executeSchedule-CEDvgTzM.js";import"../assets/empty-qrpgDBbc.js";import"../assets/args-DAL2bHut.js";import"../assets/isScheduler-CqHuyMwD.js";import"../assets/from-D8c5akO7.js";import"../assets/async-C5Kj_SqM.js";class z extends c{constructor(){super(),this.isLoading=!1,this.subscriptions=[],this.searchString="",this.itemsWithPricesList=[],this.analyticsPath="/meals-planner/current",this.searchSubject=new o,this.styleURL=new URL("./replace-item-planner/replace-item-planner.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.subscriptions.push(this.setupSearchObservable(),i.planner.itemToReplace$.subscribe(e=>{this.handleToReplace(e)}),d(i.recipes.displayedRecipe$.pipe(r(e=>{var t;this.currentRecipeId=(t=e==null?void 0:e.recipe)==null?void 0:t.id})),i.planner.itemsWithPricesList$.pipe(r(e=>{this.itemsWithPricesList=e})),i.planner.fetchingItemLoading$.pipe(r(e=>{this.isLoading=e}))).subscribe(()=>{this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}handleToReplace(e){if(this.searchString="",!e){this.item=void 0,this.ingredient=void 0;return}this.item=e.item,this.ingredient=e.ingredient,this.requestUpdate()}onClose(){i.planner.itemToReplace$.next(void 0)}onSearchInputChange(e){this.searchString=e.target.value,this.searchSubject.next(this.searchString)}setupSearchObservable(){return this.searchSubject.pipe(u(200),g(e=>e.length>=3),_(),b(e=>i.planner.searchItem(e,this.ingredient,this.item))).subscribe()}onSelectItem(e){this.replacedItemEvent(e.detail.itemWithPrice),i.planner.replaceProduct(e.detail.itemWithPrice),this.item=e.detail.itemWithPrice.item,this.onClose()}formatNumber(e){const t=i.user.getLanguage()||"fr";return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:2}).format(e)}renderIssues(){var e,t;return s`
|
|
2
2
|
<!-- NO SUBSTITUTION PRODUCT -->
|
|
3
|
-
${!this.isLoading&&this.itemsWithPricesList.length===1&&!this.searchString?
|
|
3
|
+
${!this.isLoading&&this.itemsWithPricesList.length===1&&!this.searchString?s`
|
|
4
4
|
<div class="mealz-replace-item-planner__error">
|
|
5
5
|
<div class="mealz-replace-item-planner__error-image-container small-img">
|
|
6
6
|
<img class="mealz-replace-item-planner__error-image"
|
|
@@ -14,10 +14,10 @@ import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as
|
|
|
14
14
|
<span>Aucun produit de substitution trouvé</span>
|
|
15
15
|
</span>
|
|
16
16
|
</div>
|
|
17
|
-
`:
|
|
17
|
+
`:l}
|
|
18
18
|
|
|
19
19
|
<!-- NO PRODUCTS FOUND -->
|
|
20
|
-
${!this.isLoading&&this.itemsWithPricesList.length===0?
|
|
20
|
+
${!this.isLoading&&this.itemsWithPricesList.length===0?s`
|
|
21
21
|
<div class="mealz-replace-item-planner__error">
|
|
22
22
|
<div class="mealz-replace-item-planner__error-image-container">
|
|
23
23
|
<img class="mealz-replace-item-planner__error-image"
|
|
@@ -29,8 +29,8 @@ import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as
|
|
|
29
29
|
class="mealz-replace-item-planner__issue-title mealz-replace-item-planner__issue-title__not-found mealz-ds-text"><span>Aucun produit trouvé pour cette recherche</span></span>
|
|
30
30
|
<span class="mealz-replace-item-planner__issue-description mealz-ds-text weight-xxl"><span>Essayez avec un autre mot-clé</span></span>
|
|
31
31
|
</div>
|
|
32
|
-
`:
|
|
33
|
-
`}render(){var e,t,
|
|
32
|
+
`:l}
|
|
33
|
+
`}render(){var e,t,a,n;return s`
|
|
34
34
|
<div class="mealz-replace-item-planner">
|
|
35
35
|
<!-- HEADER -->
|
|
36
36
|
<div class="mealz-replace-item-planner__header mealz-ds-text weight-xxl">
|
|
@@ -42,7 +42,7 @@ import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as
|
|
|
42
42
|
class="mealz-replace-item-planner__back-button-icon"
|
|
43
43
|
>
|
|
44
44
|
</button>
|
|
45
|
-
${this.item?
|
|
45
|
+
${this.item?s`<span>Ajouter un produit</span>`:s`<span>Remplacer un produit</span>`}
|
|
46
46
|
</div>
|
|
47
47
|
<div class="mealz-replace-item-planner__top-container">
|
|
48
48
|
<!-- SEARCH -->
|
|
@@ -62,9 +62,9 @@ import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as
|
|
|
62
62
|
|
|
63
63
|
<div class="mealz-replace-item-planner__product-banner">
|
|
64
64
|
<span class="mealz-replace-item-planner__banner-product-name mealz-ds-text size-s">
|
|
65
|
-
<span>${
|
|
65
|
+
<span>${h(((t=(e=this.ingredient)==null?void 0:e.attributes)==null?void 0:t.name)||"")} :</span>
|
|
66
66
|
<span class="mealz-replace-item-planner__banner-quantity mealz-ds-text weight-xxl">
|
|
67
|
-
${this.formatNumber(+((
|
|
67
|
+
${this.formatNumber(+((a=this.ingredient)==null?void 0:a.attributes.quantity))}
|
|
68
68
|
${(n=this.ingredient)==null?void 0:n.attributes.unit}
|
|
69
69
|
</span>
|
|
70
70
|
</span>
|
|
@@ -74,14 +74,14 @@ import"./replace-item-card-planner/replace-item-card-planner.min.js";import{N as
|
|
|
74
74
|
<div
|
|
75
75
|
class="mealz-replace-item-planner__product-list ${this.itemsWithPricesList.length<2?"full-width":""}">
|
|
76
76
|
<!-- PRODUCT CARD -->
|
|
77
|
-
${this.itemsWithPricesList.map((
|
|
77
|
+
${this.itemsWithPricesList.map((m,p)=>s`
|
|
78
78
|
<mealz-replace-item-card-planner
|
|
79
|
-
.itemWithPrice=${
|
|
80
|
-
.index=${
|
|
79
|
+
.itemWithPrice=${m}
|
|
80
|
+
.index=${p}
|
|
81
81
|
@selectItem=${this.onSelectItem}
|
|
82
82
|
></mealz-replace-item-card-planner>`)}
|
|
83
83
|
<!-- ISSUES -->
|
|
84
84
|
${this.renderIssues()}
|
|
85
85
|
</div>
|
|
86
86
|
</div>
|
|
87
|
-
`}replacedItemEvent(e){var t,
|
|
87
|
+
`}replacedItemEvent(e){var t,a;i.analytics.sendEvent("planner.item.replaced",this.analyticsPath,{recipe_id:this.currentRecipeId,new_item_id:(t=e==null?void 0:e.item)==null?void 0:t.id,old_item_id:(a=this.item)==null?void 0:a.id})}}customElements.get("mealz-replace-item-planner")||customElements.define("mealz-replace-item-planner",z);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as
|
|
1
|
+
import{N as r,k as o}from"../assets/no-shadow-element-D62BBu0I.js";import{n}from"../assets/property-CoRN-Ln2.js";import{r as h}from"../assets/state-DDIoBQp5.js";import"../assets/mealz-sdk-E_fNZM-c.js";var u=Object.defineProperty,a=(c,e,l,t)=>{for(var s=void 0,p=c.length-1,d;p>=0;p--)(d=c[p])&&(s=d(e,l,s)||s);return s&&u(e,l,s),s};class i extends r{constructor(){super(),this.options=[],this.value="",this.placeholder="",this.disabled=!1,this._open=!1,this._onWindowClick=e=>{e.composedPath().includes(this)||this._open&&(this._open=!1,this.requestUpdate())},this.styleURL=new URL("./select/select.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this._attachOutsideClick()}disconnectedCallback(){this._detachOutsideClick(),super.disconnectedCallback()}render(){const e=this.options.find(t=>t.id===this.value),l=(e==null?void 0:e.label)||this.placeholder||"";return o`
|
|
2
2
|
<div class="mealz-select">
|
|
3
3
|
<button
|
|
4
4
|
type="button"
|
|
@@ -8,7 +8,7 @@ import{N as d,k as n}from"../assets/no-shadow-element-D62BBu0I.js";import{t as h
|
|
|
8
8
|
aria-expanded="${this._open?"true":"false"}"
|
|
9
9
|
@click="${()=>this._toggle()}"
|
|
10
10
|
>
|
|
11
|
-
<span>${
|
|
11
|
+
<span>${l}</span>
|
|
12
12
|
<img
|
|
13
13
|
src="https://storage.googleapis.com/assets.miam.tech/generic/icons/Caret.svg"
|
|
14
14
|
alt="caret"
|
|
@@ -16,9 +16,9 @@ import{N as d,k as n}from"../assets/no-shadow-element-D62BBu0I.js";import{t as h
|
|
|
16
16
|
/>
|
|
17
17
|
</button>
|
|
18
18
|
|
|
19
|
-
${this._open?
|
|
19
|
+
${this._open?o`
|
|
20
20
|
<div class="mealz-select__menu">
|
|
21
|
-
${this.options.map(t=>
|
|
21
|
+
${this.options.map(t=>o`
|
|
22
22
|
<button
|
|
23
23
|
type="button"
|
|
24
24
|
class="mealz-select__option"
|
|
@@ -29,6 +29,6 @@ import{N as d,k as n}from"../assets/no-shadow-element-D62BBu0I.js";import{t as h
|
|
|
29
29
|
</button>
|
|
30
30
|
`)}
|
|
31
31
|
</div>
|
|
32
|
-
`:
|
|
32
|
+
`:o``}
|
|
33
33
|
</div>
|
|
34
|
-
`}_toggle(){this.disabled||(this._open=!this._open,this.requestUpdate())}_select(e){this.value=e.id,this._open=!1,this.dispatchEvent(new CustomEvent("valueChange",{detail:{value:e.id,label:e.label},bubbles:!0,composed:!0})),this.requestUpdate()}_attachOutsideClick(){window.addEventListener("click",this._onWindowClick,{passive:!0})}_detachOutsideClick(){window.removeEventListener("click",this._onWindowClick)}}
|
|
34
|
+
`}_toggle(){this.disabled||(this._open=!this._open,this.requestUpdate())}_select(e){this.value=e.id,this._open=!1,this.dispatchEvent(new CustomEvent("valueChange",{detail:{value:e.id,label:e.label},bubbles:!0,composed:!0})),this.requestUpdate()}_attachOutsideClick(){window.addEventListener("click",this._onWindowClick,{passive:!0})}_detachOutsideClick(){window.removeEventListener("click",this._onWindowClick)}}a([n({type:Array})],i.prototype,"options");a([n({type:String})],i.prototype,"value");a([n({type:String})],i.prototype,"placeholder");a([n({type:Boolean})],i.prototype,"disabled");a([h()],i.prototype,"_open");customElements.get("mealz-select")||customElements.define("mealz-select",i);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import"../store-locator/store-locator.min.js";import{N as
|
|
1
|
+
import"../store-locator/store-locator.min.js";import{N as h,k as n}from"../assets/no-shadow-element-D62BBu0I.js";import{n as c}from"../assets/property-CoRN-Ln2.js";import"../assets/state-DDIoBQp5.js";import"../assets/query-BApjzB0v.js";import"../assets/mealz-sdk-E_fNZM-c.js";var o=Object.defineProperty,p=Object.getOwnPropertyDescriptor,b=(a,e,t,l)=>{for(var s=l>1?void 0:l?p(e,t):e,i=a.length-1,d;i>=0;i--)(d=a[i])&&(s=(l?d(e,t,s):d(s))||s);return l&&s&&o(e,t,s),s};class r extends h{constructor(){super(),this._selectedTabIndex=0,this.styleURL=new URL("./slider-tabs/slider-tabs.css",this.getBaseURL())}get selectedTabIndex(){return this._selectedTabIndex}set selectedTabIndex(e){this._selectedTabIndex!==e&&(this._selectedTabIndex=e,this.sliderElement&&this.updateSlider())}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){this.sliderElement=this.querySelector(".mealz-slider-tab__background"),this.updateSlider()}render(){return n`
|
|
2
2
|
<div class="mealz-slider-tabs">
|
|
3
|
-
${this.tabs.map((e,t)=>
|
|
3
|
+
${this.tabs.map((e,t)=>n`
|
|
4
4
|
<button
|
|
5
5
|
@click="${()=>this.selectTab(t)}"
|
|
6
6
|
class="mealz-slider-tab ${t===this.selectedTabIndex?"active":""}">
|
|
@@ -11,4 +11,4 @@ import"../store-locator/store-locator.min.js";import{N as o,k as c}from"../asset
|
|
|
11
11
|
`)}
|
|
12
12
|
<div class="mealz-slider-tab__background"></div>
|
|
13
13
|
</div>
|
|
14
|
-
`}selectTab(e){if(e===this.selectedTabIndex)return;this.selectedTabIndex=e;const t={detail:{selectedTab:e},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("tabChanged",t)),this.requestUpdate()}updateSlider(){var e,t;this.sliderElement&&(this.sliderElement.style.width=`calc(${100/((e=this.tabs)==null?void 0:e.length)}% - 8px)`,this.sliderElement.style.marginLeft=`${this.selectedTabIndex*100/((t=this.tabs)==null?void 0:t.length)}%`,this.requestUpdate())}}
|
|
14
|
+
`}selectTab(e){if(e===this.selectedTabIndex)return;this.selectedTabIndex=e;const t={detail:{selectedTab:e},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("tabChanged",t)),this.requestUpdate()}updateSlider(){var e,t;this.sliderElement&&(this.sliderElement.style.width=`calc(${100/((e=this.tabs)==null?void 0:e.length)}% - 8px)`,this.sliderElement.style.marginLeft=`${this.selectedTabIndex*100/((t=this.tabs)==null?void 0:t.length)}%`,this.requestUpdate())}}b([c({type:Array})],r.prototype,"tabs",2);b([c({type:Number})],r.prototype,"selectedTabIndex",1);customElements.get("mealz-slider-tabs")||customElements.define("mealz-slider-tabs",r);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../store-locator/store-locator.min.js";import{N as
|
|
1
|
+
import"../store-locator/store-locator.min.js";import{N as l,D as c,k as p}from"../assets/no-shadow-element-D62BBu0I.js";import{n as d}from"../assets/property-CoRN-Ln2.js";import{m as o}from"../assets/mealz-sdk-E_fNZM-c.js";import"../assets/state-DDIoBQp5.js";import"../assets/query-BApjzB0v.js";var m=Object.defineProperty,u=(s,e,r,h)=>{for(var t=void 0,a=s.length-1,i;a>=0;a--)(i=s[a])&&(t=i(e,r,t)||t);return t&&m(e,r,t),t};class n extends l{constructor(){super(),this.analyticsPath="",this.subscriptions=[],this.styleURL=new URL("./store-indicator/store-indicator.css",this.getBaseURL())}connectedCallback(){super.connectedCallback(),this.setCurrentPosLabel()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){return this.currentPosLabel?p`
|
|
2
2
|
<div class="mealz-store-indicator">
|
|
3
3
|
<span class="mealz-store-indicator__pos-label mealz-ds-text weight-xl">
|
|
4
4
|
${this.currentPosLabel}
|
|
@@ -11,4 +11,4 @@ import"../store-locator/store-locator.min.js";import{N as p,D as m,k as u}from".
|
|
|
11
11
|
<span class="mealz-store-indicator__swap-pos-label mealz-ds-text size-s weight-l">Changer</span>
|
|
12
12
|
</button>
|
|
13
13
|
</div>
|
|
14
|
-
`:
|
|
14
|
+
`:c}setCurrentPosLabel(){this.subscriptions.push(o.pos.currentPos().subscribe(e=>{e?this.currentPosLabel=e.relationships.supplier.data.attributes.name+" - "+e.attributes.name:this.currentPosLabel=" - ",this.requestUpdate()}))}openDrawer(){const e=document.querySelector("mealz-drawer-view-swapper");e&&(e.displayStoreLocator$.next(!0),this.sendLocatorDisplayEvent())}sendLocatorDisplayEvent(){o.analytics.sendEvent("locator.display",this.analyticsPath,{})}}u([d({type:String})],n.prototype,"analyticsPath");customElements.get("mealz-store-indicator")||customElements.define("mealz-store-indicator",n);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as
|
|
1
|
+
import{N as m,k as a}from"../assets/no-shadow-element-D62BBu0I.js";import{n as d}from"../assets/property-CoRN-Ln2.js";import{r as _}from"../assets/state-DDIoBQp5.js";import{e as u}from"../assets/query-BApjzB0v.js";import{a as h}from"../assets/mealz-sdk-E_fNZM-c.js";class f{get extId(){return this.attributes["ext-id"]}}var g=Object.defineProperty,b=Object.getOwnPropertyDescriptor,n=(c,t,e,s)=>{for(var i=s>1?void 0:s?b(t,e):t,o=c.length-1,l;o>=0;o--)(l=c[o])&&(i=(s?l(t,e,i):l(i))||i);return s&&i&&g(t,e,i),i};class r extends m{constructor(){var t,e,s,i,o,l;super(),this.selectedRadius=50,this.getByAddress=(e=(t=h)==null?void 0:t.pos)==null?void 0:e.getByAddress,this.getByCoordinates=(i=(s=h)==null?void 0:s.pos)==null?void 0:i.getByCoordinates,this.getAffiliateSuppliers=(l=(o=h)==null?void 0:o.supplier)==null?void 0:l.getAffiliateSuppliers,this._show=!1,this._posList=[],this._suppliers=[],this._markers=[],this._searchingPos=!1,this._searchSubmitted=!1,this._prevAddress="",this._selectedSuppliers=[],this._showPosList=!1,this._posSelected=!1,this.subscriptions=[],this.styleURL=new URL("/store-locator.css",import.meta.url)}get show(){return this._show}set show(t){this._show=t,this._show&&(this._posSelected=!1,this.initialSearch(),this._map&&this.ensureMapSize())}set geolocationCoordinates(t){var e,s;this._geolocationCoordinates=t,typeof((e=t==null?void 0:t.coords)==null?void 0:e.latitude)=="number"&&typeof((s=t==null?void 0:t.coords)==null?void 0:s.longitude)=="number"&&this.setGeolocation()}get geolocationCoordinates(){return this._geolocationCoordinates}getMapContainer(){var e;const t=this._mapElement??((e=this.querySelector)==null?void 0:e.call(this,"#mealz-store-locator__map"));return t instanceof HTMLElement?t:null}_nameOfStore(t){return`${t.supplier.attributes.name} - ${t.attributes.name}`}connectedCallback(){super.connectedCallback(),this.initLeaflet(),this.initEvents(),this.initResizeObserver()}disconnectedCallback(){var t,e,s;this.subscriptions.forEach(i=>i.unsubscribe()),this._resizeObserver&&this._resizeObserver.disconnect(),super.disconnectedCallback(),this._map&&(this._map.off(),this._map.remove(),this._map=void 0),(t=this._leafletCss)==null||t.remove(),(e=this._miamDs)==null||e.remove(),(s=this._leafletJs)==null||s.remove()}firstUpdated(){this._posSelected=!1,this.loadMap(),this.geolocationTimeout(),this.listenFormSubmit(),this._map&&this.ensureMapSize()}render(){return this.show?this.posSelectionTemplate():a``}posSelectionTemplate(){return a`
|
|
2
2
|
<div class="mealz-store-locator mealz-ds-body">
|
|
3
3
|
<div class="mealz-store-locator__pos-selection">
|
|
4
4
|
<button
|
|
@@ -94,4 +94,4 @@ import{N as u,k as a}from"../assets/no-shadow-element-D62BBu0I.js";import{t as m
|
|
|
94
94
|
</button>
|
|
95
95
|
</div>
|
|
96
96
|
</div>
|
|
97
|
-
`});this._markers[e].bindPopup(s).on("popupopen",i=>{var
|
|
97
|
+
`});this._markers[e].bindPopup(s).on("popupopen",i=>{var l,p;const o=(l=i.target.getPopup())==null?void 0:l.getElement();(p=o==null?void 0:o.querySelector("#mealz-select"))==null||p.addEventListener("click",()=>{this.dispatchPos(t)})})})}buildIcon(t){return window.L.icon({iconUrl:t.attributes.logo||"https://cdn-icons-png.flaticon.com/512/3515/3515146.png",shadowUrl:"https://storage.googleapis.com/assets.miam.tech/mealz-components/store-locator/marker.svg",iconSize:[24,24],shadowSize:[44,53],iconAnchor:[16,43],shadowAnchor:[22,45],popupAnchor:[0,-55],className:"mealz-marker-icon"})}togglePosList(t){this._showPosList=!t;const e=document.getElementById("mealz-store-locator__pos-list"),s={bubbles:!0,composed:!0};e&&(t?(e.style.display="none",this.dispatchEvent(new CustomEvent("mapSelected",s))):(e.style.display="flex",this.dispatchEvent(new CustomEvent("listSelected",s))),this.requestUpdate())}geolocationTimeout(){setTimeout(()=>{this.geolocationCoordinates===void 0&&(this.geolocationCoordinates={})},2e4)}listenFormSubmit(){const t=document.getElementById("mealz-store-locator__store-locator-form");t&&t.addEventListener("submit",e=>{e.preventDefault(),this.setAddress()})}setSupplier(){const t=localStorage.getItem("_miam/selectedSupplierId");t&&(this._selectedSuppliers=[t])}dispatchPos(t){this._posSelected=!0,this.requestUpdate();const e={detail:{posId:t.id,posExtId:t.extId,supplierId:t.supplier.id,supplierName:t.supplier.attributes.name,posName:this._nameOfStore(t)},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("posIdChange",e))}resetPosSelection(){this._posSelected&&(this._posSelected=!1,this.requestUpdate())}dispatchSearch(t,e){const s={detail:{searchTerm:t,storesFoundCount:e},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("searchChange",s))}}n([d({type:Number})],r.prototype,"selectedRadius",2);n([d()],r.prototype,"getByAddress",2);n([d()],r.prototype,"getByCoordinates",2);n([d()],r.prototype,"getAffiliateSuppliers",2);n([d({type:Boolean})],r.prototype,"show",1);n([d({attribute:!1})],r.prototype,"geolocationCoordinates",1);n([_()],r.prototype,"_geolocationCoordinates",2);n([u("input")],r.prototype,"_addressInput",2);n([u("#mealz-store-locator__map")],r.prototype,"_mapElement",2);customElements.get("mealz-store-locator")||customElements.define("mealz-store-locator",r);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{N as
|
|
1
|
+
import{N as a,k as r}from"../assets/no-shadow-element-D62BBu0I.js";import{m as t}from"../assets/mealz-sdk-E_fNZM-c.js";import{s as i}from"../assets/skipWhile-Beza3ws3.js";import{s as n}from"../assets/switchMap-BAdE9Uzw.js";import{m as l}from"../assets/map-DT-7dkaR.js";import{f as d}from"../assets/filter-q99GWcpD.js";import"../assets/OperatorSubscriber-DfCnFunn.js";import"../assets/innerFrom-DePszgj9.js";class c extends a{constructor(){super(...arguments),this.analyticsPath="/locator",this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.listenToDrawerViewSwapper(),this.listenToCloseEvent(),this.listenToUserCoordinates()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}render(){return r`
|
|
2
2
|
<!-- NEED TO SET REAL VALUE TO .SHOW CONTINUE HERE -->
|
|
3
3
|
<mealz-store-locator
|
|
4
4
|
.show="${!0}"
|
|
@@ -7,4 +7,4 @@ import{N as c,k as i}from"../assets/no-shadow-element-D62BBu0I.js";import{t as p
|
|
|
7
7
|
@searchChange=${e=>this.sendSearchEvent(e)}
|
|
8
8
|
@showChange=${()=>this.navigateBack()}
|
|
9
9
|
></mealz-store-locator>
|
|
10
|
-
`}listenToUserCoordinates(){var e,
|
|
10
|
+
`}listenToUserCoordinates(){var e,s;(s=(e=window.mealzInternal)==null?void 0:e.user)!=null&&s.userCoordinates$&&this.subscriptions.push(window.mealzInternal.user.userCoordinates$.subscribe(o=>{this.hostCoordinates=o,this.requestUpdate()}))}shouldDisplayOnboarding(){const e=sessionStorage.getItem("_miam/noSupplier/onboarding")==="was-closed",s=document.querySelector("mealz-drawer-view-swapper");return!e&&!!(s!=null&&s.displayStoreLocator$.value)}displayOnboardingModal(){const e=document.createElement("mealz-modal");e.titleSlot=r`<span class="mealz-no-supplier-onboarding__badge mealz-ds-badge size-l">NOUVEAU !</span>`,e.contentSlot=r`<mealz-no-supplier-onboarding></mealz-no-supplier-onboarding>`,document.body.appendChild(e)}changePosAndSupplier(e){const s=t.pos.currentPos().value;if((s==null?void 0:s.id)===e.detail.posId){this.closeStoreLocator();return}this.selectedPosId=e.detail.posId,localStorage.setItem("_miam/noSupplier/posId",this.selectedPosId),this.selectedSupplierName=e.detail.supplierName,this.changePos()}changePos(){this.selectedPosId&&this.subscriptions.push(t.pos.loadPos(this.selectedPosId).pipe(i(e=>!e||e.id!==this.selectedPosId),n(e=>(this.sendSelectedEvent(e),t.pos.basketLoadedForNewPos())),l(()=>(t.storeLocator.newStoreSelected(),this.closeStoreLocator()))).subscribe())}listenToCloseEvent(){const e=document.querySelector("mealz-drawer");e&&e.addEventListener("drawerClosed",()=>{this.closeStoreLocator(),this.sendCloseEvent()})}navigateBack(){var e,s,o;(o=(s=(e=t)==null?void 0:e.noSupplier)==null?void 0:s.displaySupplierSelector$)==null||o.next(!0),this.closeStoreLocator()}closeStoreLocator(){const e=document.querySelector("mealz-drawer-view-swapper");e&&e.displayStoreLocator$.next(!1);const s=this.querySelector("mealz-store-locator");s==null||s.resetPosSelection()}listenToDrawerViewSwapper(){const e=document.querySelector("mealz-drawer-view-swapper");e&&this.subscriptions.push(e.displayStoreLocator$.pipe(d(s=>s)).subscribe(()=>this.pageview()))}isHidden(){return this.classList.contains("hidden")}pageview(){this.isHidden()||t.analytics.sendEvent("pageview",this.analyticsPath,{})}sendSelectedEvent(e){this.isHidden()||t.analytics.sendEvent("locator.select",this.analyticsPath,{pos_name:e.attributes.name,pos_id:e.id,supplier_name:this.selectedSupplierName})}sendSearchEvent(e){this.isHidden()||t.analytics.sendEvent("locator.search",this.analyticsPath,{search_term:e.detail.searchTerm,stores_found_count:e.detail.storesFoundCount.toString()})}sendCloseEvent(){this.isHidden()||t.analytics.sendEvent("locator.close",this.analyticsPath,{})}}customElements.get("mealz-store-locator-drawer")||customElements.define("mealz-store-locator-drawer",c);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{N as
|
|
1
|
+
import{N as a,k as i}from"../assets/no-shadow-element-D62BBu0I.js";import{w as n}from"../assets/mealz-sdk-E_fNZM-c.js";import{f as o}from"../assets/filter-q99GWcpD.js";import"../assets/OperatorSubscriber-DfCnFunn.js";class p extends a{constructor(){super(),this.onboardingSteps=[{title:"Choisissez une recette",image:"https://storage.googleapis.com/assets.miam.tech/generic/images/9.1/onboardingRecipe.png"},{title:"Sélectionnez votre magasin",image:"https://storage.googleapis.com/assets.miam.tech/generic/images/9.1/onboardingDrive.png"},{title:"Commandez vos ingrédients",image:"https://storage.googleapis.com/assets.miam.tech/generic/images/9.1/onboardingIngredients.png"}],this.subscriptions=[],this.supplierList=[],this.analyticsPath="/supplier-selector",this.styleURL=new URL("/supplier-selector.css",import.meta.url)}connectedCallback(){super.connectedCallback(),n().then(()=>this.loadAvailableSuppliers()).catch(e=>{console.warn("[MealzSupplierSelector] MealzInternal SDK not available, suppliers will not be loaded.",e)}),this.listenToDrawerViewSwapper(),this.listenToCloseEvent()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe())}loadAvailableSuppliers(){var r;const e=window.mealz,s=(r=e==null?void 0:e.supplier)==null?void 0:r.getAffiliateSuppliers;if(!s){console.warn("[MealzSupplierSelector] mealz.supplier.getAffiliateSuppliers is not available.");return}const t=s();if(!t||typeof t.subscribe!="function"){console.warn("[MealzSupplierSelector] getAffiliateSuppliers did not return a subscribable observable.");return}this.subscriptions.push(t.subscribe(l=>{this.supplierList=l,this.requestUpdate()}))}selectSupplier(e){localStorage.setItem("_miam/selectedSupplierId",e.id),this.sendSelectSupplierEvent(e);const s=this.closest("mealz-drawer-view-swapper"),t=document.querySelector("mealz-store-locator");s&&(s.displayStoreLocator$.next(!0),window.mealzInternal.noSupplier.displaySupplierSelector$.next(!1),t&&(t.show=!0))}listenToDrawerViewSwapper(){const e=document.querySelector("mealz-drawer-view-swapper");e&&this.subscriptions.push(e.displaySupplierSelector$.pipe(o(s=>s)).subscribe(()=>this.pageview()))}listenToCloseEvent(){const e=document.querySelector("mealz-drawer");e&&e.addEventListener("drawerClosed",()=>{this.sendCloseEvent()})}render(){return i`
|
|
2
2
|
<div class="mealz-supplier-selector">
|
|
3
3
|
${this.renderOnboarding()}
|
|
4
4
|
${this.renderSuppliers()}
|
|
5
5
|
</div>
|
|
6
|
-
`}renderOnboarding(){return
|
|
6
|
+
`}renderOnboarding(){return i`
|
|
7
7
|
<div class="mealz-supplier-selector__onboarding-container">
|
|
8
8
|
<h3 class="mealz-supplier-selector__onboarding-title mealz-ds-text weight-xl">
|
|
9
9
|
✨ Nouveau ! Faites vos courses en un clic avec Marmiton.
|
|
@@ -13,7 +13,7 @@ import{N as p,k as l}from"../assets/no-shadow-element-D62BBu0I.js";import{t as c
|
|
|
13
13
|
Vos ingrédients sont ajoutés automatiquement dans votre panier, prêt à être commandés.
|
|
14
14
|
</span>
|
|
15
15
|
<div class="mealz-supplier-selector__onboarding-steps">
|
|
16
|
-
${this.onboardingSteps.map((e,s)=>
|
|
16
|
+
${this.onboardingSteps.map((e,s)=>i`
|
|
17
17
|
<div class="mealz-supplier-selector__card">
|
|
18
18
|
<div class="mealz-supplier-selector__instructions">
|
|
19
19
|
<div class="mealz-supplier-selector__step-counter">
|
|
@@ -27,13 +27,13 @@ import{N as p,k as l}from"../assets/no-shadow-element-D62BBu0I.js";import{t as c
|
|
|
27
27
|
`)}
|
|
28
28
|
</div>
|
|
29
29
|
</div>
|
|
30
|
-
`}renderSuppliers(){return
|
|
30
|
+
`}renderSuppliers(){return i`
|
|
31
31
|
<div class="mealz-supplier-selector__suppliers-container">
|
|
32
32
|
<h3 class="mealz-supplier-selector__onboarding-title mealz-ds-text weight-xl">
|
|
33
33
|
Pour commencer, sélectionnez votre enseigne.
|
|
34
34
|
</h3>
|
|
35
35
|
<div class="mealz-supplier-selector__supplier-list">
|
|
36
|
-
${this.supplierList.map(e=>
|
|
36
|
+
${this.supplierList.map(e=>i`
|
|
37
37
|
<button class="mealz-supplier-selector__supplier-button-card"
|
|
38
38
|
@click="${()=>this.selectSupplier(e)}">
|
|
39
39
|
<img
|
|
@@ -50,4 +50,4 @@ import{N as p,k as l}from"../assets/no-shadow-element-D62BBu0I.js";import{t as c
|
|
|
50
50
|
`)}
|
|
51
51
|
</div>
|
|
52
52
|
</div>
|
|
53
|
-
`}pageview(){window.mealzInternal.analytics.sendEvent("pageview",this.analyticsPath,{})}sendSelectSupplierEvent(e){window.mealzInternal.analytics.sendEvent("supplier-selector.select",this.analyticsPath,{supplier_id:e.id})}sendCloseEvent(){window.mealzInternal.analytics.sendEvent("supplier-selector.close",this.analyticsPath,{})}}
|
|
53
|
+
`}pageview(){window.mealzInternal.analytics.sendEvent("pageview",this.analyticsPath,{})}sendSelectSupplierEvent(e){window.mealzInternal.analytics.sendEvent("supplier-selector.select",this.analyticsPath,{supplier_id:e.id})}sendCloseEvent(){window.mealzInternal.analytics.sendEvent("supplier-selector.close",this.analyticsPath,{})}}customElements.get("mealz-supplier-selector")||customElements.define("mealz-supplier-selector",p);
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{N as d,k as h}from"./no-shadow-element-D62BBu0I.js";import{t as m}from"./custom-element-BhZVzxrc.js";import{n as l}from"./property-CoRN-Ln2.js";import{a as p}from"./unsafe-html-DWUMaK1p.js";var g=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=(s,t,c,n)=>{for(var o=n>1?void 0:n?y(t,c):t,a=s.length-1,r;a>=0;a--)(r=s[a])&&(o=(n?r(t,c,o):r(o))||o);return n&&o&&g(t,c,o),o};let e=class extends d{constructor(){super(),this.noStyling=!1,this.isCollapsed=!0,this.isCollapsedChangeEvent=new CustomEvent("isCollapsedChange",{detail:{isCollapsed:this.isCollapsed},bubbles:!0,composed:!0}),this.styleURL=new URL("./accordion/accordion.css",this.getBaseURL())}connectedCallback(){super.connectedCallback();const s=this.querySelector('[slot="title"]');s&&(this.titleSlot=s.innerHTML,s.remove());const t=this.querySelector('[slot="content"]');t&&(this.contentSlot=t.innerHTML,t.remove()),this.innerHTML=""}disconnectedCallback(){super.disconnectedCallback()}toggleAccordion(){this.isCollapsed=!this.isCollapsed,this.dispatchEvent(this.isCollapsedChangeEvent),this.requestUpdate()}updated(){this.classList.toggle("opened",!this.isCollapsed)}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
|
-
${typeof this.titleSlot=="string"?p(this.titleSlot):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
|
-
${typeof this.contentSlot=="string"?p(this.contentSlot):this.contentSlot}
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
`}};i([l({type:String})],e.prototype,"titleSlot",2);i([l({type:String})],e.prototype,"contentSlot",2);i([l({type:String})],e.prototype,"iconUrl",2);i([l({type:Boolean})],e.prototype,"noStyling",2);i([l({type:Boolean})],e.prototype,"isCollapsed",2);e=i([m("mealz-accordion")],e);customElements.get("mealz-accordion")||customElements.define("mealz-accordion",e);
|