haiku-atelier-2024/web/app/themes/haiku-atelier-2024/assets/js/scripts-page-boutique.js
gcch e4eaf6404a 2025-11-03 (bis)
- ajoute un .dockerignore.
- ajoute un Dockerfile.
- met à jour les dépendances.
- utilise bun comme gestionnaire de paquets npm.
- utilise une configuration Vite en TypeScript.
- ajoute les fichiers compilés JavaScript aux fichiers pris en charge par Git.
2025-11-03 17:26:39 +01:00

24 lines
6.6 KiB
JavaScript

import{M as U,z as G}from"./index.BiLbLflF.js";import{x as d,y as i,z as e,B as n,E as t,F as r,G as V,H as D,I as a,J as o,K as s,L as b,M as m,N as T,O as w,m as P,P as k,Q as M,S as W,T as R,U as A,V as h,W as F,X as H,Y,v as $,Z as K,_ as q,$ as f}from"./dom.DBz3b6Rw.js";import{R as X}from"./api.BWtmxolt.js";import{E as g,g as z,n as j}from"./reseau.CxtoDjd2.js";import{s as L}from"./validation.D_pHOsEn.js";import{aa as J}from"./exports.CgSBb-87.js";import"./journalisation.js";function Ut(){import.meta.url,import("_").catch(()=>1),(async function*(){})().next()}function N(p,E){return E(p),p}function Q(){if(arguments.length===1){const p=arguments;return function(S){return N(S,p[0])}}return N(arguments[0],arguments[1])}const Z={EDIT:"edit",VIEW:"view"},tt={DATE:"date",DATE_GMT:"date_gmt",MODIFIED:"modified",MODIFIED_GMT:"modified_gmt"},et={ASC:"asc",DESC:"desc"},at={COMMENT_COUNT:"comment_count",DATE:"date",ID:"id",INCLUDE:"include",MENU_ORDER:"menu_order",MODIFIED:"modified",POPULARITY:"popularity",PRICE:"price",RATING:"rating",SLUG:"slug",TITLE:"title"},B={EXTERNAL:"external",GROUPED:"grouped",SIMPLE:"simple",VARIABLE:"variable"},rt={AND:"and",IN:"in",NOT_IN:"not_in"},it={AND:"and",IN:"in",NOT_IN:"not_in"},v={IN_STOCK:"instock",ON_BACK_ORDER:"onbackorder",OUT_OF_STOCK:"outofstock"},ot={AND:"and",IN:"in"},y={ANY:"any",CATALOG:"catalog",HIDDEN:"hidden",SEARCH:"search",VISIBLE:"visible"},st={1:1,2:2,3:3,4:4,5:5},I={ANY:"any",DRAFT:"draft",FUTURE:"future",PENDING:"pending",PRIVATE:"private",PUBLISH:"publish",TRASH:"trash"},nt={NONE:"none",SHIPPING:"shipping",TAXABLE:"taxable"},_t={NO:"no",NOTIFY:"notify",YES:"yes"},ct=d({after:e(t()),attribute:e(t()),attribute_relation:e(n(ot)),attribute_term:e(t()),attributes:e(i(b())),before:e(t()),catalog_visibility:e(n(y)),category:e(t()),category_operator:e(n(rt)),context:e(n(Z)),date_column:e(n(tt)),dates_are_gmt:e(s()),exclude:e(i(r(a(),o()))),exclude_meta:e(i(t())),featured:e(s()),include:e(i(r(a(),o()))),include_meta:e(i(t())),max_price:e(t()),min_price:e(t()),modified_after:e(t()),modified_before:e(t()),offset:e(r(a(),o())),on_sale:e(s()),order:e(n(et)),orderby:e(n(at)),page:e(r(a(),D(1))),parent:e(i(r(a(),o()))),parent_exclude:e(i(r(a(),o()))),per_page:e(r(a(),D(0),V(100))),rating:e(i(n(st))),search:e(t()),search_sku:e(t()),shipping_class:e(t()),sku:e(t()),slug:e(t()),status:e(n(I)),stock_status:e(i(n(v))),tag:e(t()),tag_operator:e(n(it)),type:e(n(B))}),ut=d({file:t(),id:t(),name:t()}),dt=d({height:t(),length:t(),width:t()}),lt=d({id:r(a(),o()),name:t(),slug:t()}),mt=d({id:r(a(),o()),name:t(),slug:t()}),Tt=d({alt:t(),date_created:t(),date_created_gmt:t(),date_modified:t(),date_modified_gmt:t(),id:r(a(),o()),name:t(),src:t()}),pt=d({id:r(a(),o()),name:t(),options:i(t()),position:r(a(),o()),variation:s(),visible:s()}),Et=d({id:r(a(),o()),name:t(),option:t()}),gt=d({id:r(a(),o()),key:t(),option:e(b())}),St=d({attributes:i(pt),average_rating:t(),backordered:s(),backorders:n(_t),backorders_allowed:s(),button_text:t(),catalog_visibility:n(y),categories:i(lt),cross_sell_ids:i(r(a(),o())),date_created:t(),date_created_gmt:t(),date_modified:t(),date_modified_gmt:t(),date_on_sale_from:m([t(),T()]),date_on_sale_from_gmt:m([t(),T()]),date_on_sale_to:m([t(),T()]),date_on_sale_to_gmt:m([t(),T()]),default_attributes:i(Et),description:t(),dimensions:dt,download_expiry:a(),download_limit:a(),downloadable:s(),downloads:i(ut),external_url:t(),featured:s(),generated_slug:e(t()),global_unique_id:t(),grouped_products:i(r(a(),o())),has_options:s(),id:r(a(),o()),image_repos:m([t(),T()]),image_survol:m([t(),T()]),images:i(Tt),low_stock_amount:m([a(),T()]),manage_stock:s(),menu_order:r(a(),o()),meta_data:i(gt),name:t(),on_sale:s(),parent_id:r(a(),o()),permalink:r(t(),w()),permalink_template:e(t()),post_password:t(),price:t(),price_html:t(),prix_maximal:t(),purchasable:s(),purchase_note:t(),rating_count:r(a(),o()),regular_price:t(),related_ids:i(r(a(),o())),reviews_allowed:s(),sale_price:t(),shipping_class:t(),shipping_class_id:r(a(),o()),shipping_required:s(),shipping_taxable:s(),short_description:t(),sku:t(),slug:t(),sold_individually:s(),status:n(I),stock_quantity:m([a(),T()]),stock_status:n(v),tags:i(mt),tax_class:t(),tax_status:n(nt),total_sales:r(a(),o()),type:n(B),upsell_ids:i(r(a(),o())),variations:i(r(a(),o())),virtual:s(),weight:t()}),Ot=i(St),C=_etats,O=12,_={BOUTON_PLUS_DE_PRODUITS:P(M),GRILLE_PRODUITS:P(k)},It=()=>{const p=_.GRILLE_PRODUITS.getAttribute(W);_.BOUTON_PLUS_DE_PRODUITS.addEventListener("click",()=>{const E=Number(_.GRILLE_PRODUITS.getAttribute(R))+1,S={page:E,per_page:O,status:I.PUBLISH,...p&&{category:p}};g.liftEither(L(S,ct)).ifRight(()=>{_.BOUTON_PLUS_DE_PRODUITS.setAttribute(A,""),_.BOUTON_PLUS_DE_PRODUITS.setAttribute(h,""),F(_.BOUTON_PLUS_DE_PRODUITS,500)}).chain(u=>g(()=>z({authString:C.authString,nonce:C.nonce,route:X,searchParams:new URLSearchParams(u).toString()}))).chain(u=>g(async({throwE:c})=>U(await j(u)).with({status:500},()=>c(new H("500 Server Error"))).with({status:400},()=>c(new Y("400 Server Error"))).with({status:200},l=>l.body).run())).chain(u=>g.liftEither(L(u,Ot))).ifRight(u=>{u.length<O&&_.BOUTON_PLUS_DE_PRODUITS.toggleAttribute($);const c=document.createDocumentFragment();for(const l of u.slice(0,O))J(K`
<article class="produit">
<figure>
<a href="/product/${l.slug}">
<picture class="produit__illustration produit__illustration__principale">
${l.image_repos??""}
</picture>
<picture class="produit__illustration produit__illustration__survol">
${l.image_survol??""}
</picture>
</a>
<figcaption class="produit__textuel">
<h3 class="produit__textuel__titre">
<a href="${l.permalink}">${l.name}</a>
</h3>
<p class="produit__textuel__prix">
${l.prix_maximal}
</p>
</figcaption>
</figure>
</article>
`,Q(x=>c.appendChild(x)));_.GRILLE_PRODUITS.appendChild(c),_.GRILLE_PRODUITS.setAttribute(R,String(E)),_.BOUTON_PLUS_DE_PRODUITS.textContent="Show more"}).ifLeft(u=>{U(u).with(G.instanceOf(q),c=>{f(c),console.error("ValiError",c.issues)}).otherwise(c=>{f(c),console.error("Erreur",c)}),_.BOUTON_PLUS_DE_PRODUITS.textContent="Error, try again?"}).finally(()=>{_.BOUTON_PLUS_DE_PRODUITS.removeAttribute(h),_.BOUTON_PLUS_DE_PRODUITS.removeAttribute(A)}).run()})};document.addEventListener("DOMContentLoaded",()=>{It()});export{Ut as __vite_legacy_guard};