cloudcommerce 2.3.1 → 2.3.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 (150) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  3. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  4. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  5. package/ecomplus-stores/barra-doce/package.json +2 -2
  6. package/package.json +6 -6
  7. package/packages/api/package.json +1 -1
  8. package/packages/apps/affiliate-program/package.json +1 -1
  9. package/packages/apps/correios/package.json +2 -2
  10. package/packages/apps/custom-payment/package.json +1 -1
  11. package/packages/apps/custom-shipping/package.json +1 -1
  12. package/packages/apps/datafrete/package.json +1 -1
  13. package/packages/apps/discounts/package.json +1 -1
  14. package/packages/apps/emails/package.json +1 -1
  15. package/packages/apps/fb-conversions/package.json +2 -2
  16. package/packages/apps/flash-courier/package.json +1 -1
  17. package/packages/apps/frenet/package.json +1 -1
  18. package/packages/apps/galaxpay/package.json +1 -1
  19. package/packages/apps/google-analytics/package.json +1 -1
  20. package/packages/apps/jadlog/package.json +1 -1
  21. package/packages/apps/loyalty-points/package.json +1 -1
  22. package/packages/apps/mandae/package.json +1 -1
  23. package/packages/apps/melhor-envio/package.json +1 -1
  24. package/packages/apps/mercadopago/package.json +1 -1
  25. package/packages/apps/pagarme/package.json +1 -1
  26. package/packages/apps/pagarme-v5/package.json +1 -1
  27. package/packages/apps/paghiper/package.json +1 -1
  28. package/packages/apps/pix/package.json +1 -1
  29. package/packages/apps/tiny-erp/package.json +1 -1
  30. package/packages/apps/webhooks/package.json +1 -1
  31. package/packages/cli/package.json +1 -1
  32. package/packages/config/package.json +1 -1
  33. package/packages/emails/package.json +1 -1
  34. package/packages/eslint/package.json +5 -5
  35. package/packages/events/package.json +1 -1
  36. package/packages/feeds/package.json +1 -1
  37. package/packages/firebase/package.json +2 -2
  38. package/packages/i18n/package.json +1 -1
  39. package/packages/modules/package.json +1 -1
  40. package/packages/passport/package.json +1 -1
  41. package/packages/ssr/lib/lib/analytics/send-to-ga4.js +2 -1
  42. package/packages/ssr/lib/lib/analytics/send-to-ga4.js.map +1 -1
  43. package/packages/ssr/lib/lib/analytics-events.js +11 -1
  44. package/packages/ssr/lib/lib/analytics-events.js.map +1 -1
  45. package/packages/ssr/lib/lib/serve-storefront.js +35 -21
  46. package/packages/ssr/lib/lib/serve-storefront.js.map +1 -1
  47. package/packages/ssr/package.json +3 -3
  48. package/packages/ssr/src/lib/analytics/send-to-ga4.ts +2 -0
  49. package/packages/ssr/src/lib/analytics-events.ts +11 -1
  50. package/packages/ssr/src/lib/serve-storefront.ts +36 -22
  51. package/packages/storefront/astro.config.mjs +4 -1
  52. package/packages/storefront/config/astro/vue-server.mjs +64 -0
  53. package/packages/storefront/dist/client/_astro/{AccountPage.3-eqV6OR.js → AccountPage.0M6_FdU6.js} +1 -1
  54. package/packages/storefront/dist/client/_astro/{CartSidebar.-Gy6eqIy.js → CartSidebar.L0Vbhsdt.js} +1 -1
  55. package/packages/storefront/dist/client/_astro/ProductDetails.FQtM5kpd.js +7 -0
  56. package/packages/storefront/dist/client/_astro/{ProductShelf.qbTNzuvn.js → ProductShelf.-4fsYkPB.js} +1 -1
  57. package/packages/storefront/dist/client/_astro/{ProductShelf.b77WjhZZ.js → ProductShelf.GAAhKdTN.js} +1 -1
  58. package/packages/storefront/dist/client/_astro/{SearchModal.WzDMBjqi.js → SearchModal.rasg5jV6.js} +1 -1
  59. package/packages/storefront/dist/client/_astro/SearchShowcase.kA6jICYo.js +1 -0
  60. package/packages/storefront/dist/client/_astro/ShopHeader.v_L96Y90.js +7 -0
  61. package/packages/storefront/dist/client/_astro/{_slug_.WkuZ8tvp.css → _slug_.4W7qhV-L.css} +1 -1
  62. package/packages/storefront/dist/client/_astro/customer-session.ZD6tLDQJ.js +7 -0
  63. package/packages/storefront/dist/client/_astro/{firebase-app.VduCDgof.js → firebase-app.iLdzDVjL.js} +1 -1
  64. package/packages/storefront/dist/client/_astro/hoisted.GaT7bmE3.js +1 -0
  65. package/packages/storefront/dist/client/_astro/{hoisted.xTPkED8g.js → hoisted.ICXGWNEA.js} +1 -1
  66. package/packages/storefront/dist/client/_astro/hoisted.XOXTrHqn.js +1 -0
  67. package/packages/storefront/dist/client/_astro/{index-dd468b12.fl8bpn8l.js → index-bea2a320.eWykogwr.js} +93 -93
  68. package/packages/storefront/dist/client/_astro/{shopping-cart.v-dB3kHB.js → shopping-cart.nSNNOrp9.js} +1 -1
  69. package/packages/storefront/dist/client/_astro/use-analytics.wTmoP8B1.js +1 -0
  70. package/packages/storefront/dist/client/_astro/{use-product-card.nNtSJVtB.js → use-product-card.UFr8SCuD.js} +1 -1
  71. package/packages/storefront/dist/client/_astro/use-text-value.lKqoIagH.js +4 -0
  72. package/packages/storefront/dist/server/chunks/{CartSidebar_blvgfFa-.mjs → CartSidebar_3_1aFp67.mjs} +1 -1
  73. package/packages/storefront/dist/server/chunks/{SearchModal_Sktaq643.mjs → SearchModal_2azP1u7P.mjs} +1 -1
  74. package/packages/storefront/dist/server/chunks/_.._19fCuQdO.mjs +5 -0
  75. package/packages/storefront/dist/server/chunks/{_page__9PfWVh79.mjs → _page__qqIVxbal.mjs} +1 -1
  76. package/packages/storefront/dist/server/chunks/{account_R4bpY7O1.mjs → account_vK6pmJlz.mjs} +1 -1
  77. package/packages/storefront/dist/server/chunks/astro/{assets-service_oQ4-9MNg.mjs → assets-service_631fRtTy.mjs} +66 -11
  78. package/packages/storefront/dist/server/chunks/{astro_ECsNQeA2.mjs → astro_u-oSb215.mjs} +8 -2
  79. package/packages/storefront/dist/server/chunks/{index__PeYBuja.mjs → index__05fnqFh.mjs} +1 -1
  80. package/packages/storefront/dist/server/chunks/{node_njrZIjT6.mjs → node_zqXXqc-u.mjs} +1 -1
  81. package/packages/storefront/dist/server/chunks/pages/{__XOsz50la.mjs → __ZucPYaOo.mjs} +380 -118
  82. package/packages/storefront/dist/server/chunks/pages/{_page__cIw_KTpN.mjs → _page__0sN9U0SD.mjs} +19 -3
  83. package/packages/storefront/dist/server/chunks/pages/account_OQr_6KN1.mjs +33 -0
  84. package/packages/storefront/dist/server/chunks/pages/{index_KP7Gn0ld.mjs → index_3IjgOEIq.mjs} +15 -4
  85. package/packages/storefront/dist/server/chunks/pages/node_OmjWRf8D.mjs +112 -0
  86. package/packages/storefront/dist/server/chunks/pages/~fallback_133FK-CP.mjs +59 -0
  87. package/packages/storefront/dist/server/chunks/~fallback_Wahcp9Wk.mjs +5 -0
  88. package/packages/storefront/dist/server/entry.mjs +9 -9
  89. package/packages/storefront/dist/server/manifest_9FASPYUE.mjs +202 -0
  90. package/packages/storefront/dist/server/renderers.mjs +45 -34
  91. package/packages/storefront/package.json +4 -4
  92. package/packages/storefront/server.d.ts +0 -1
  93. package/packages/storefront/src/lib/$storefront.d.ts +23 -16
  94. package/packages/storefront/src/lib/composables/use-pagination.ts +1 -3
  95. package/packages/storefront/src/lib/layouts/BaseHead.astro +5 -0
  96. package/packages/storefront/src/lib/scripts/push-analytics-events.ts +8 -6
  97. package/packages/storefront/src/lib/ssr-context.ts +46 -6
  98. package/packages/storefront/src/lib/state/use-analytics.ts +12 -11
  99. package/packages/storefront/src/lib/state/use-storage.ts +23 -9
  100. package/packages/test-base/package.json +1 -1
  101. package/packages/types/package.json +1 -1
  102. package/packages/storefront/dist/client/_astro/ProductDetails.ATGXfGhG.js +0 -7
  103. package/packages/storefront/dist/client/_astro/SearchShowcase.9gIA4Cq0.js +0 -1
  104. package/packages/storefront/dist/client/_astro/ShopHeader.Ee4OJr3q.js +0 -7
  105. package/packages/storefront/dist/client/_astro/customer-session.dSYHWdP4.js +0 -7
  106. package/packages/storefront/dist/client/_astro/ecom-icon_12falx.png +0 -0
  107. package/packages/storefront/dist/client/_astro/ecom-icon_15pqnO.png +0 -0
  108. package/packages/storefront/dist/client/_astro/ecom-icon_t3guw.png +0 -0
  109. package/packages/storefront/dist/client/_astro/headphone_T2Jjc.avif +0 -0
  110. package/packages/storefront/dist/client/_astro/headphone_Z1CG18r.webp +0 -0
  111. package/packages/storefront/dist/client/_astro/hoisted.d2SGwVMl.js +0 -1
  112. package/packages/storefront/dist/client/_astro/hoisted.x1b7VHef.js +0 -1
  113. package/packages/storefront/dist/client/_astro/logo_1UBsBq.webp +0 -0
  114. package/packages/storefront/dist/client/_astro/logo_Z1K5PE9.png +0 -0
  115. package/packages/storefront/dist/client/_astro/logo_Z1KIIl1.avif +0 -0
  116. package/packages/storefront/dist/client/_astro/passion_LHbe9.webp +0 -0
  117. package/packages/storefront/dist/client/_astro/passion_Z23MeUb.avif +0 -0
  118. package/packages/storefront/dist/client/_astro/rect8589_1TtOHY.png +0 -0
  119. package/packages/storefront/dist/client/_astro/rect8589_1f5opX.webp +0 -0
  120. package/packages/storefront/dist/client/_astro/rect8589_IUskt.webp +0 -0
  121. package/packages/storefront/dist/client/_astro/rect8589_Uxfdf.png +0 -0
  122. package/packages/storefront/dist/client/_astro/rect8589_Z15uApA.png +0 -0
  123. package/packages/storefront/dist/client/_astro/rect8589_Z1Ap1Im.avif +0 -0
  124. package/packages/storefront/dist/client/_astro/rect8589_Z1JT1HB.webp +0 -0
  125. package/packages/storefront/dist/client/_astro/rect8589_ZY9mtN.avif +0 -0
  126. package/packages/storefront/dist/client/_astro/rect8589_tMFW0.avif +0 -0
  127. package/packages/storefront/dist/client/_astro/rect859_1TgQXS.avif +0 -0
  128. package/packages/storefront/dist/client/_astro/rect859_2Nm1z.avif +0 -0
  129. package/packages/storefront/dist/client/_astro/rect859_DIqwR.png +0 -0
  130. package/packages/storefront/dist/client/_astro/rect859_Z1IKDb2.png +0 -0
  131. package/packages/storefront/dist/client/_astro/rect859_Z29FI4V.webp +0 -0
  132. package/packages/storefront/dist/client/_astro/rect859_Z2kFHGk.avif +0 -0
  133. package/packages/storefront/dist/client/_astro/rect859_ZkpPFI.webp +0 -0
  134. package/packages/storefront/dist/client/_astro/rect859_jXzBi.png +0 -0
  135. package/packages/storefront/dist/client/_astro/rect859_x1l16.webp +0 -0
  136. package/packages/storefront/dist/client/_astro/rect89_1TSfW7.avif +0 -0
  137. package/packages/storefront/dist/client/_astro/rect89_Z1re32x.webp +0 -0
  138. package/packages/storefront/dist/client/_astro/use-analytics._ef6TM4P.js +0 -1
  139. package/packages/storefront/dist/client/_astro/use-text-value.0OP9HCfP.js +0 -4
  140. package/packages/storefront/dist/client/~fallback.html +0 -99
  141. package/packages/storefront/dist/client/~index.html +0 -131
  142. package/packages/storefront/dist/server/chunks/_.._yTK2xBRC.mjs +0 -5
  143. package/packages/storefront/dist/server/chunks/pages/account_l-FHyDJd.mjs +0 -23
  144. package/packages/storefront/dist/server/chunks/pages/node_FoLtkdH1.mjs +0 -257
  145. package/packages/storefront/dist/server/chunks/pages/~fallback_KPp6Nh_p.mjs +0 -34
  146. package/packages/storefront/dist/server/chunks/~fallback_p7P7NIL5.mjs +0 -5
  147. package/packages/storefront/dist/server/images.dist.csv +0 -30
  148. package/packages/storefront/dist/server/images.src.csv +0 -11
  149. package/packages/storefront/dist/server/manifest_E6KbHQrT.mjs +0 -202
  150. package/packages/storefront/dist/server/static-builds.csv +0 -71
@@ -0,0 +1,7 @@
1
+ import"./server-data.4C60Esyt.js";import{r as C,c as y,b as U}from"./sf-utils.c42cbZ9W.js";import{h as x}from"./index.KfrHdfOH.js";const K=e=>{if(e){if(e.display_name)return e.display_name;if(e.name&&e.name.given_name)return e.name.given_name}return""},z=K,G="modulepreload",J=function(e){return"/"+e},I={},V=function(a,t,i){let r=Promise.resolve();if(t&&t.length>0){const n=document.getElementsByTagName("link");r=Promise.all(t.map(s=>{if(s=J(s),s in I)return;I[s]=!0;const o=s.endsWith(".css"),c=o?'[rel="stylesheet"]':"";if(!!i)for(let p=n.length-1;p>=0;p--){const g=n[p];if(g.href===s&&(!o||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${c}`))return;const u=document.createElement("link");if(u.rel=o?"stylesheet":G,o||(u.as="script",u.crossOrigin=""),u.href=s,document.head.appendChild(u),o)return new Promise((p,g)=>{u.addEventListener("load",p),u.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${s}`)))})}))}return r.then(()=>a()).catch(n=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=n,window.dispatchEvent(s),!s.defaultPrevented)throw n})},F=(e,a,t=globalThis.localStorage,i=!0)=>{if(!t)return C(a);const r=()=>{const c=t.getItem(e);if(c)try{return JSON.parse(c)}catch{return t.removeItem(e),null}},n=r(),s=C(n||a);let o;return i&&globalThis.BroadcastChannel&&(o=new BroadcastChannel(e),o.onmessage=c=>{c.data==="set"&&Object.assign(s,r())}),x(s,()=>{t.setItem(e,JSON.stringify(s)),o&&o.postMessage("set")},{debounce:50}),s};globalThis.__apiCache||(globalThis.__apiCache={});const b=typeof process=="object"&&process?.env||globalThis;class S extends Error{constructor(a,t,i,r=!1){t?(super(t.statusText),this.data=t.data,this.statusCode=t.status):super(i||"Request error"),this.config=a,this.response=t,this.isTimeout=r}}const H={middleware(e){const a={...e.headers};if(!e.isNoAuth)if(e.accessToken)a.Authorization=`Bearer ${e.accessToken}`;else{const n=e.authenticationId||b.ECOM_AUTHENTICATION_ID,s=e.apiKey||b.ECOM_API_KEY;if(n&&s){const o=`${n}:${s}`,c=typeof Buffer=="function"?Buffer.from(o).toString("base64"):btoa(o);a.Authorization=`Basic ${c}`}}let t=e.baseUrl||b.API_BASE_URL||"https://ecomplus.io/v2";const{endpoint:i,params:r}=e;if(i!=="login"&&i!=="authenticate"&&i!=="ask-auth-callback"&&i!=="check-username"){const n=e.storeId||b.ECOM_STORE_ID;if(!n)throw new Error("`storeId` must be set in config or `ECOM_STORE_ID` env var");t+=`/:${n}`;const s=e.lang||b.ECOM_LANG;s&&(t+=`,lang:${s}`)}if(t+=`/${i}`,typeof r=="string")t+=`?${r}`;else{const n=r||{};if(["fields","sort"].forEach(s=>{const o=e[s];o&&!n[s]&&(n[s]=o.join(","))}),["limit","offset","count","buckets","concise","verbose"].forEach(s=>{const o=e[s];o&&!n[s]&&(n[s]=o)}),Object.keys(n).length){const s=new URLSearchParams;Object.keys(n).forEach(o=>{const c=n[o];Array.isArray(c)?c.forEach(_=>{s.append(o,_)}):c!==void 0&&s.append(o,c)}),t+=`?${s.toString()}`}}return{url:t,headers:a}}},l=async(e,a=0)=>{const t=globalThis.$apiMergeConfig?{...globalThis.$apiMergeConfig,...e}:e,{url:i,headers:r}=H.middleware(t),n=t.method?.toUpperCase()||"GET",{timeout:s=2e4,maxRetries:o=3,cacheMaxAge:c=Number(b.API_CACHE_MAX_AGE)||12e4}=t,_=n==="GET"&&t.canCache;let u;if(_){u=`${i}${JSON.stringify(r)}`;const f=globalThis.__apiCache[u];if(f&&Date.now()-f.timestamp<=c)return{...f.res,config:t}}const p=t.body||t.data;let g;p&&(g=JSON.stringify(p),r["Content-Type"]="application/json");const T=new AbortController;let A=!1;const M=setTimeout(()=>{T.abort(),A=!0},s);let h;try{h=await(t.fetch||fetch)(i,{method:n,headers:r,body:g,signal:T.signal})}catch(f){let d=f.message;throw f.cause&&(d+=` - ${f.cause}`),new S(t,h,d,A)}if(clearTimeout(M),h){if(h.ok){const d=h;return d.data=h.status!==204?await h.json():null,_&&u&&(globalThis.__apiCache[u]={timestamp:Date.now(),res:d}),d.config=t,d}const{status:f}=h;if(o<a&&(f===429||f>=500)){const d=h.headers.get("retry-after");return new Promise((D,L)=>{setTimeout(()=>{l(e,a+1).then(D).catch(L)},d&&parseInt(d,10)*1e3||5e3)})}}try{h.data=await h?.json()}catch{}throw new S(t,h)},Y=(e,a)=>l({...a,endpoint:e}),q=(e,a,t)=>l({...t,method:"post",endpoint:e,body:a}),X=(e,a,t)=>l({...t,method:"put",endpoint:e,body:a}),Q=(e,a,t)=>l({...t,method:"patch",endpoint:e,body:a}),N=(e,a)=>l({...a,method:"delete",endpoint:e});l.get=Y;l.post=q;l.put=X;l.patch=Q;l.del=N;l.delete=N;const W="emailForSignIn",P="ecomSession",E={customer:{display_name:"",main_email:""},auth:null},m=F(P,E),v=y(()=>{const{auth:e}=m;return e&&new Date(e.expires).getTime()-Date.now()>1e3*10}),R=y(()=>m.customer),O=y(()=>z(R.value)),$=y({get(){return R.value.main_email},set(e){m.customer.main_email=e}});let w;const ne=y(()=>v.value||!!w?.currentUser?.emailVerified),Z=()=>{m.auth=E.auth,m.customer=E.customer,localStorage.removeItem(P),w.signOut()},j=(e="Not authenticated")=>{const a=new Error(e);throw a.isNoAuth=!0,a},B=async()=>{const e=await w.currentUser?.getIdToken();if(!e){j("Can't get Firebase user ID token");return}const{domain:a}=globalThis.$storefront.settings;try{const t=await fetch(`https://${a}/_api/passport/token`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});m.auth=await t.json()}catch(t){console.error(t)}},ee=async()=>(v.value||await B(),m.auth?m.auth.access_token:j()),te=async()=>{const e=await ee(),a=m.auth,{data:t}=await l.get(`customers/${a.customer_id}`,{accessToken:e});return m.customer=t,t};let k=!1;const re=e=>{if(k)return;e===void 0&&(e=!window.location.pathname.startsWith("/app/")),k=!0;const a=()=>V(()=>import("./firebase-app.iLdzDVjL.js"),__vite__mapDeps([0,1])).then(({getAuth:t,onAuthStateChanged:i,isSignInWithEmailLink:r,signInWithEmailLink:n})=>{if(w=t(),i(w,async s=>{if(s){if(s.displayName&&!O.value&&(m.customer.display_name=s.displayName),s.email&&(!$.value||s.emailVerified)&&(m.customer.main_email=s.email),s.emailVerified){const o=s.email!==$.value;(o||!v.value)&&(await B(),(o||!O.value)&&await te())}}else Z()}),r(w,window.location.href)){const o=new URLSearchParams(window.location.search).get("email");o&&n(w,o,window.location.href).then(()=>window.localStorage.removeItem(W)).catch(console.error)}}).catch(console.error);e?U(a):a()};export{W as E,V as _,O as a,l as b,R as c,ne as d,re as e,$ as f,v as i,Z as l,m as s,F as u};
2
+ function __vite__mapDeps(indexes) {
3
+ if (!__vite__mapDeps.viteFileDeps) {
4
+ __vite__mapDeps.viteFileDeps = ["_astro/firebase-app.iLdzDVjL.js","_astro/index-bea2a320.eWykogwr.js"]
5
+ }
6
+ return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
7
+ }
@@ -1,4 +1,4 @@
1
- import{r as i,i as a}from"./index-dd468b12.fl8bpn8l.js";import{g as p,a as f,o as g,s as m}from"./index-dd468b12.fl8bpn8l.js";var e="firebase",s="10.7.2";/**
1
+ import{r as i,i as a}from"./index-bea2a320.eWykogwr.js";import{g as p,a as f,o as g,s as m}from"./index-bea2a320.eWykogwr.js";var e="firebase",s="10.8.0";/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  *
@@ -0,0 +1 @@
1
+ import{u as C,w as V,a as I,e as R,b as Y,t as S}from"./use-analytics.wTmoP8B1.js";import{a as $}from"./afetch.OifQZgwR.js";import{u as D}from"./index.KfrHdfOH.js";import"./customer-session.ZD6tLDQJ.js";import"./server-data.4C60Esyt.js";import"./sf-utils.c42cbZ9W.js";import"./shopping-cart.nSNNOrp9.js";import"./price.Easct8WC.js";import"./name.VA3MEpe0.js";import"./i18n.zhlBzJt8.js";const h={waiting:Promise.resolve(),params:{content_ids:[],content_name:""}},A=(t,e="BRL",a=!1)=>{const n={currency:e,content_category:t.item_category,content_name:t.item_name,value:t.price,content_type:"product"};return a?(n.contents=[{id:t.item_id,quantity:t.quantity}],Number(t.quantity)<0&&(n.value=0)):n.content_ids=[t.item_id],n},F=async({event:t})=>{if(t.name==="page_view")return h.waiting=new Promise(n=>{setTimeout(n,110)}),h.params.content_name=t.params.page_title,[{name:"PageView"}];const{items:e,currency:a}=t.params;if(t.name==="view_item"&&e){const n=e[0];if(n)return n.item_list_id==="product-page"?[{name:"ViewContent",params:A(n,a)}]:(e.forEach(({item_id:r})=>{h.params.content_ids.push(r)}),h.params.content_ids.length>e.length?[{name:null}]:(await h.waiting,[{name:"ViewContent",params:{...h.params,content_type:"product"}}]))}if((t.name==="add_to_cart"||t.name==="remove_from_cart")&&e){const n=t.name==="add_to_cart";return e.map(r=>({name:"AddToCart",params:A({...r,quantity:n?r.quantity||1:-(r.quantity||1)},a,!0)}))}return[{name:null}]},y={waiting:Promise.resolve(),params:{description:"",contents:[]}},E=(t,e=!1)=>{const a={content_id:t.item_id,content_name:t.item_name,price:t.price,content_category:t.item_category,brand:t.item_brand};return e&&(a.quantity=t.quantity),a},H=async({event:t})=>{if(t.name==="page_view")return y.waiting=new Promise(n=>{setTimeout(n,110)}),y.params.description=t.params.page_title,[{name:"PageView"}];const{items:e,currency:a}=t.params;if(t.name==="view_item"&&e){const n=e[0];if(n)return n.item_list_id==="product-page"?[{name:"ViewContent",params:{contents:[E(n)],content_type:"product",currency:a,value:n.price}}]:(e.forEach(r=>{y.params.contents.push(E(r))}),y.params.contents.length>e.length?[{name:null}]:(await y.waiting,[{name:"ViewContent",params:{...y.params,content_type:"product",currency:a}}]))}if((t.name==="add_to_cart"||t.name==="remove_from_cart")&&e){const n=t.name==="add_to_cart";return e.map(r=>{const l=r.quantity||1,{price:u}=r;return{name:"AddToCart",params:{contents:[E({...r,quantity:n?l:-l},!0)],content_type:"product",currency:a,value:n&&typeof u=="number"?l*u:0}}})}return[{name:null}]},M={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1,SITE:"https://demo.ecomplus.app",ASSETS_PREFIX:void 0}.DEPLOY_RAND||"_";let b=[];const O=D(t=>{$("/_analytics",{method:"POST",body:{exp_variant_string:t?.expVariantString,...I(),events:b}}),b=[]},200);if(!window.location.search.includes(`__isrV=${M}`)){const t=C(),e=r=>{b.push(r),O(t)};V(async r=>{const{name:l,params:u}=r.event;e({type:"gtag",name:l,params:u});const{gtag:i,dataLayer:s,fbq:d,ttq:o}=window;typeof i=="function"&&i("event",l,u),s&&typeof s.push=="function"&&s.push(["event",l,u]),(await F(r)).forEach(m=>{m.name&&(e({type:"fbq",...m}),typeof d=="function"&&d("track",m.name,m.params))}),(await H(r)).forEach(m=>{m.name&&(e({type:"ttk",...m}),typeof o?.page=="function"&&(m.name==="PageView"?o.page():o.track(m.name,m.params)))})});let a="";const n=()=>{const r=window.location.toString();r!==a&&(R("page_view",{...Y(),page_location:r,client_id:S.g_client_id||S.client_id}),a=r)};n(),window.addEventListener("storefront:apiContext",()=>{try{window.dataLayer.push(function(){this.reset(),n()})}catch{n()}})}const g=t=>history.replaceState(t,""),P=!!document.startViewTransition,w=()=>!!document.querySelector('[name="astro-view-transitions-enabled"]'),k=t=>document.dispatchEvent(new Event(t)),x=()=>k("astro:load"),f="data-astro-transition-persist";let p=history.state?.index||0;!history.state&&w()&&g({index:p,scrollY:0});const W=(t,e)=>{let a=!1,n=!1;return(...r)=>{if(a){n=!0;return}t(...r),a=!0,setTimeout(()=>{n&&(n=!1,t(...r)),a=!1},e)}};async function G(t){const e=await fetch(t),a=await e.text();return{ok:e.ok,html:a}}function q(){const t=document.querySelector('[name="astro-view-transitions-fallback"]');return t?t.getAttribute("content"):"animate"}function L(){for(const t of document.scripts)t.dataset.astroExec=""}function B(){let t=Promise.resolve();for(const e of Array.from(document.scripts)){if(e.dataset.astroExec==="")continue;const a=document.createElement("script");a.innerHTML=e.innerHTML;for(const n of e.attributes){if(n.name==="src"){const r=new Promise(l=>{a.onload=l});t=t.then(()=>r)}a.setAttribute(n.name,n.value)}a.dataset.astroExec="",e.replaceWith(a)}return t}const K=new DOMParser;async function v(t,e,a){const n=K.parseFromString(t,"text/html"),r=i=>{const s=i.getAttribute(f),d=s&&n.head.querySelector(`[${f}="${s}"]`);if(d)return d;if(i.matches("link[rel=stylesheet]")){const o=i.getAttribute("href");return n.head.querySelector(`link[rel=stylesheet][href="${o}"]`)}if(i.tagName==="SCRIPT"){let o=i;for(const c of n.scripts)if(o.textContent&&o.textContent===c.textContent||o.type===c.type&&o.src&&o.src===c.src)return c}return null},l=()=>{n.querySelectorAll("head noscript").forEach(o=>o.remove());const i=document.documentElement,s=[...i.attributes].filter(({name:o})=>(i.removeAttribute(o),o.startsWith("data-astro-")));[...n.documentElement.attributes,...s].forEach(({name:o,value:c})=>i.setAttribute(o,c));for(const o of Array.from(document.head.children)){const c=r(o);c?c.remove():o.remove()}document.head.append(...n.head.children);const d=document.body;document.body.replaceWith(n.body);for(const o of d.querySelectorAll(`[${f}]`)){const c=o.getAttribute(f),_=document.querySelector(`[${f}="${c}"]`);_&&_.replaceWith(o)}if(scrollTo({left:0,top:0,behavior:"instant"}),e?.scrollY===0&&location.hash){const o=decodeURIComponent(location.hash.slice(1)),c=document.getElementById(o);c&&(e.scrollY=c.offsetTop,g(e),c.scrollIntoView())}else e&&e.scrollY!==0&&scrollTo(0,e.scrollY);k("astro:beforeload")},u=[];for(const i of n.querySelectorAll("head link[rel=stylesheet]"))if(!document.querySelector(`[${f}="${i.getAttribute(f)}"], link[rel=stylesheet]`)){const s=document.createElement("link");s.setAttribute("rel","preload"),s.setAttribute("as","style"),s.setAttribute("href",i.getAttribute("href")),u.push(new Promise(d=>{["load","error"].forEach(o=>s.addEventListener(o,d)),document.head.append(s)}))}if(u.length&&await Promise.all(u),a==="animate"){let i=!1;addEventListener("animationstart",()=>i=!0,{once:!0}),document.documentElement.dataset.astroTransitionFallback="old",await new Promise(s=>{const d=()=>{removeEventListener("animationend",d),clearTimeout(o),l(),s(!0),document.documentElement.dataset.astroTransitionFallback="new"};addEventListener("animationend",d,{once:!0});let o=setTimeout(()=>!i&&d())})}else l()}async function T(t,e,a){let n;const{html:r,ok:l}=await G(e);if(!l){location.href=e;return}document.documentElement.dataset.astroTransition=t,P?n=document.startViewTransition(()=>v(r,a)).finished:n=v(r,a,q());try{await n}finally{await B(),L(),x()}}function N(t){if(document.querySelector(`link[rel=prefetch][href="${t}"]`))return;if(navigator.connection){let a=navigator.connection;if(a.saveData||/(2|3)g/.test(a.effectiveType||""))return}let e=document.createElement("link");e.setAttribute("rel","prefetch"),e.setAttribute("href",t),document.head.append(e)}(P||q()!=="none")&&!location.pathname.startsWith("/app/")&&(L(),document.addEventListener("click",t=>{let e=t.target;if(e instanceof Element&&e.tagName!=="A"&&(e=e.closest("a")),!e||!(e instanceof HTMLAnchorElement)||e.dataset.astroReload!==void 0||e.hasAttribute("download")||!e.href||e.pathname.startsWith("/app/")||e.target&&e.target!=="_self"||e.origin!==location.origin||t.button!==0||t.metaKey||t.ctrlKey||t.altKey||t.shiftKey||t.defaultPrevented||!w())return;if(location.pathname===e.pathname&&location.search===e.search){if(e.hash)return;if(t.preventDefault(),g({...history.state,scrollY}),scrollTo({left:0,top:0,behavior:"instant"}),location.hash){const n={index:++p,scrollY:0};history.pushState(n,"",e.href)}return}t.preventDefault(),T("forward",e.href,{index:++p,scrollY:0});const a={index:p,scrollY};g({index:p-1,scrollY}),history.pushState(a,"",e.href)}),addEventListener("popstate",t=>{if(!w()&&t.state){location.reload();return}if(t.state===null)return;const e=history.state,a=e?.index??p+1,n=a>p?"forward":"back";T(n,location.href,e),p=a}),["mouseenter","touchstart","focus"].forEach(t=>{document.addEventListener(t,e=>{if(e.target instanceof HTMLAnchorElement){let a=e.target;a.origin===location.origin&&a.pathname!==location.pathname&&!a.pathname.startsWith("/app/")&&a.dataset.astroReload===void 0&&!a.hasAttribute("download")&&a.role!=="button"&&w()&&N(a.pathname)}},{passive:!0,capture:!0})}),addEventListener("load",x),addEventListener("scroll",W(()=>{history.state&&g({...history.state,scrollY})},300),{passive:!0}));
@@ -1 +1 @@
1
- import{i as E,s as b,c as p,a as N}from"./customer-session.dSYHWdP4.js";import{s as w}from"./shopping-cart.v-dB3kHB.js";import{g as v,e as I}from"./use-analytics._ef6TM4P.js";import{u as O}from"./afetch.OifQZgwR.js";import"./index.KfrHdfOH.js";import{w as T}from"./sf-utils.c42cbZ9W.js";import"./hoisted.d2SGwVMl.js";import"./server-data.4C60Esyt.js";import"./price.Easct8WC.js";import"./name.VA3MEpe0.js";import"./i18n.zhlBzJt8.js";const R=o=>{let a="";if(typeof o=="object"&&o!==null){let i=Array.isArray(o.phones)?o.phones[0]:o;i&&i.number&&(i.country_code&&(a=`+${i.country_code} `),a+=i.number)}return a},k=R,M=()=>{const o=window.storefrontApp?.router;if(o){const a=()=>sessionStorage.getItem("st_discount_coupon")||void 0,i=s=>Math.round(s*100)/100,h=[],r=(s,t)=>{h.includes(s)||(h.push(s),t||(t={value:i(w.subtotal||0),items:w.items.map(v)}),s!=="view_cart"&&(t.coupon=a(),h.includes("begin_checkout")||r("begin_checkout")),I(s,t))};let g=!1;const m=(s,t)=>{if(!g){if(localStorage.getItem("gtag.orderIdSent")!==s){let _;if(t)try{_=JSON.parse(t)}catch{}const{amount:l}=_||window.storefrontApp,S={transaction_id:s,value:i(l?.total||w.subtotal||0),items:w.items.map(v),coupon:_?_.extra_discount?.discount_coupon:a()};l&&(l.freight!==void 0&&(S.shipping=i(l.freight)),l.tax!==void 0&&(S.tax=i(l.tax)));let A=1;const{dataLayer:y,__sendGTMExtraPurchaseData:P}=window;if(y&&P){const n={};let e;if(p){n.customerDisplayName=N.value;let c=p.value.name;if(!c?.given_name)try{const f=sessionStorage.getItem("ecomCustomerAccount");if(f){const C=JSON.parse(f);typeof C=="object"&&C&&(c=C.name)}}catch{}c&&(n.customerGivenName=c.given_name,n.customerFamilyName=c.family_name),n.customerEmail=p.value.main_email,n.customerPhone=k(p.value),e=p.value.addresses?.[0]}try{const c=sessionStorage.getItem("ecomCustomerAddress");if(c){const f=JSON.parse(c);typeof e=="object"&&e?Object.assign(e,f):e=f}}catch{}e&&e.zip&&(n.shippingAddrZip=e.zip,n.shippingAddrStreet=e.street,n.shippingAddrNumber=e.number,e.street&&e.number&&(n.shippingAddrStreet+=`, ${e.number}`),n.shippingAddrCity=e.city,n.shippingAddrProvinceCode=e.province_code),y.push({event:"purchaseExtraData",...n}),A=100}setTimeout(()=>I("purchase",S),A),localStorage.setItem("gtag.orderIdSent",s)}g=!0}};let u;const d=({name:s,params:t})=>{switch(s){case"cart":r("view_cart");break;case"checkout":t.step?Number(t.step)===1?r("add_shipping_info"):Number(t.step)===2&&r("add_payment_info"):r("begin_checkout");break;case"confirmation":clearTimeout(u),t.json?m(t.id,decodeURIComponent(t.json)):u=setTimeout(()=>{m(t.id)},1500);break}};o.currentRoute&&d(o.currentRoute),o.afterEach(d)}};{Object.keys(O).length&&sessionStorage.setItem("ecomUtm",JSON.stringify(O));let o=window.location.search;!o&&window.location.hash&&(o="?"+window.location.hash.split("?")[1]);const a=new URLSearchParams(o);a.get("product_id")&&a.get("quantity")==="1"&&(localStorage.setItem("ecomShoppingCart__tmp",JSON.stringify({items:[{product_id:a.get("product_id"),variation_id:a.get("variation_id")||void 0,quantity:1}]})),window.ECOM_CART_STORAGE_KEY="ecomShoppingCart__tmp");const{hostname:i}=window.location,{domain:h}=globalThis.$storefront.settings,r=`https://ecomplus.io/v2/:${window.ECOM_STORE_ID}/`;window.ECOMCLIENT_API_STORE=r,window.ECOMCLIENT_API_STORE_CACHE=r,window.ECOMCLIENT_API_PASSPORT=r,window.ECOMCLIENT_API_SEARCH=`${r}/search/_els/`,window.ECOMCLIENT_API_MODULES=["localhost","127.0.0.1"].includes(i)?`https://${h}/_api/modules/`:"/_api/modules/";const g=()=>{const{ecomPassport:u}=window;T(E,async()=>{E.value?u.setSession({auth:{...b.auth,id:b.auth?.customer_id,level:3},customer:p.value}):u.checkLogin()&&u.logout()},{immediate:!0}),T(p,d=>{(d.display_name||d.main_email)&&u.setCustomer(d)},{immediate:!0}),setTimeout(M,400)},m=document.createElement("script");m.src="https://cdn.jsdelivr.net/npm/@ecomplus/storefront-app@2.0.0-beta.190/dist/lib/js/app.js",m.onload=g,document.body.appendChild(m)}
1
+ import{i as E,s as b,c as p,a as N}from"./customer-session.ZD6tLDQJ.js";import{s as w}from"./shopping-cart.nSNNOrp9.js";import{g as v,e as I}from"./use-analytics.wTmoP8B1.js";import{u as O}from"./afetch.OifQZgwR.js";import"./index.KfrHdfOH.js";import{w as T}from"./sf-utils.c42cbZ9W.js";import"./hoisted.GaT7bmE3.js";import"./server-data.4C60Esyt.js";import"./price.Easct8WC.js";import"./name.VA3MEpe0.js";import"./i18n.zhlBzJt8.js";const R=o=>{let a="";if(typeof o=="object"&&o!==null){let i=Array.isArray(o.phones)?o.phones[0]:o;i&&i.number&&(i.country_code&&(a=`+${i.country_code} `),a+=i.number)}return a},k=R,M=()=>{const o=window.storefrontApp?.router;if(o){const a=()=>sessionStorage.getItem("st_discount_coupon")||void 0,i=s=>Math.round(s*100)/100,h=[],r=(s,t)=>{h.includes(s)||(h.push(s),t||(t={value:i(w.subtotal||0),items:w.items.map(v)}),s!=="view_cart"&&(t.coupon=a(),h.includes("begin_checkout")||r("begin_checkout")),I(s,t))};let g=!1;const m=(s,t)=>{if(!g){if(localStorage.getItem("gtag.orderIdSent")!==s){let _;if(t)try{_=JSON.parse(t)}catch{}const{amount:l}=_||window.storefrontApp,S={transaction_id:s,value:i(l?.total||w.subtotal||0),items:w.items.map(v),coupon:_?_.extra_discount?.discount_coupon:a()};l&&(l.freight!==void 0&&(S.shipping=i(l.freight)),l.tax!==void 0&&(S.tax=i(l.tax)));let A=1;const{dataLayer:y,__sendGTMExtraPurchaseData:P}=window;if(y&&P){const n={};let e;if(p){n.customerDisplayName=N.value;let c=p.value.name;if(!c?.given_name)try{const f=sessionStorage.getItem("ecomCustomerAccount");if(f){const C=JSON.parse(f);typeof C=="object"&&C&&(c=C.name)}}catch{}c&&(n.customerGivenName=c.given_name,n.customerFamilyName=c.family_name),n.customerEmail=p.value.main_email,n.customerPhone=k(p.value),e=p.value.addresses?.[0]}try{const c=sessionStorage.getItem("ecomCustomerAddress");if(c){const f=JSON.parse(c);typeof e=="object"&&e?Object.assign(e,f):e=f}}catch{}e&&e.zip&&(n.shippingAddrZip=e.zip,n.shippingAddrStreet=e.street,n.shippingAddrNumber=e.number,e.street&&e.number&&(n.shippingAddrStreet+=`, ${e.number}`),n.shippingAddrCity=e.city,n.shippingAddrProvinceCode=e.province_code),y.push({event:"purchaseExtraData",...n}),A=100}setTimeout(()=>I("purchase",S),A),localStorage.setItem("gtag.orderIdSent",s)}g=!0}};let u;const d=({name:s,params:t})=>{switch(s){case"cart":r("view_cart");break;case"checkout":t.step?Number(t.step)===1?r("add_shipping_info"):Number(t.step)===2&&r("add_payment_info"):r("begin_checkout");break;case"confirmation":clearTimeout(u),t.json?m(t.id,decodeURIComponent(t.json)):u=setTimeout(()=>{m(t.id)},1500);break}};o.currentRoute&&d(o.currentRoute),o.afterEach(d)}};{Object.keys(O).length&&sessionStorage.setItem("ecomUtm",JSON.stringify(O));let o=window.location.search;!o&&window.location.hash&&(o="?"+window.location.hash.split("?")[1]);const a=new URLSearchParams(o);a.get("product_id")&&a.get("quantity")==="1"&&(localStorage.setItem("ecomShoppingCart__tmp",JSON.stringify({items:[{product_id:a.get("product_id"),variation_id:a.get("variation_id")||void 0,quantity:1}]})),window.ECOM_CART_STORAGE_KEY="ecomShoppingCart__tmp");const{hostname:i}=window.location,{domain:h}=globalThis.$storefront.settings,r=`https://ecomplus.io/v2/:${window.ECOM_STORE_ID}/`;window.ECOMCLIENT_API_STORE=r,window.ECOMCLIENT_API_STORE_CACHE=r,window.ECOMCLIENT_API_PASSPORT=r,window.ECOMCLIENT_API_SEARCH=`${r}/search/_els/`,window.ECOMCLIENT_API_MODULES=["localhost","127.0.0.1"].includes(i)?`https://${h}/_api/modules/`:"/_api/modules/";const g=()=>{const{ecomPassport:u}=window;T(E,async()=>{E.value?u.setSession({auth:{...b.auth,id:b.auth?.customer_id,level:3},customer:p.value}):u.checkLogin()&&u.logout()},{immediate:!0}),T(p,d=>{(d.display_name||d.main_email)&&u.setCustomer(d)},{immediate:!0}),setTimeout(M,400)},m=document.createElement("script");m.src="https://cdn.jsdelivr.net/npm/@ecomplus/storefront-app@2.0.0-beta.190/dist/lib/js/app.js",m.onload=g,document.body.appendChild(m)}
@@ -0,0 +1 @@
1
+ import"./hoisted.GaT7bmE3.js";import"./afetch.OifQZgwR.js";import"./use-analytics.wTmoP8B1.js";import"./customer-session.ZD6tLDQJ.js";import"./server-data.4C60Esyt.js";import"./sf-utils.c42cbZ9W.js";import"./index.KfrHdfOH.js";import"./shopping-cart.nSNNOrp9.js";import"./price.Easct8WC.js";import"./name.VA3MEpe0.js";import"./i18n.zhlBzJt8.js";const t=window.location.search.includes("status=404")?"404Msg":"5xxMsg";document.getElementById(t).style.display="block";document.getElementById("loadingMsg").style.display="none";