38 lines
1.5 KiB
JavaScript
38 lines
1.5 KiB
JavaScript
import { S as SELECTEUR_BOUTON_PANIER, A as ATTRIBUT_CONTIENT_ARTICLES } from "./dom.js";
|
|
import { N as NOM_CANAL_BOUTON_PANIER } from "./messages3.js";
|
|
import { r as recupereElementOuLeve } from "./dom2.js";
|
|
import { v as valideMessageMajBoutonPanier } from "./messages.js";
|
|
import { r as recupereElementDocumentEither } from "./utils.js";
|
|
import { p as pipe } from "./pipe.XPB0wEfw.js";
|
|
import "./erreurs2.js";
|
|
import "./exports.B84S-6H1.js";
|
|
import "./Either.wHNxn7Os.js";
|
|
import "./index.DxUTT09Y.js";
|
|
import "./erreurs3.js";
|
|
import "./messages2.js";
|
|
import "./cart.js";
|
|
import "./cart2.js";
|
|
import "./adresses.js";
|
|
import "./cart-coupons.js";
|
|
import "./couts-livraison.js";
|
|
import "./validation.js";
|
|
const initialiseBoutonPanier = () => {
|
|
const BOUTON_PANIER = pipe(
|
|
recupereElementDocumentEither(SELECTEUR_BOUTON_PANIER),
|
|
recupereElementOuLeve
|
|
);
|
|
const CANAL_BOUTON_PANIER = new BroadcastChannel(NOM_CANAL_BOUTON_PANIER);
|
|
CANAL_BOUTON_PANIER.onmessage = (evenementMessage) => {
|
|
valideMessageMajBoutonPanier(evenementMessage).ifRight((message) => {
|
|
BOUTON_PANIER.textContent = `cart (${String(message.donnees.quantiteProduits)})`;
|
|
BOUTON_PANIER.setAttribute(ATTRIBUT_CONTIENT_ARTICLES, String(message.donnees.quantiteProduits > 0));
|
|
});
|
|
};
|
|
document.addEventListener("visibilitychange", () => {
|
|
CANAL_BOUTON_PANIER.close();
|
|
});
|
|
};
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
initialiseBoutonPanier();
|
|
});
|
|
//# sourceMappingURL=scripts-bouton-panier.js.map
|